summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-04-05 12:31:26 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-04-07 11:04:19 -0700
commit5e53d0586fe97db1d49b4b63313c96efb7bf71f8 (patch)
tree179c94f21ba3f92cbb866ad4f3fb956e1e653039
parent0e72fc4ec3a903bf6a91c3074e6a27275cd87cdd (diff)
downloadqtlocation-mapboxgl-5e53d0586fe97db1d49b4b63313c96efb7bf71f8.tar.gz
[core] Invalidate cached tiles of disabled sources on relayout
m---------mapbox-gl-js0
-rw-r--r--src/mbgl/style/source_impl.hpp8
-rw-r--r--src/mbgl/style/style.cpp2
3 files changed, 7 insertions, 3 deletions
diff --git a/mapbox-gl-js b/mapbox-gl-js
-Subproject e3b2df28079f350747db177e0707698847d0bcd
+Subproject 1bc8caa7c647d89200b974374b4476cef937aa0
diff --git a/src/mbgl/style/source_impl.hpp b/src/mbgl/style/source_impl.hpp
index e8ba54b2b6..b4473cbc84 100644
--- a/src/mbgl/style/source_impl.hpp
+++ b/src/mbgl/style/source_impl.hpp
@@ -51,6 +51,9 @@ public:
// Removes all tiles (by putting them into the cache).
void removeTiles();
+ // Remove all tiles and clear the cache.
+ void invalidateTiles();
+
// Request that all loaded tiles re-run the layout operation on the existing source
// data with fresh style information.
void reloadTiles();
@@ -92,15 +95,14 @@ public:
void detach();
protected:
- void invalidateTiles();
- void removeStaleTiles(const std::set<OverscaledTileID>&);
-
Source& base;
SourceObserver* observer = nullptr;
std::map<OverscaledTileID, std::unique_ptr<Tile>> tiles;
TileCache cache;
private:
+ void removeStaleTiles(const std::set<OverscaledTileID>&);
+
// TileObserver implementation.
void onTileChanged(Tile&) override;
void onTileError(Tile&, std::exception_ptr) override;
diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp
index 9640988402..4c3ea207f5 100644
--- a/src/mbgl/style/style.cpp
+++ b/src/mbgl/style/style.cpp
@@ -279,6 +279,8 @@ void Style::relayout() {
Source* source = getSource(sourceID);
if (source && source->baseImpl->enabled) {
source->baseImpl->reloadTiles();
+ } else if (source) {
+ source->baseImpl->invalidateTiles();
}
}
updateBatch.sourceIDs.clear();