[core] Move markContextDestroyed() to the RenderLayer
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user