summaryrefslogtreecommitdiff
path: root/src/mbgl/source
diff options
context:
space:
mode:
authorAnsis Brammanis <ansis.brammanis@gmail.com>2016-04-15 13:10:50 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-04-15 13:10:50 -0700
commit70362662f77d63d4ad699b1a139cd084006e1525 (patch)
tree4aa7d218c74e0d636897a30f6fb43ff0a5ba1b84 /src/mbgl/source
parenta2a6e22bddb6fa6c94742fb976d3bded04661b1a (diff)
downloadqtlocation-mapboxgl-70362662f77d63d4ad699b1a139cd084006e1525.tar.gz
[core] look for loaded parent tiles in cache (#4595)
fix #4047 port https://github.com/mapbox/mapbox-gl-js/pull/2158
Diffstat (limited to 'src/mbgl/source')
-rw-r--r--src/mbgl/source/source.cpp10
-rw-r--r--src/mbgl/source/source.hpp2
2 files changed, 9 insertions, 3 deletions
diff --git a/src/mbgl/source/source.cpp b/src/mbgl/source/source.cpp
index 14fd62348b..47efbe9088 100644
--- a/src/mbgl/source/source.cpp
+++ b/src/mbgl/source/source.cpp
@@ -328,7 +328,7 @@ bool Source::findLoadedChildren(const TileID& tileID, int32_t maxCoveringZoom, s
*
* @return boolean Whether a parent was found.
*/
-void Source::findLoadedParent(const TileID& tileID, int32_t minCoveringZoom, std::vector<TileID>& retain) {
+void Source::findLoadedParent(const TileID& tileID, int32_t minCoveringZoom, std::vector<TileID>& retain, const StyleUpdateParameters& parameters) {
for (int32_t z = tileID.z - 1; z >= minCoveringZoom; --z) {
const TileID parent_id = tileID.parent(z, info->maxZoom);
const TileData::State state = hasTile(parent_id);
@@ -338,6 +338,12 @@ void Source::findLoadedParent(const TileID& tileID, int32_t minCoveringZoom, std
return;
}
}
+
+ if (cache.has(parent_id.normalized().to_uint64())) {
+ addTile(parent_id, parameters);
+ retain.emplace_back(parent_id);
+ return;
+ }
}
}
@@ -400,7 +406,7 @@ bool Source::update(const StyleUpdateParameters& parameters) {
// Then, if there are no complete child tiles, try to find existing
// parent tiles that completely cover the missing tile.
if (!complete) {
- findLoadedParent(tileID, minCoveringZoom, retain);
+ findLoadedParent(tileID, minCoveringZoom, retain, parameters);
}
}
}
diff --git a/src/mbgl/source/source.hpp b/src/mbgl/source/source.hpp
index c85e2ccd2d..1aad191a5c 100644
--- a/src/mbgl/source/source.hpp
+++ b/src/mbgl/source/source.hpp
@@ -88,7 +88,7 @@ private:
bool isNewTile);
bool handlePartialTile(const TileID&);
bool findLoadedChildren(const TileID&, int32_t maxCoveringZoom, std::vector<TileID>& retain);
- void findLoadedParent(const TileID&, int32_t minCoveringZoom, std::vector<TileID>& retain);
+ void findLoadedParent(const TileID&, int32_t minCoveringZoom, std::vector<TileID>& retain, const StyleUpdateParameters&);
TileData::State addTile(const TileID&, const StyleUpdateParameters&);
TileData::State hasTile(const TileID&);