From 15f73a06f2048d4b5f0481d54a79f3f349187b11 Mon Sep 17 00:00:00 2001 From: Alexander Shalamov Date: Sat, 21 Mar 2020 21:55:22 +0200 Subject: [core] Add setMaxOverscaleFactorForParentTiles --- src/mbgl/algorithm/update_renderables.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/mbgl/algorithm') diff --git a/src/mbgl/algorithm/update_renderables.hpp b/src/mbgl/algorithm/update_renderables.hpp index 57cd4f41ec..316ada8269 100644 --- a/src/mbgl/algorithm/update_renderables.hpp +++ b/src/mbgl/algorithm/update_renderables.hpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -20,7 +21,8 @@ void updateRenderables(GetTileFn getTile, RenderTileFn renderTile, const IdealTileIDs& idealTileIDs, const Range& zoomRange, - const uint8_t dataTileZoom) { + const uint8_t dataTileZoom, + const optional& maxParentOverscaleFactor = nullopt) { std::unordered_set checked; bool covered; int32_t overscaledZ; @@ -86,6 +88,11 @@ void updateRenderables(GetTileFn getTile, for (overscaledZ = dataTileZoom - 1; overscaledZ >= zoomRange.min; --overscaledZ) { const auto parentDataTileID = idealDataTileID.scaledTo(overscaledZ); + // Request / render parent tile only if it's overscale factor is less than defined maximum. + if (maxParentOverscaleFactor && (dataTileZoom - overscaledZ) > *maxParentOverscaleFactor) { + break; + } + if (checked.find(parentDataTileID) != checked.end()) { // Break parent tile ascent, this route has been checked by another child // tile before. -- cgit v1.2.1