diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2017-10-13 17:53:30 -0700 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2017-10-17 15:48:41 -0700 |
commit | 0cd646180e787a59e600cb184b189a801e261c5c (patch) | |
tree | 715fdf2c710c9cb01146e0eccf3fb1dc8567e3a6 /src | |
parent | d95079a0f94fdc9294c41739fa993eb48ea2971d (diff) | |
download | qtlocation-mapboxgl-0cd646180e787a59e600cb184b189a801e261c5c.tar.gz |
[core] don't generate clip IDs for buckets/layers that don't need to be clipped
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/algorithm/generate_clip_ids_impl.hpp | 2 | ||||
-rw-r--r-- | src/mbgl/renderer/render_tile.hpp | 1 | ||||
-rw-r--r-- | src/mbgl/renderer/renderer_impl.cpp | 7 |
3 files changed, 9 insertions, 1 deletions
diff --git a/src/mbgl/algorithm/generate_clip_ids_impl.hpp b/src/mbgl/algorithm/generate_clip_ids_impl.hpp index db62214220..6a316dcdad 100644 --- a/src/mbgl/algorithm/generate_clip_ids_impl.hpp +++ b/src/mbgl/algorithm/generate_clip_ids_impl.hpp @@ -17,7 +17,7 @@ void ClipIDGenerator::update(std::vector<std::reference_wrapper<Renderable>> ren const auto end = renderables.end(); for (auto it = renderables.begin(); it != end; it++) { auto& renderable = it->get(); - if (!renderable.used) { + if (!renderable.used || !renderable.needsClipping) { continue; } diff --git a/src/mbgl/renderer/render_tile.hpp b/src/mbgl/renderer/render_tile.hpp index b498972f5c..3db02393d2 100644 --- a/src/mbgl/renderer/render_tile.hpp +++ b/src/mbgl/renderer/render_tile.hpp @@ -28,6 +28,7 @@ public: mat4 matrix; mat4 nearClippedMatrix; bool used = false; + bool needsClipping = false; mat4 translatedMatrix(const std::array<float, 2>& translate, style::TranslateAnchorType anchor, diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp index 1a828b80a3..6a8c18792e 100644 --- a/src/mbgl/renderer/renderer_impl.cpp +++ b/src/mbgl/renderer/renderer_impl.cpp @@ -370,6 +370,13 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { if (bucket) { sortedTilesForInsertion.emplace_back(tile); tile.used = true; + + // We only need clipping when we're _not_ drawing a symbol layer. The only exception + // for symbol layers is when we're rendering still images. See render_symbol_layer.cpp + // for the exception we make there. + if (!symbolLayer || parameters.mapMode == MapMode::Still) { + tile.needsClipping = true; + } } } layer->setRenderTiles(std::move(sortedTilesForInsertion)); |