diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp index e10a46e99..da71b787d 100644 --- a/src/mbgl/map/map_context.cpp +++ b/src/mbgl/map/map_context.cpp @@ -188,27 +188,25 @@ void MapContext::update() { const auto now = Clock::now(); data.setAnimationTime(now); - auto u = updated.exchange(static_cast(Update::Nothing)) | - data.transform.updateTransitions(now); - + updated |= data.transform.updateTransitions(now); transformState = data.transform.currentState(); - if (u & static_cast(Update::Debug)) { + if (updated & static_cast(Update::Debug)) { assert(painter); painter->setDebug(data.getDebug()); } if (style) { - if (u & static_cast(Update::DefaultTransitionDuration)) { + if (updated & static_cast(Update::DefaultTransitionDuration)) { style->setDefaultTransitionDuration(data.getDefaultTransitionDuration()); } - if (u & static_cast(Update::Classes)) { + if (updated & static_cast(Update::Classes)) { style->cascade(data.getClasses()); } - if (u & static_cast(Update::Classes) || - u & static_cast(Update::Zoom)) { + if (updated & static_cast(Update::Classes) || + updated & static_cast(Update::Zoom)) { style->recalculate(transformState.getNormalizedZoom(), now); } @@ -220,6 +218,8 @@ void MapContext::update() { view.invalidate([this] { render(); }); } + + updated = static_cast(Update::Nothing); } void MapContext::renderStill(StillImageCallback fn) { diff --git a/src/mbgl/map/map_context.hpp b/src/mbgl/map/map_context.hpp index 6e7b082f2..2c9f28708 100644 --- a/src/mbgl/map/map_context.hpp +++ b/src/mbgl/map/map_context.hpp @@ -74,7 +74,7 @@ private: Environment env; EnvironmentScope envScope; - std::atomic updated { static_cast(Update::Nothing) }; + UpdateType updated { static_cast(Update::Nothing) }; std::unique_ptr asyncUpdate; std::unique_ptr workers;