summaryrefslogtreecommitdiff
path: root/src/mbgl/style/layers/custom_layer_impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/style/layers/custom_layer_impl.cpp')
-rw-r--r--src/mbgl/style/layers/custom_layer_impl.cpp28
1 files changed, 6 insertions, 22 deletions
diff --git a/src/mbgl/style/layers/custom_layer_impl.cpp b/src/mbgl/style/layers/custom_layer_impl.cpp
index 1d3e9af8d6..e459b57171 100644
--- a/src/mbgl/style/layers/custom_layer_impl.cpp
+++ b/src/mbgl/style/layers/custom_layer_impl.cpp
@@ -2,52 +2,36 @@
#include <mbgl/renderer/render_custom_layer.hpp>
#include <mbgl/map/transform_state.hpp>
#include <mbgl/util/logging.hpp>
+
namespace mbgl {
namespace style {
std::unique_ptr<RenderLayer> CustomLayer::Impl::createRenderLayer() const {
- return std::make_unique<RenderCustomLayer>(*this);
+ return std::make_unique<RenderCustomLayer>(staticImmutableCast<CustomLayer::Impl>(immutableFromThis()));
}
CustomLayer::Impl::Impl(const std::string& id_,
CustomLayerInitializeFunction initializeFn_,
CustomLayerRenderFunction renderFn_,
CustomLayerDeinitializeFunction deinitializeFn_,
- void* context_) {
+ void* context_)
+ : Layer::Impl(LayerType::Custom, id_, std::string()) {
Log::Info(Event::General, "New custom layer Impl: %s", id_.c_str());
- id = id_;
initializeFn = initializeFn_;
renderFn = renderFn_;
deinitializeFn = deinitializeFn_;
context = context_;
}
-CustomLayer::Impl::Impl(const CustomLayer::Impl &other)
- : Layer::Impl(other) {
- id = other.id;
- // Don't copy anything else.
-}
-
-CustomLayer::Impl::~Impl() = default;
-
-std::unique_ptr<Layer> CustomLayer::Impl::clone() const {
- return std::make_unique<CustomLayer>(*this);
-}
-
-std::unique_ptr<Layer> CustomLayer::Impl::cloneRef(const std::string&) const {
- assert(false);
- return std::make_unique<CustomLayer>(*this);
-}
-
void CustomLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const {
}
-void CustomLayer::Impl::initialize() {
+void CustomLayer::Impl::initialize() const {
assert(initializeFn);
initializeFn(context);
}
-void CustomLayer::Impl::deinitialize() {
+void CustomLayer::Impl::deinitialize() const {
if (deinitializeFn) {
deinitializeFn(context);
}