diff options
-rw-r--r-- | include/mbgl/map/map_observer.hpp | 8 | ||||
-rwxr-xr-x | platform/android/src/native_map_view.cpp | 4 | ||||
-rwxr-xr-x | platform/android/src/native_map_view.hpp | 2 | ||||
-rw-r--r-- | platform/ios/src/MGLMapView+Impl.h | 2 | ||||
-rw-r--r-- | platform/ios/src/MGLMapView+Impl.mm | 4 | ||||
-rw-r--r-- | platform/macos/src/MGLMapView+Impl.h | 2 | ||||
-rw-r--r-- | platform/macos/src/MGLMapView+Impl.mm | 4 | ||||
-rw-r--r-- | platform/qt/src/qmapboxgl_map_observer.cpp | 4 | ||||
-rw-r--r-- | platform/qt/src/qmapboxgl_map_observer.hpp | 2 | ||||
-rw-r--r-- | src/mbgl/map/map_impl.cpp | 2 | ||||
-rw-r--r-- | test/map/map.test.cpp | 2 | ||||
-rw-r--r-- | test/src/mbgl/test/stub_map_observer.hpp | 6 |
12 files changed, 24 insertions, 18 deletions
diff --git a/include/mbgl/map/map_observer.hpp b/include/mbgl/map/map_observer.hpp index 7de6a3fa84..258699a2a6 100644 --- a/include/mbgl/map/map_observer.hpp +++ b/include/mbgl/map/map_observer.hpp @@ -34,6 +34,12 @@ public: Full }; + struct RenderFrameStatus { + RenderMode mode; + bool needsRepaint; // In continous mode, shows that there are ongoig transitions. + bool placementChanged; + }; + virtual void onCameraWillChange(CameraChangeMode) {} virtual void onCameraIsChanging() {} virtual void onCameraDidChange(CameraChangeMode) {} @@ -41,7 +47,7 @@ public: virtual void onDidFinishLoadingMap() {} virtual void onDidFailLoadingMap(MapLoadError, const std::string&) {} virtual void onWillStartRenderingFrame() {} - virtual void onDidFinishRenderingFrame(RenderMode, bool /*placementChanged*/) {} + virtual void onDidFinishRenderingFrame(RenderFrameStatus) {} virtual void onWillStartRenderingMap() {} virtual void onDidFinishRenderingMap(RenderMode) {} virtual void onDidFinishLoadingStyle() {} diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp index 8ef757de15..7b87693cf5 100755 --- a/platform/android/src/native_map_view.cpp +++ b/platform/android/src/native_map_view.cpp @@ -185,7 +185,7 @@ void NativeMapView::onWillStartRenderingFrame() { } } -void NativeMapView::onDidFinishRenderingFrame(MapObserver::RenderMode mode, bool) { +void NativeMapView::onDidFinishRenderingFrame(MapObserver::RenderFrameStatus status) { assert(vm != nullptr); android::UniqueEnv _env = android::AttachEnv(); @@ -193,7 +193,7 @@ void NativeMapView::onDidFinishRenderingFrame(MapObserver::RenderMode mode, bool static auto onDidFinishRenderingFrame = javaClass.GetMethod<void (jboolean)>(*_env, "onDidFinishRenderingFrame"); auto weakReference = javaPeer.get(*_env); if (weakReference) { - weakReference.Call(*_env, onDidFinishRenderingFrame, (jboolean) (mode != MapObserver::RenderMode::Partial)); + weakReference.Call(*_env, onDidFinishRenderingFrame, (jboolean) (status.mode != MapObserver::RenderMode::Partial)); } } diff --git a/platform/android/src/native_map_view.hpp b/platform/android/src/native_map_view.hpp index 26567a003c..ba2178022e 100755 --- a/platform/android/src/native_map_view.hpp +++ b/platform/android/src/native_map_view.hpp @@ -62,7 +62,7 @@ public: void onDidFinishLoadingMap() override; void onDidFailLoadingMap(MapLoadError, const std::string&) override; void onWillStartRenderingFrame() override; - void onDidFinishRenderingFrame(MapObserver::RenderMode, bool) override; + void onDidFinishRenderingFrame(MapObserver::RenderFrameStatus) override; void onWillStartRenderingMap() override; void onDidFinishRenderingMap(MapObserver::RenderMode) override; void onDidBecomeIdle() override; diff --git a/platform/ios/src/MGLMapView+Impl.h b/platform/ios/src/MGLMapView+Impl.h index 66dc408274..232215bd1b 100644 --- a/platform/ios/src/MGLMapView+Impl.h +++ b/platform/ios/src/MGLMapView+Impl.h @@ -62,7 +62,7 @@ public: void onDidFinishLoadingMap() override; void onDidFailLoadingMap(mbgl::MapLoadError mapError, const std::string& what) override; void onWillStartRenderingFrame() override; - void onDidFinishRenderingFrame(mbgl::MapObserver::RenderMode, bool) override; + void onDidFinishRenderingFrame(mbgl::MapObserver::RenderFrameStatus) override; void onWillStartRenderingMap() override; void onDidFinishRenderingMap(mbgl::MapObserver::RenderMode) override; void onDidFinishLoadingStyle() override; diff --git a/platform/ios/src/MGLMapView+Impl.mm b/platform/ios/src/MGLMapView+Impl.mm index 76c9c0f9ba..9cdab4dc63 100644 --- a/platform/ios/src/MGLMapView+Impl.mm +++ b/platform/ios/src/MGLMapView+Impl.mm @@ -68,8 +68,8 @@ void MGLMapViewImpl::onWillStartRenderingFrame() { [mapView mapViewWillStartRenderingFrame]; } -void MGLMapViewImpl::onDidFinishRenderingFrame(mbgl::MapObserver::RenderMode mode, bool) { - bool fullyRendered = mode == mbgl::MapObserver::RenderMode::Full; +void MGLMapViewImpl::onDidFinishRenderingFrame(mbgl::MapObserver::RenderFrameStatus status) { + bool fullyRendered = status.mode == mbgl::MapObserver::RenderMode::Full; [mapView mapViewDidFinishRenderingFrameFullyRendered:fullyRendered]; } diff --git a/platform/macos/src/MGLMapView+Impl.h b/platform/macos/src/MGLMapView+Impl.h index de235fa147..d33a19dbab 100644 --- a/platform/macos/src/MGLMapView+Impl.h +++ b/platform/macos/src/MGLMapView+Impl.h @@ -30,7 +30,7 @@ public: void onDidFinishLoadingMap() override; void onDidFailLoadingMap(mbgl::MapLoadError mapError, const std::string& what) override; void onWillStartRenderingFrame() override; - void onDidFinishRenderingFrame(mbgl::MapObserver::RenderMode, bool /*placementChanged*/) override; + void onDidFinishRenderingFrame(mbgl::MapObserver::RenderFrameStatus) override; void onWillStartRenderingMap() override; void onDidFinishRenderingMap(mbgl::MapObserver::RenderMode) override; void onDidFinishLoadingStyle() override; diff --git a/platform/macos/src/MGLMapView+Impl.mm b/platform/macos/src/MGLMapView+Impl.mm index 1ed5e2ceef..c00f858153 100644 --- a/platform/macos/src/MGLMapView+Impl.mm +++ b/platform/macos/src/MGLMapView+Impl.mm @@ -67,8 +67,8 @@ void MGLMapViewImpl::onWillStartRenderingFrame() { [mapView mapViewWillStartRenderingFrame]; } -void MGLMapViewImpl::onDidFinishRenderingFrame(mbgl::MapObserver::RenderMode mode, bool) { - bool fullyRendered = mode == mbgl::MapObserver::RenderMode::Full; +void MGLMapViewImpl::onDidFinishRenderingFrame(mbgl::MapObserver::RenderFrameStatus status) { + bool fullyRendered = status.mode == mbgl::MapObserver::RenderMode::Full; [mapView mapViewDidFinishRenderingFrameFullyRendered:fullyRendered]; } diff --git a/platform/qt/src/qmapboxgl_map_observer.cpp b/platform/qt/src/qmapboxgl_map_observer.cpp index 7d2af08cc4..00af666b0f 100644 --- a/platform/qt/src/qmapboxgl_map_observer.cpp +++ b/platform/qt/src/qmapboxgl_map_observer.cpp @@ -77,9 +77,9 @@ void QMapboxGLMapObserver::onWillStartRenderingFrame() emit mapChanged(QMapboxGL::MapChangeWillStartRenderingFrame); } -void QMapboxGLMapObserver::onDidFinishRenderingFrame(mbgl::MapObserver::RenderMode mode, bool) +void QMapboxGLMapObserver::onDidFinishRenderingFrame(mbgl::MapObserver::RenderFrameStatus status) { - if (mode == mbgl::MapObserver::RenderMode::Partial) { + if (status.mode == mbgl::MapObserver::RenderMode::Partial) { emit mapChanged(QMapboxGL::MapChangeDidFinishRenderingFrame); } else { emit mapChanged(QMapboxGL::MapChangeDidFinishRenderingFrameFullyRendered); diff --git a/platform/qt/src/qmapboxgl_map_observer.hpp b/platform/qt/src/qmapboxgl_map_observer.hpp index 1620c1ef87..d9e51db28f 100644 --- a/platform/qt/src/qmapboxgl_map_observer.hpp +++ b/platform/qt/src/qmapboxgl_map_observer.hpp @@ -28,7 +28,7 @@ public: void onDidFinishLoadingMap() final; void onDidFailLoadingMap(mbgl::MapLoadError, const std::string&) final; void onWillStartRenderingFrame() final; - void onDidFinishRenderingFrame(mbgl::MapObserver::RenderMode, bool /*placementChanged*/) final; + void onDidFinishRenderingFrame(mbgl::MapObserver::RenderFrameStatus) final; void onWillStartRenderingMap() final; void onDidFinishRenderingMap(mbgl::MapObserver::RenderMode) final; void onDidFinishLoadingStyle() final; diff --git a/src/mbgl/map/map_impl.cpp b/src/mbgl/map/map_impl.cpp index ea55dfd1a8..69c3de9783 100644 --- a/src/mbgl/map/map_impl.cpp +++ b/src/mbgl/map/map_impl.cpp @@ -134,7 +134,7 @@ void Map::Impl::onDidFinishRenderingFrame(RenderMode renderMode, bool needsRepai rendererFullyLoaded = renderMode == RenderMode::Full; if (mode == MapMode::Continuous) { - observer.onDidFinishRenderingFrame(MapObserver::RenderMode(renderMode), placemenChanged); + observer.onDidFinishRenderingFrame({MapObserver::RenderMode(renderMode), needsRepaint, placemenChanged}); if (needsRepaint || transform.inTransition()) { onUpdate(); diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp index 8cb781c6df..c2a79f5f1b 100644 --- a/test/map/map.test.cpp +++ b/test/map/map.test.cpp @@ -762,7 +762,7 @@ TEST(Map, TEST_DISABLED_ON_CI(ContinuousRendering)) { HeadlessFrontend frontend(1); StubMapObserver observer; - observer.didFinishRenderingFrameCallback = [&] (MapObserver::RenderMode) { + observer.didFinishRenderingFrameCallback = [&] (MapObserver::RenderFrameStatus) { // Start a timer that ends the test one second from now. If we are continuing to render // indefinitely, the timer will be constantly restarted and never trigger. Instead, the // emergency shutoff above will trigger, failing the test. diff --git a/test/src/mbgl/test/stub_map_observer.hpp b/test/src/mbgl/test/stub_map_observer.hpp index da150ea83c..89ee4e7953 100644 --- a/test/src/mbgl/test/stub_map_observer.hpp +++ b/test/src/mbgl/test/stub_map_observer.hpp @@ -32,9 +32,9 @@ public: } } - void onDidFinishRenderingFrame(RenderMode mode, bool) final { + void onDidFinishRenderingFrame(RenderFrameStatus status) final { if (didFinishRenderingFrameCallback) { - didFinishRenderingFrameCallback(mode); + didFinishRenderingFrameCallback(status); } } @@ -42,7 +42,7 @@ public: std::function<void()> didFinishLoadingMapCallback; std::function<void()> didFailLoadingMapCallback; std::function<void()> didFinishLoadingStyleCallback; - std::function<void(RenderMode)> didFinishRenderingFrameCallback; + std::function<void(RenderFrameStatus)> didFinishRenderingFrameCallback; }; |