Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] Do not render symbol layers for pan tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoabinader committed Jul 17, 2018
1 parent faa86ab commit 3e5c7a2
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/mbgl/renderer/tile_pyramid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ void TilePyramid::update(const std::vector<Immutable<style::Layer::Impl>>& layer
std::vector<UnwrappedTileID> idealTiles;
std::vector<UnwrappedTileID> panTiles;

bool usePanLayers = true;
std::vector<Immutable<style::Layer::Impl>> panLayers;
panLayers.reserve(layers.size());
for (const auto& layer : layers) {
if (layer->type == LayerType::Symbol)
continue;
panLayers.emplace_back(layer);
}

if (overscaledZoom >= zoomRange.min) {
uint8_t idealZoom = std::min(zoomRange.max, overscaledZoom);

Expand Down Expand Up @@ -141,7 +150,7 @@ void TilePyramid::update(const std::vector<Immutable<style::Layer::Impl>>& layer
}

if (needsRelayout) {
tile.setLayers(layers);
tile.setLayers(usePanLayers ? panLayers : layers);
}
};
auto getTileFn = [&](const OverscaledTileID& tileID) -> Tile* {
Expand All @@ -165,7 +174,7 @@ void TilePyramid::update(const std::vector<Immutable<style::Layer::Impl>>& layer
tile = createTile(tileID);
if (tile) {
tile->setObserver(observer);
tile->setLayers(layers);
tile->setLayers(usePanLayers ? panLayers : layers);
}
}
if (!tile) {
Expand All @@ -182,7 +191,7 @@ void TilePyramid::update(const std::vector<Immutable<style::Layer::Impl>>& layer
auto renderTileFn = [&](const UnwrappedTileID& tileID, Tile& tile) {
renderTiles.emplace_back(tileID, tile);
previouslyRenderedTiles.erase(tileID); // Still rendering this tile, no need for special fading logic.
tile.markRenderedIdeal();
if (!usePanLayers) tile.markRenderedIdeal();
};

renderTiles.clear();
Expand All @@ -192,6 +201,7 @@ void TilePyramid::update(const std::vector<Immutable<style::Layer::Impl>>& layer
panTiles, zoomRange, panZoom);
}

usePanLayers = false;
algorithm::updateRenderables(getTileFn, createTileFn, retainTileFn, renderTileFn,
idealTiles, zoomRange, tileZoom);

Expand Down

0 comments on commit 3e5c7a2

Please sign in to comment.