summaryrefslogtreecommitdiff
path: root/src/mbgl/style/layers/custom_layer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/style/layers/custom_layer.cpp')
-rw-r--r--src/mbgl/style/layers/custom_layer.cpp44
1 files changed, 32 insertions, 12 deletions
diff --git a/src/mbgl/style/layers/custom_layer.cpp b/src/mbgl/style/layers/custom_layer.cpp
index 40013f3422..3198173412 100644
--- a/src/mbgl/style/layers/custom_layer.cpp
+++ b/src/mbgl/style/layers/custom_layer.cpp
@@ -5,37 +5,50 @@
namespace mbgl {
namespace style {
+CustomLayer::~CustomLayer()
+{
+ printf("~CustomLayer destructor %p\n", this);
+
+}
+
CustomLayer::CustomLayer(const std::string& layerID,
CustomLayerInitializeFunction init,
CustomLayerRenderFunction render,
CustomLayerContextLostFunction contextLost,
CustomLayerDeinitializeFunction deinit,
- CustomLayerDeallocationFunction deallocation,
+
+ CustomLayerContextOwnerChangedFunction ownerChanged,
+ CustomLayerContextAttachFunction attach,
+ CustomLayerContextDetachFunction detach,
void* context)
- : Layer(makeMutable<Impl>(layerID, init, render, contextLost, deinit, context)),
- deallocationFn(deallocation) {
+ : Layer(makeMutable<Impl>(layerID, init, render, contextLost, deinit, ownerChanged, attach, detach, context))
+{
+ printf("CustomLayer::CustomLayer %p\n", this);
+
}
CustomLayer::CustomLayer(const std::string& layerID,
CustomLayerInitializeFunction init,
CustomLayerRenderFunction render,
CustomLayerDeinitializeFunction deinit,
- CustomLayerDeallocationFunction deallocation,
+
+ CustomLayerContextOwnerChangedFunction ownerChanged,
+ CustomLayerContextAttachFunction attach,
+ CustomLayerContextDetachFunction detach,
void* context)
- : Layer(makeMutable<Impl>(layerID, init, render, nullptr, deinit, context)),
- deallocationFn(deallocation) {
+ : Layer(makeMutable<Impl>(layerID, init, render, nullptr, deinit, ownerChanged, attach, detach, context))
+{
+ printf("CustomLayer::CustomLayer %p\n", this);
}
-CustomLayer::~CustomLayer() {
- if (deallocationFn) {
- deallocationFn(&peer);
- }
-};
-
const CustomLayer::Impl& CustomLayer::impl() const {
return static_cast<const Impl&>(*baseImpl);
}
+const void* CustomLayer::getContext() const {
+ return impl().context;
+}
+
Mutable<CustomLayer::Impl> CustomLayer::mutableImpl() const {
return makeMutable<Impl>(impl());
}
@@ -45,6 +58,13 @@ std::unique_ptr<Layer> CustomLayer::cloneRef(const std::string&) const {
return nullptr;
}
+void CustomLayer::setObserver(LayerObserver* observer) {
+
+ Layer::setObserver(observer);
+
+ impl().didSetObserver(observer != NULL);
+}
+
// Visibility
void CustomLayer::setVisibility(VisibilityType value) {