[core] separate Backend from View for headless rendering

This commit is contained in:
Konstantin Käfer
2016-10-06 13:23:50 +02:00
parent 45f4dc0166
commit 5cc390d694
54 changed files with 779 additions and 525 deletions

View File

@@ -55,10 +55,8 @@ void log_gl_string(GLenum name, const char *label) {
}
}
NativeMapView::NativeMapView(JNIEnv *env_, jobject obj_, float pixelRatio_, int availableProcessors_, size_t totalMemory_)
: mbgl::View(*this),
env(env_),
pixelRatio(pixelRatio_),
NativeMapView::NativeMapView(JNIEnv *env_, jobject obj_, float pixelRatio, int availableProcessors_, size_t totalMemory_)
: env(env_),
availableProcessors(availableProcessors_),
totalMemory(totalMemory_),
threadPool(4) {
@@ -82,7 +80,7 @@ NativeMapView::NativeMapView(JNIEnv *env_, jobject obj_, float pixelRatio_, int
mbgl::android::cachePath + "/mbgl-offline.db",
mbgl::android::apkPath);
map = std::make_unique<mbgl::Map>(*this, *fileSource, threadPool, MapMode::Continuous);
map = std::make_unique<mbgl::Map>(*this, *this, pixelRatio, *fileSource, threadPool, MapMode::Continuous);
float zoomFactor = map->getMaxZoom() - map->getMinZoom() + 1;
float cpuFactor = availableProcessors;
@@ -114,8 +112,8 @@ NativeMapView::~NativeMapView() {
vm = nullptr;
}
float NativeMapView::getPixelRatio() const {
return pixelRatio;
void NativeMapView::bind() {
MBGL_CHECK_ERROR(glBindFramebuffer(GL_FRAMEBUFFER, 0));
}
std::array<uint16_t, 2> NativeMapView::getSize() const {