diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2017-04-19 18:25:50 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2017-04-20 09:38:18 +0200 |
commit | 9a9408e8111bcdcd0fcb9a93112d61ab8fce0601 (patch) | |
tree | 1498222077d463ad4b8a3b1fb479696de6716512 /src/mbgl/algorithm | |
parent | 7ddca3b6116903bae9ecde1d49d29a8f1fedcec3 (diff) | |
download | qtlocation-mapboxgl-9a9408e8111bcdcd0fcb9a93112d61ab8fce0601.tar.gz |
[core] Render parent raster tiles when ideal tile can't be loaded
Diffstat (limited to 'src/mbgl/algorithm')
-rw-r--r-- | src/mbgl/algorithm/update_renderables.hpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/mbgl/algorithm/update_renderables.hpp b/src/mbgl/algorithm/update_renderables.hpp index fe2dc2c570..a9c348b538 100644 --- a/src/mbgl/algorithm/update_renderables.hpp +++ b/src/mbgl/algorithm/update_renderables.hpp @@ -43,7 +43,9 @@ void updateRenderables(GetTileFn getTile, retainTile(*tile, Resource::Necessity::Required); renderTile(idealRenderTileID, *tile); } else { - bool triedPrevious = tile->hasTriedOptional(); + // We are now attempting to load child and parent tiles. + bool parentHasTriedOptional = tile->hasTriedOptional(); + bool parentIsLoaded = tile->isLoaded(); // The tile isn't loaded yet, but retain it anyway because it's an ideal tile. retainTile(*tile, Resource::Necessity::Required); @@ -91,13 +93,18 @@ void updateRenderables(GetTileFn getTile, } tile = getTile(parentDataTileID); - if (!tile && triedPrevious) { + if (!tile && (parentHasTriedOptional || parentIsLoaded)) { tile = createTile(parentDataTileID); } if (tile) { - triedPrevious = tile->hasTriedOptional(); - retainTile(*tile, Resource::Necessity::Optional); + retainTile(*tile, parentIsLoaded ? Resource::Necessity::Required + : Resource::Necessity::Optional); + + // Save the current values, since they're the parent of the next iteration + // of the parent tile ascent loop. + parentHasTriedOptional = tile->hasTriedOptional(); + parentIsLoaded = tile->isLoaded(); if (tile->isRenderable()) { renderTile(parentRenderTileID, *tile); |