summaryrefslogtreecommitdiff
path: root/src/mbgl/algorithm
diff options
context:
space:
mode:
authorAlexander Shalamov <alexander.shalamov@mapbox.com>2020-03-21 21:55:22 +0200
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2020-04-01 16:18:55 -0400
commit15f73a06f2048d4b5f0481d54a79f3f349187b11 (patch)
tree5166ba99751b11d6a994d0f3825332caf04ccd64 /src/mbgl/algorithm
parent09f7bbcf7c07cc360c933ab1637662397b7db674 (diff)
downloadqtlocation-mapboxgl-15f73a06f2048d4b5f0481d54a79f3f349187b11.tar.gz
[core] Add setMaxOverscaleFactorForParentTiles
Diffstat (limited to 'src/mbgl/algorithm')
-rw-r--r--src/mbgl/algorithm/update_renderables.hpp9
1 files changed, 8 insertions, 1 deletions
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 <mbgl/tile/tile_id.hpp>
#include <mbgl/tile/tile_necessity.hpp>
+#include <mbgl/util/optional.hpp>
#include <mbgl/util/range.hpp>
#include <unordered_set>
@@ -20,7 +21,8 @@ void updateRenderables(GetTileFn getTile,
RenderTileFn renderTile,
const IdealTileIDs& idealTileIDs,
const Range<uint8_t>& zoomRange,
- const uint8_t dataTileZoom) {
+ const uint8_t dataTileZoom,
+ const optional<uint8_t>& maxParentOverscaleFactor = nullopt) {
std::unordered_set<OverscaledTileID> 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.