summaryrefslogtreecommitdiff
path: root/src/mbgl/style
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-09-01 10:45:26 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-09-06 14:29:22 -0700
commit6d770cb40f1231e202b603fcc63d3b00efc3f551 (patch)
tree625c4e08551ca2539791c38cf80672faf98af304 /src/mbgl/style
parent8e2170c8855456258de8ffd49d22a621b95e9fb2 (diff)
downloadqtlocation-mapboxgl-6d770cb40f1231e202b603fcc63d3b00efc3f551.tar.gz
[core] Initial state of Source::Impl::enabled must be true
Until Style::recalculate() is called to check that there are no visible layers using the source, we have to assume there are. Otherwise, Style::isLoaded() can return a false positive.
Diffstat (limited to 'src/mbgl/style')
-rw-r--r--src/mbgl/style/source_impl.hpp6
-rw-r--r--src/mbgl/style/style.cpp4
2 files changed, 8 insertions, 2 deletions
diff --git a/src/mbgl/style/source_impl.hpp b/src/mbgl/style/source_impl.hpp
index 52b2e46a38..fa278b3623 100644
--- a/src/mbgl/style/source_impl.hpp
+++ b/src/mbgl/style/source_impl.hpp
@@ -74,7 +74,11 @@ public:
const std::string id;
bool loaded = false;
- bool enabled = false;
+
+ // Tracks whether the source is used by any layers visible at the current zoom level. Must
+ // be initialized to true so that Style::isLoaded() does not produce false positives if
+ // called before Style::recalculate().
+ bool enabled = true;
protected:
void invalidateTiles();
diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp
index 1009654fc4..7317100bec 100644
--- a/src/mbgl/style/style.cpp
+++ b/src/mbgl/style/style.cpp
@@ -305,7 +305,9 @@ bool Style::isLoaded() const {
}
for (const auto& source: sources) {
- if (source->baseImpl->enabled && !source->baseImpl->isLoaded()) return false;
+ if (source->baseImpl->enabled && !source->baseImpl->isLoaded()) {
+ return false;
+ }
}
if (!spriteStore->isLoaded()) {