summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander Shalamov <alexander.shalamov@mapbox.com>2018-10-23 21:59:05 +0300
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2018-11-19 14:06:21 +0200
commit006ee8b0034eab7096c53a7ca4eddf7226880161 (patch)
treebf6b637be211b05f3c45e2dbff49880b6f25e371 /src
parent44906b1ff38cc6ccedd2a10e02a4fa0aa926d967 (diff)
downloadqtlocation-mapboxgl-006ee8b0034eab7096c53a7ca4eddf7226880161.tar.gz
[core] Move markContextDestroyed() to the RenderLayer
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/renderer/layers/render_custom_layer.cpp4
-rw-r--r--src/mbgl/renderer/layers/render_custom_layer.hpp5
-rw-r--r--src/mbgl/renderer/render_layer.cpp4
-rw-r--r--src/mbgl/renderer/render_layer.hpp2
-rw-r--r--src/mbgl/renderer/renderer_impl.cpp10
5 files changed, 15 insertions, 10 deletions
diff --git a/src/mbgl/renderer/layers/render_custom_layer.cpp b/src/mbgl/renderer/layers/render_custom_layer.cpp
index 2bad375bb7..e80ceda6c7 100644
--- a/src/mbgl/renderer/layers/render_custom_layer.cpp
+++ b/src/mbgl/renderer/layers/render_custom_layer.cpp
@@ -42,6 +42,10 @@ bool RenderCustomLayer::hasCrossfade() const {
return false;
}
+void RenderCustomLayer::markContextDestroyed() {
+ contextDestroyed = true;
+}
+
std::unique_ptr<Bucket> RenderCustomLayer::createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const {
assert(false);
return nullptr;
diff --git a/src/mbgl/renderer/layers/render_custom_layer.hpp b/src/mbgl/renderer/layers/render_custom_layer.hpp
index 47d5bb3f40..958f8bfd3f 100644
--- a/src/mbgl/renderer/layers/render_custom_layer.hpp
+++ b/src/mbgl/renderer/layers/render_custom_layer.hpp
@@ -14,16 +14,13 @@ public:
void evaluate(const PropertyEvaluationParameters&) override;
bool hasTransition() const override;
bool hasCrossfade() const override;
+ void markContextDestroyed() final;
std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const final;
void render(PaintParameters&, RenderSource*) final;
const style::CustomLayer::Impl& impl() const;
- void markContextDestroyed() {
- contextDestroyed = true;
- };
-
private:
bool contextDestroyed = false;
std::shared_ptr<style::CustomLayerHost> host;
diff --git a/src/mbgl/renderer/render_layer.cpp b/src/mbgl/renderer/render_layer.cpp
index 4cd033da75..44c141c741 100644
--- a/src/mbgl/renderer/render_layer.cpp
+++ b/src/mbgl/renderer/render_layer.cpp
@@ -75,6 +75,10 @@ void RenderLayer::setRenderTiles(std::vector<std::reference_wrapper<RenderTile>>
renderTiles = std::move(tiles);
}
+void RenderLayer::markContextDestroyed() {
+ // no-op
+}
+
void RenderLayer::checkRenderability(const PaintParameters& parameters,
const uint32_t activeBindingCount) {
// Only warn once for every layer.
diff --git a/src/mbgl/renderer/render_layer.hpp b/src/mbgl/renderer/render_layer.hpp
index 39e4a23a84..8d17e318f2 100644
--- a/src/mbgl/renderer/render_layer.hpp
+++ b/src/mbgl/renderer/render_layer.hpp
@@ -91,8 +91,8 @@ public:
Immutable<style::Layer::Impl> baseImpl;
void setImpl(Immutable<style::Layer::Impl>);
+ virtual void markContextDestroyed();
friend std::string layoutKey(const RenderLayer&);
-
protected:
// Checks whether the current hardware can render this layer. If it can't, we'll show a warning
// in the console to inform the developer.
diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp
index 129925bd9a..d6572712cd 100644
--- a/src/mbgl/renderer/renderer_impl.cpp
+++ b/src/mbgl/renderer/renderer_impl.cpp
@@ -69,13 +69,13 @@ Renderer::Impl::~Impl() {
assert(BackendScope::exists());
if (contextLost) {
- // Signal all RenderCustomLayers that the context was lost
- // before cleaning up
+ // Signal all RenderLayers that the context was lost
+ // before cleaning up. At the moment, only CustomLayer is
+ // interested whether rendering context is lost. However, it would be
+ // beneficial for dynamically loaded or other custom built-in plugins.
for (const auto& entry : renderLayers) {
RenderLayer& layer = *entry.second;
- if (layer.is<RenderCustomLayer>()) {
- layer.as<RenderCustomLayer>()->markContextDestroyed();
- }
+ layer.markContextDestroyed();
}
}
};