Move the responsibility for initialization/deinitialization/rendering to RenderCustomLayer. This eliminates special case code from Map and Style.
32 lines
855 B
C++
32 lines
855 B
C++
#pragma once
|
|
|
|
#include <mbgl/renderer/render_layer.hpp>
|
|
#include <mbgl/style/layers/custom_layer_impl.hpp>
|
|
|
|
namespace mbgl {
|
|
|
|
class RenderCustomLayer: public RenderLayer {
|
|
public:
|
|
RenderCustomLayer(Immutable<style::CustomLayer::Impl>);
|
|
~RenderCustomLayer() final;
|
|
|
|
void transition(const TransitionParameters&) final {}
|
|
void evaluate(const PropertyEvaluationParameters&) override;
|
|
bool hasTransition() const override;
|
|
|
|
std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const final;
|
|
void render(Painter&, PaintParameters&, RenderSource*) final;
|
|
|
|
const style::CustomLayer::Impl& impl() const;
|
|
|
|
private:
|
|
bool initialized = false;
|
|
};
|
|
|
|
template <>
|
|
inline bool RenderLayer::is<RenderCustomLayer>() const {
|
|
return type == style::LayerType::Custom;
|
|
}
|
|
|
|
} // namespace mbgl
|