diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-04-05 12:31:26 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-04-07 11:04:19 -0700 |
commit | 5e53d0586fe97db1d49b4b63313c96efb7bf71f8 (patch) | |
tree | 179c94f21ba3f92cbb866ad4f3fb956e1e653039 /src/mbgl/style | |
parent | 0e72fc4ec3a903bf6a91c3074e6a27275cd87cdd (diff) | |
download | qtlocation-mapboxgl-5e53d0586fe97db1d49b4b63313c96efb7bf71f8.tar.gz |
[core] Invalidate cached tiles of disabled sources on relayout
Diffstat (limited to 'src/mbgl/style')
-rw-r--r-- | src/mbgl/style/source_impl.hpp | 8 | ||||
-rw-r--r-- | src/mbgl/style/style.cpp | 2 |
2 files changed, 7 insertions, 3 deletions
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(); |