From 20c3706536ac9e927f80a50e9ec8906dfd0d2baf Mon Sep 17 00:00:00 2001 From: Tobrun Date: Tue, 8 Mar 2016 07:30:18 -0500 Subject: [PATCH] [android] #4240 - add flag to resize only when needed. --- platform/android/src/native_map_view.cpp | 10 ++++++---- platform/android/src/native_map_view.hpp | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp index 17b7755a2..23eb39dab 100755 --- a/platform/android/src/native_map_view.cpp +++ b/platform/android/src/native_map_view.cpp @@ -191,10 +191,11 @@ void NativeMapView::invalidate() { void NativeMapView::beforeRender() { mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::beforeRender()"); - // this fixes the viewport resizing issue, - // but we are calling it every time. - // we should only call this when the resizeView / resizeFramebuffer is called. - glViewport(0,0,fbWidth,fbHeight); + + if(sizeChanged){ + sizeChanged = false; + glViewport(0, 0, fbWidth, fbHeight); + } } void NativeMapView::afterRender() { @@ -751,6 +752,7 @@ void NativeMapView::updateFps() { void NativeMapView::resizeView(int w, int h) { width = w; height = h; + sizeChanged = true; map->update(mbgl::Update::Dimensions); } diff --git a/platform/android/src/native_map_view.hpp b/platform/android/src/native_map_view.hpp index bc5d457f5..5926f781a 100755 --- a/platform/android/src/native_map_view.hpp +++ b/platform/android/src/native_map_view.hpp @@ -75,8 +75,8 @@ private: std::string apiKey; bool firstTime = false; - bool fpsEnabled = false; + bool sizeChanged = false; double fps = 0.0; int width = 0;