summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer/layers/render_custom_layer.cpp
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-04-01 11:29:28 +0300
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-04-17 17:21:41 +0300
commit4b21560cf59877125ea0bdae1a2546ab06f1efb2 (patch)
treebd7f76fd51c29c63ef7b15964752f9c8c9e3bf38 /src/mbgl/renderer/layers/render_custom_layer.cpp
parent1a66a02097f0e3c95a4d06610fc0b7609f6d77b9 (diff)
downloadqtlocation-mapboxgl-4b21560cf59877125ea0bdae1a2546ab06f1efb2.tar.gz
[core] Use `style::LayerProperties` in render layers, buckets and layouts.
Diffstat (limited to 'src/mbgl/renderer/layers/render_custom_layer.cpp')
-rw-r--r--src/mbgl/renderer/layers/render_custom_layer.cpp16
1 files changed, 9 insertions, 7 deletions
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<style::Layer::Impl>& impl) {
+ return static_cast<const CustomLayer::Impl&>(*impl);
+}
+
RenderCustomLayer::RenderCustomLayer(Immutable<style::CustomLayer::Impl> _impl)
- : RenderLayer(std::move(_impl)), host(impl().host) {
+ : RenderLayer(makeMutable<CustomLayerProperties>(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<const CustomLayer::Impl&>(*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());
}