summaryrefslogtreecommitdiff
path: root/src/mbgl
diff options
context:
space:
mode:
authorAsheem Mamoowala <asheem.mamoowala@mapbox.com>2018-02-05 19:31:03 -0500
committerAsheem Mamoowala <asheem.mamoowala@mapbox.com>2018-02-08 12:39:30 -0800
commit4ab07f5be73f802e1f8f9d88eafa7077dbd5cac8 (patch)
tree7400d2adf7c8b130689598d90dc491d98373bb92 /src/mbgl
parent64374711a09f27c41c93eb6b72d0f6a560234083 (diff)
downloadqtlocation-mapboxgl-4ab07f5be73f802e1f8f9d88eafa7077dbd5cac8.tar.gz
Reset tileset-based render sources when any tileset properties changed. (#11042)
Diffstat (limited to 'src/mbgl')
-rw-r--r--src/mbgl/renderer/sources/render_raster_source.cpp15
-rw-r--r--src/mbgl/renderer/sources/render_raster_source.hpp2
-rw-r--r--src/mbgl/renderer/sources/render_vector_source.cpp15
-rw-r--r--src/mbgl/renderer/sources/render_vector_source.hpp2
4 files changed, 18 insertions, 16 deletions
diff --git a/src/mbgl/renderer/sources/render_raster_source.cpp b/src/mbgl/renderer/sources/render_raster_source.cpp
index 5e63e929e2..46e3c2eff6 100644
--- a/src/mbgl/renderer/sources/render_raster_source.cpp
+++ b/src/mbgl/renderer/sources/render_raster_source.cpp
@@ -29,14 +29,10 @@ void RenderRasterSource::update(Immutable<style::Source::Impl> baseImpl_,
enabled = needsRendering;
- optional<Tileset> tileset = impl().getTileset();
+ optional<Tileset> _tileset = impl().getTileset();
- if (!tileset) {
- return;
- }
-
- if (tileURLTemplates != tileset->tiles) {
- tileURLTemplates = tileset->tiles;
+ if (tileset != _tileset) {
+ tileset = _tileset;
// TODO: this removes existing buckets, and will cause flickering.
// Should instead refresh tile data in place.
@@ -44,6 +40,11 @@ void RenderRasterSource::update(Immutable<style::Source::Impl> baseImpl_,
tilePyramid.renderTiles.clear();
tilePyramid.cache.clear();
}
+ // Allow clearing the tile pyramid first, before the early return in case
+ // the new tileset is not yet available or has an error in loading
+ if (!_tileset) {
+ return;
+ }
tilePyramid.update(layers,
needsRendering,
diff --git a/src/mbgl/renderer/sources/render_raster_source.hpp b/src/mbgl/renderer/sources/render_raster_source.hpp
index 01de812309..aebc49bf8a 100644
--- a/src/mbgl/renderer/sources/render_raster_source.hpp
+++ b/src/mbgl/renderer/sources/render_raster_source.hpp
@@ -39,7 +39,7 @@ private:
const style::RasterSource::Impl& impl() const;
TilePyramid tilePyramid;
- optional<std::vector<std::string>> tileURLTemplates;
+ optional<Tileset> tileset;
};
template <>
diff --git a/src/mbgl/renderer/sources/render_vector_source.cpp b/src/mbgl/renderer/sources/render_vector_source.cpp
index a3da3e7cbd..310dfe68b8 100644
--- a/src/mbgl/renderer/sources/render_vector_source.cpp
+++ b/src/mbgl/renderer/sources/render_vector_source.cpp
@@ -32,14 +32,10 @@ void RenderVectorSource::update(Immutable<style::Source::Impl> baseImpl_,
enabled = needsRendering;
- optional<Tileset> tileset = impl().getTileset();
+ optional<Tileset> _tileset = impl().getTileset();
- if (!tileset) {
- return;
- }
-
- if (tileURLTemplates != tileset->tiles) {
- tileURLTemplates = tileset->tiles;
+ if (tileset != _tileset) {
+ tileset = _tileset;
// TODO: this removes existing buckets, and will cause flickering.
// Should instead refresh tile data in place.
@@ -47,6 +43,11 @@ void RenderVectorSource::update(Immutable<style::Source::Impl> baseImpl_,
tilePyramid.renderTiles.clear();
tilePyramid.cache.clear();
}
+ // Allow clearing the tile pyramid first, before the early return in case
+ // the new tileset is not yet available or has an error in loading
+ if (!_tileset) {
+ return;
+ }
tilePyramid.update(layers,
needsRendering,
diff --git a/src/mbgl/renderer/sources/render_vector_source.hpp b/src/mbgl/renderer/sources/render_vector_source.hpp
index 5e5c6d1108..f237b4b825 100644
--- a/src/mbgl/renderer/sources/render_vector_source.hpp
+++ b/src/mbgl/renderer/sources/render_vector_source.hpp
@@ -39,7 +39,7 @@ private:
const style::VectorSource::Impl& impl() const;
TilePyramid tilePyramid;
- optional<std::vector<std::string>> tileURLTemplates;
+ optional<Tileset> tileset;
};
template <>