diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2019-08-16 12:03:53 +0200 |
---|---|---|
committer | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2020-02-14 17:34:00 +0200 |
commit | a876c965a55213f38b91303c81239fbda0a9f7da (patch) | |
tree | 3189f7cd15c0633a54b8220550ab3e8b28e50a75 /src/mbgl/renderer/layers/render_line_layer.cpp | |
parent | 189ed4aac362f7122e0889cdb9c7fc6580d24392 (diff) | |
download | qtlocation-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.cpp | 9 |
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(); } |