summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2019-02-22 14:01:55 +0100
committerŁukasz Paczos <lukasz.paczos@mapbox.com>2019-02-26 09:35:15 +0100
commit9a118b1d743a1e6894c1c75bcc6c111c68c67dd5 (patch)
tree8497f39f1c7a78dbdac5c5ae3549c04f462e5e86
parentdc308f2dd4a07c5d06a3a1ba5d75b996f737c815 (diff)
downloadqtlocation-mapboxgl-9a118b1d743a1e6894c1c75bcc6c111c68c67dd5.tar.gz
[android] re-create renderer on surface update after app backgrounding (in case egl context is preserved, but surface is not)
(cherry picked from commit 96fef8172b2e9484b0631961d36aac0f381c00bf)
-rw-r--r--platform/android/src/map_renderer.cpp7
-rw-r--r--platform/android/src/map_renderer.hpp4
2 files changed, 9 insertions, 2 deletions
diff --git a/platform/android/src/map_renderer.cpp b/platform/android/src/map_renderer.cpp
index cff021afd2..cd8953e4cf 100644
--- a/platform/android/src/map_renderer.cpp
+++ b/platform/android/src/map_renderer.cpp
@@ -184,7 +184,12 @@ void MapRenderer::onSurfaceCreated(JNIEnv&) {
}
}
-void MapRenderer::onSurfaceChanged(JNIEnv&, jint width, jint height) {
+void MapRenderer::onSurfaceChanged(JNIEnv& env, jint width, jint height) {
+ if (!renderer) {
+ // In case the surface has been destroyed (due to app back-grounding)
+ onSurfaceCreated(env);
+ }
+
backend->resizeFramebuffer(width, height);
framebufferSizeChanged = true;
requestRender();
diff --git a/platform/android/src/map_renderer.hpp b/platform/android/src/map_renderer.hpp
index 8c2f28a4df..fdc3600d02 100644
--- a/platform/android/src/map_renderer.hpp
+++ b/platform/android/src/map_renderer.hpp
@@ -94,7 +94,9 @@ private:
void onSurfaceChanged(JNIEnv&, jint width, jint height);
- // Called on Main thread
+private:
+ // Called on either Main or GL thread //
+
void onSurfaceDestroyed(JNIEnv&);
private: