summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-04-23 16:02:22 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-04-28 14:32:25 -0400
commit59255a3d9e48196ee0c7d3a2850d5f37d2e4e8b5 (patch)
treeea177973ad1c6ed844b53c57992644e9cd9706ac /src
parent8bb7fc64ff2dbb4ce58d1a7127b8328fffeaa1de (diff)
downloadqtlocation-mapboxgl-59255a3d9e48196ee0c7d3a2850d5f37d2e4e8b5.tar.gz
MapContext::updated doesn't need to be atomic
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/map/map_context.cpp16
-rw-r--r--src/mbgl/map/map_context.hpp2
2 files changed, 9 insertions, 9 deletions
diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp
index e10a46e99b..da71b787df 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<UpdateType>(Update::Nothing)) |
- data.transform.updateTransitions(now);
-
+ updated |= data.transform.updateTransitions(now);
transformState = data.transform.currentState();
- if (u & static_cast<UpdateType>(Update::Debug)) {
+ if (updated & static_cast<UpdateType>(Update::Debug)) {
assert(painter);
painter->setDebug(data.getDebug());
}
if (style) {
- if (u & static_cast<UpdateType>(Update::DefaultTransitionDuration)) {
+ if (updated & static_cast<UpdateType>(Update::DefaultTransitionDuration)) {
style->setDefaultTransitionDuration(data.getDefaultTransitionDuration());
}
- if (u & static_cast<UpdateType>(Update::Classes)) {
+ if (updated & static_cast<UpdateType>(Update::Classes)) {
style->cascade(data.getClasses());
}
- if (u & static_cast<UpdateType>(Update::Classes) ||
- u & static_cast<UpdateType>(Update::Zoom)) {
+ if (updated & static_cast<UpdateType>(Update::Classes) ||
+ updated & static_cast<UpdateType>(Update::Zoom)) {
style->recalculate(transformState.getNormalizedZoom(), now);
}
@@ -220,6 +218,8 @@ void MapContext::update() {
view.invalidate([this] { render(); });
}
+
+ updated = static_cast<UpdateType>(Update::Nothing);
}
void MapContext::renderStill(StillImageCallback fn) {
diff --git a/src/mbgl/map/map_context.hpp b/src/mbgl/map/map_context.hpp
index 6e7b082f2a..2c9f287086 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<UpdateType> updated { static_cast<UpdateType>(Update::Nothing) };
+ UpdateType updated { static_cast<UpdateType>(Update::Nothing) };
std::unique_ptr<uv::async> asyncUpdate;
std::unique_ptr<Worker> workers;