[core] use raii to guard backend deactivation
This commit is contained in:
committed by
Ivo van Dongen
parent
ffd74c309e
commit
c76a933514
@@ -175,7 +175,7 @@ void NativeMapView::invalidate() {
|
||||
}
|
||||
|
||||
void NativeMapView::render() {
|
||||
activate();
|
||||
BackendScope guard(*this);
|
||||
|
||||
if (framebufferSizeChanged) {
|
||||
getContext().viewport = { 0, 0, getFramebufferSize() };
|
||||
@@ -214,8 +214,6 @@ void NativeMapView::render() {
|
||||
} else {
|
||||
mbgl::Log::Info(mbgl::Event::Android, "Not swapping as we are not ready");
|
||||
}
|
||||
|
||||
deactivate();
|
||||
}
|
||||
|
||||
mbgl::Map &NativeMapView::getMap() { return *map; }
|
||||
@@ -410,7 +408,7 @@ void NativeMapView::createSurface(ANativeWindow *window_) {
|
||||
if (!firstTime) {
|
||||
firstTime = true;
|
||||
|
||||
activate();
|
||||
BackendScope guard(*this);
|
||||
|
||||
if (!eglMakeCurrent(display, surface, surface, context)) {
|
||||
mbgl::Log::Error(mbgl::Event::OpenGL, "eglMakeCurrent() returned error %d",
|
||||
@@ -421,8 +419,6 @@ void NativeMapView::createSurface(ANativeWindow *window_) {
|
||||
mbgl::gl::InitializeExtensions([] (const char * name) {
|
||||
return reinterpret_cast<mbgl::gl::glProc>(eglGetProcAddress(name));
|
||||
});
|
||||
|
||||
deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user