From 4b21560cf59877125ea0bdae1a2546ab06f1efb2 Mon Sep 17 00:00:00 2001 From: Mikhail Pozdnyakov Date: Mon, 1 Apr 2019 11:29:28 +0300 Subject: [core] Use `style::LayerProperties` in render layers, buckets and layouts. --- src/mbgl/renderer/layers/render_custom_layer.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/mbgl/renderer/layers/render_custom_layer.cpp') diff --git a/src/mbgl/renderer/layers/render_custom_layer.cpp b/src/mbgl/renderer/layers/render_custom_layer.cpp index 9284ed8238..4148de1ddd 100644 --- a/src/mbgl/renderer/layers/render_custom_layer.cpp +++ b/src/mbgl/renderer/layers/render_custom_layer.cpp @@ -14,8 +14,13 @@ namespace mbgl { using namespace style; +inline const CustomLayer::Impl& impl(const Immutable& impl) { + return static_cast(*impl); +} + RenderCustomLayer::RenderCustomLayer(Immutable _impl) - : RenderLayer(std::move(_impl)), host(impl().host) { + : RenderLayer(makeMutable(std::move(_impl))), + host(impl(baseImpl).host) { assert(gfx::BackendScope::exists()); MBGL_CHECK_ERROR(host->initialize()); } @@ -29,12 +34,9 @@ RenderCustomLayer::~RenderCustomLayer() { } } -const CustomLayer::Impl& RenderCustomLayer::impl() const { - return static_cast(*baseImpl); -} - void RenderCustomLayer::evaluate(const PropertyEvaluationParameters&) { passes = RenderPass::Translucent; + // It is fine to not update `evaluatedProperties`, as `baseImpl` should never be updated for this layer. } bool RenderCustomLayer::hasTransition() const { @@ -49,12 +51,12 @@ void RenderCustomLayer::markContextDestroyed() { } void RenderCustomLayer::render(PaintParameters& paintParameters, RenderSource*) { - if (host != impl().host) { + if (host != impl(baseImpl).host) { //If the context changed, deinitialize the previous one before initializing the new one. if (host && !contextDestroyed) { MBGL_CHECK_ERROR(host->deinitialize()); } - host = impl().host; + host = impl(baseImpl).host; MBGL_CHECK_ERROR(host->initialize()); } -- cgit v1.2.1