summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer/layers/render_line_layer.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-08-16 12:03:53 +0200
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2020-02-14 17:34:00 +0200
commita876c965a55213f38b91303c81239fbda0a9f7da (patch)
tree3189f7cd15c0633a54b8220550ab3e8b28e50a75 /src/mbgl/renderer/layers/render_line_layer.cpp
parent189ed4aac362f7122e0889cdb9c7fc6580d24392 (diff)
downloadqtlocation-mapboxgl-a876c965a55213f38b91303c81239fbda0a9f7da.tar.gz
[core] Store SegmentVectors in ephemeral render objects
We used some shared SegmentVectors, e.g. for drawing raster or background tiles. In longer running maps, this lead to resource accumulation. By storing the SegmentVectors and the contained gfx::DrawScope objects, we ensure that resources get released when the associated render objects vanish.
Diffstat (limited to 'src/mbgl/renderer/layers/render_line_layer.cpp')
-rw-r--r--src/mbgl/renderer/layers/render_line_layer.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/mbgl/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp
index 588cf6286c..90bb38b9f9 100644
--- a/src/mbgl/renderer/layers/render_line_layer.cpp
+++ b/src/mbgl/renderer/layers/render_line_layer.cpp
@@ -23,7 +23,7 @@ using namespace style;
namespace {
-inline const LineLayer::Impl& impl(const Immutable<style::Layer::Impl>& impl) {
+inline const LineLayer::Impl& impl_cast(const Immutable<style::Layer::Impl>& impl) {
assert(impl->getTypeInfo() == LineLayer::Impl::staticTypeInfo());
return static_cast<const LineLayer::Impl&>(*impl);
}
@@ -32,14 +32,13 @@ inline const LineLayer::Impl& impl(const Immutable<style::Layer::Impl>& impl) {
RenderLineLayer::RenderLineLayer(Immutable<style::LineLayer::Impl> _impl)
: RenderLayer(makeMutable<LineLayerProperties>(std::move(_impl))),
- unevaluated(impl(baseImpl).paint.untransitioned()),
- colorRamp({256, 1}) {
-}
+ unevaluated(impl_cast(baseImpl).paint.untransitioned()),
+ colorRamp({256, 1}) {}
RenderLineLayer::~RenderLineLayer() = default;
void RenderLineLayer::transition(const TransitionParameters& parameters) {
- unevaluated = impl(baseImpl).paint.transitioned(parameters, std::move(unevaluated));
+ unevaluated = impl_cast(baseImpl).paint.transitioned(parameters, std::move(unevaluated));
updateColorRamp();
}