summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2015-07-20 21:19:36 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2015-07-20 21:59:13 +0300
commit784eb355122bb0e4a01dff29da88aa6a76e2b85b (patch)
tree166adbc25848cf66dce4d9b6c1ec683bad0ab755
parentfad241f8cf5f84add544887a04d4ce1108031aa1 (diff)
downloadqtlocation-mapboxgl-784eb355122bb0e4a01dff29da88aa6a76e2b85b.tar.gz
Revert "Revert "split renderSync and transition nudging to allow client view syncing""
This reverts commit 263f9fad308873077b9287dd8aeab089fc415b10.
-rw-r--r--include/mbgl/map/map.hpp5
-rw-r--r--platform/ios/MGLMapView.mm4
-rw-r--r--src/mbgl/map/map.cpp8
3 files changed, 13 insertions, 4 deletions
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp
index d31d6a2757..82aef65b65 100644
--- a/include/mbgl/map/map.hpp
+++ b/include/mbgl/map/map.hpp
@@ -67,7 +67,10 @@ public:
void renderStill(StillImageCallback callback);
// Triggers a synchronous or asynchronous render.
- void renderSync();
+ bool renderSync();
+
+ // Nudges transitions one step, possibly notifying of the need for a rerender.
+ void nudgeTransitions(bool forceRerender);
// Notifies the Map thread that the state has changed and an update might be necessary.
void update(Update update = Update::Nothing);
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm
index c029107c48..0b8baeff24 100644
--- a/platform/ios/MGLMapView.mm
+++ b/platform/ios/MGLMapView.mm
@@ -703,9 +703,11 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
_mbglMap->setSourceTileCacheSize(cacheSize);
- _mbglMap->renderSync();
+ bool needsRerender = _mbglMap->renderSync();
[self updateUserLocationAnnotationView];
+
+ _mbglMap->nudgeTransitions(needsRerender);
}
}
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index 0e58a2912d..d983a9c518 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -48,7 +48,7 @@ void Map::renderStill(StillImageCallback callback) {
FrameData{ view.getFramebufferSize() }, callback);
}
-void Map::renderSync() {
+bool Map::renderSync() {
if (renderState == RenderState::never) {
view.notifyMapChange(MapChangeWillStartRenderingMap);
}
@@ -69,9 +69,13 @@ void Map::renderSync() {
view.notifyMapChange(MapChangeDidFinishRenderingMapFullyRendered);
}
+ return result.needsRerender;
+}
+
+void Map::nudgeTransitions(bool forceRerender) {
if (transform->needsTransition()) {
update(Update(transform->updateTransitions(Clock::now())));
- } else if (result.needsRerender) {
+ } else if (forceRerender) {
update();
}
}