diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2017-09-11 23:30:51 -0400 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2017-09-13 16:38:01 -0400 |
commit | 1090c7bcc9976d7bdfbe620b2b3c537da4f47696 (patch) | |
tree | 491f9b612b68b25e3939c356194da4814e69df00 | |
parent | 7ff27be35694ab33d421c226f4d400434e59b0e3 (diff) | |
download | qtlocation-mapboxgl-upstream/relayout-on-layers-change.tar.gz |
[core] Do not cache stale tilesupstream/relayout-on-layers-change
-rw-r--r-- | platform/node/test/ignores.json | 1 | ||||
-rw-r--r-- | src/mbgl/renderer/tile_pyramid.cpp | 10 | ||||
-rw-r--r-- | src/mbgl/renderer/tile_pyramid.hpp | 2 |
3 files changed, 7 insertions, 6 deletions
diff --git a/platform/node/test/ignores.json b/platform/node/test/ignores.json index 845c7e8a37..50e1defa85 100644 --- a/platform/node/test/ignores.json +++ b/platform/node/test/ignores.json @@ -40,7 +40,6 @@ "render-tests/regressions/mapbox-gl-js#2305": "https://github.com/mapbox/mapbox-gl-native/issues/6927", "render-tests/regressions/mapbox-gl-js#3682": "https://github.com/mapbox/mapbox-gl-js/issues/3682", "render-tests/regressions/mapbox-gl-native#7357": "https://github.com/mapbox/mapbox-gl-native/issues/7357", - "render-tests/regressions/mapbox-gl-native#9900": "skip - https://github.com/mapbox/mapbox-gl-native/pull/9905", "render-tests/runtime-styling/image-add-sdf": "https://github.com/mapbox/mapbox-gl-native/issues/9847", "render-tests/runtime-styling/paint-property-fill-flat-to-extrude": "https://github.com/mapbox/mapbox-gl-native/issues/6745", "render-tests/runtime-styling/set-style-paint-property-fill-flat-to-extrude": "https://github.com/mapbox/mapbox-gl-native/issues/6745", diff --git a/src/mbgl/renderer/tile_pyramid.cpp b/src/mbgl/renderer/tile_pyramid.cpp index 4944de2ba9..9a7260d2ab 100644 --- a/src/mbgl/renderer/tile_pyramid.cpp +++ b/src/mbgl/renderer/tile_pyramid.cpp @@ -171,7 +171,7 @@ void TilePyramid::update(const std::vector<Immutable<style::Layer::Impl>>& layer cache.setSize(conservativeCacheSize); } - removeStaleTiles(retain); + removeStaleTiles(retain, needsRelayout); for (auto& pair : tiles) { const PlacementConfig config { parameters.transformState.getAngle(), @@ -185,15 +185,17 @@ void TilePyramid::update(const std::vector<Immutable<style::Layer::Impl>>& layer } // Moves all tiles to the cache except for those specified in the retain set. -void TilePyramid::removeStaleTiles(const std::set<OverscaledTileID>& retain) { +void TilePyramid::removeStaleTiles(const std::set<OverscaledTileID>& retain, const bool needsRelayout) { // Remove stale tiles. This goes through the (sorted!) tiles map and retain set in lockstep // and removes items from tiles that don't have the corresponding key in the retain set. auto tilesIt = tiles.begin(); auto retainIt = retain.begin(); while (tilesIt != tiles.end()) { if (retainIt == retain.end() || tilesIt->first < *retainIt) { - tilesIt->second->setNecessity(Tile::Necessity::Optional); - cache.add(tilesIt->first, std::move(tilesIt->second)); + if (!needsRelayout) { + tilesIt->second->setNecessity(Tile::Necessity::Optional); + cache.add(tilesIt->first, std::move(tilesIt->second)); + } tiles.erase(tilesIt++); } else { if (!(*retainIt < tilesIt->first)) { diff --git a/src/mbgl/renderer/tile_pyramid.hpp b/src/mbgl/renderer/tile_pyramid.hpp index 3bf9dc75d4..7fed87ebb1 100644 --- a/src/mbgl/renderer/tile_pyramid.hpp +++ b/src/mbgl/renderer/tile_pyramid.hpp @@ -63,7 +63,7 @@ public: bool enabled = false; - void removeStaleTiles(const std::set<OverscaledTileID>&); + void removeStaleTiles(const std::set<OverscaledTileID>&, bool needsRelayout); std::map<OverscaledTileID, std::unique_ptr<Tile>> tiles; TileCache cache; |