summaryrefslogtreecommitdiff
path: root/src/mbgl/style
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-05-03 09:50:06 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-05-03 10:41:04 -0700
commit88093bd708dccb1082bb624a6c27e5aa7688b77a (patch)
treea013645bb176d9f7d9008aa219c7e2b950af2836 /src/mbgl/style
parentd5f4d0f05fcb8490984649d78d6c026f87a77f4e (diff)
downloadqtlocation-mapboxgl-88093bd708dccb1082bb624a6c27e5aa7688b77a.tar.gz
[core] Calculate hasPendingTransitions functionally rather than statefully
Diffstat (limited to 'src/mbgl/style')
-rw-r--r--src/mbgl/style/style.cpp15
-rw-r--r--src/mbgl/style/style.hpp2
2 files changed, 13 insertions, 4 deletions
diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp
index 23536e0e3e..a3c7ce1ad1 100644
--- a/src/mbgl/style/style.cpp
+++ b/src/mbgl/style/style.cpp
@@ -387,9 +387,8 @@ void Style::recalculate(float z, const TimePoint& timePoint, MapMode mode) {
mode == MapMode::Continuous ? util::DEFAULT_FADE_DURATION : Duration::zero()
};
- hasPendingTransitions = transitioningLight.hasTransition();
for (const auto& layer : renderLayers) {
- hasPendingTransitions |= layer->evaluate(parameters);
+ layer->evaluate(parameters);
if (layer->needsRendering(zoomHistory.lastZoom)) {
if (RenderSource* renderSource = getRenderSource(layer->baseImpl.source)) {
@@ -443,7 +442,17 @@ RenderSource* Style::getRenderSource(const std::string& id) const {
}
bool Style::hasTransitions() const {
- return hasPendingTransitions;
+ if (transitioningLight.hasTransition()) {
+ return true;
+ }
+
+ for (const auto& layer : renderLayers) {
+ if (layer->hasTransition()) {
+ return true;
+ }
+ }
+
+ return false;
}
bool Style::isLoaded() const {
diff --git a/src/mbgl/style/style.hpp b/src/mbgl/style/style.hpp
index fe588c3ce5..c7528483e9 100644
--- a/src/mbgl/style/style.hpp
+++ b/src/mbgl/style/style.hpp
@@ -180,9 +180,9 @@ private:
UpdateBatch updateBatch;
ZoomHistory zoomHistory;
- bool hasPendingTransitions = false;
void removeRenderLayer(const std::string& layerID);
+
public:
bool loaded = false;
};