summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-06-29 22:40:50 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-07-04 15:50:50 +0300
commit60eae41549cec18dfeed5175fe1d6c327060a8de (patch)
tree8338673b9b01656d14fa645be878004309245e5a
parenta744e35f44213584574b2e5377076d4b6d99ac7b (diff)
downloadqtlocation-mapboxgl-60eae41549cec18dfeed5175fe1d6c327060a8de.tar.gz
[core] Factor timePoint initialization: take 2
-rw-r--r--src/mbgl/map/map.cpp4
-rw-r--r--src/mbgl/map/zoom_history.hpp7
-rw-r--r--src/mbgl/renderer/render_style.cpp4
3 files changed, 9 insertions, 6 deletions
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index 4d073802c2..034e43f260 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -207,7 +207,9 @@ void Map::render(View& view) {
}
void Map::Impl::render(View& view) {
- TimePoint timePoint = Clock::now();
+ TimePoint timePoint = mode == MapMode::Continuous
+ ? Clock::now()
+ : Clock::time_point::max();
transform.updateTransitions(timePoint);
diff --git a/src/mbgl/map/zoom_history.hpp b/src/mbgl/map/zoom_history.hpp
index 308846b1e3..697e28573c 100644
--- a/src/mbgl/map/zoom_history.hpp
+++ b/src/mbgl/map/zoom_history.hpp
@@ -13,19 +13,20 @@ struct ZoomHistory {
bool first = true;
bool update(float z, const TimePoint& now) {
+ constexpr TimePoint zero = TimePoint(Duration::zero());
if (first) {
first = false;
lastIntegerZoom = std::floor(z);
- lastIntegerZoomTime = TimePoint(Duration::zero());
+ lastIntegerZoomTime = zero;
lastZoom = z;
return true;
} else {
if (std::floor(lastZoom) < std::floor(z)) {
lastIntegerZoom = std::floor(z);
- lastIntegerZoomTime = now;
+ lastIntegerZoomTime = now == Clock::time_point::max() ? zero : now;
} else if (std::floor(lastZoom) > std::floor(z)) {
lastIntegerZoom = std::floor(z + 1);
- lastIntegerZoomTime = now;
+ lastIntegerZoomTime = now == Clock::time_point::max() ? zero : now;
}
if (z != lastZoom) {
diff --git a/src/mbgl/renderer/render_style.cpp b/src/mbgl/renderer/render_style.cpp
index 79b20a9d71..91efb6c737 100644
--- a/src/mbgl/renderer/render_style.cpp
+++ b/src/mbgl/renderer/render_style.cpp
@@ -86,13 +86,13 @@ void RenderStyle::update(const UpdateParameters& parameters) {
const bool zoomChanged = zoomHistory.update(parameters.transformState.getZoom(), parameters.timePoint);
const TransitionParameters transitionParameters {
- parameters.mode == MapMode::Continuous ? parameters.timePoint : Clock::time_point::max(),
+ parameters.timePoint,
parameters.mode == MapMode::Continuous ? parameters.transitionOptions : TransitionOptions()
};
const PropertyEvaluationParameters evaluationParameters {
zoomHistory,
- parameters.mode == MapMode::Continuous ? parameters.timePoint : Clock::time_point::max(),
+ parameters.timePoint,
parameters.mode == MapMode::Continuous ? util::DEFAULT_TRANSITION_DURATION : Duration::zero()
};