summaryrefslogtreecommitdiff
path: root/src/mbgl/style/layers/background_layer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/style/layers/background_layer.cpp')
-rw-r--r--src/mbgl/style/layers/background_layer.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/mbgl/style/layers/background_layer.cpp b/src/mbgl/style/layers/background_layer.cpp
index 1342afd7b1..8beafb0278 100644
--- a/src/mbgl/style/layers/background_layer.cpp
+++ b/src/mbgl/style/layers/background_layer.cpp
@@ -11,21 +11,27 @@
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
+#include <mbgl/renderer/layers/render_background_layer.hpp>
+
namespace mbgl {
namespace style {
-namespace {
- const LayerTypeInfo typeInfoBackground
+
+// static
+const LayerTypeInfo* BackgroundLayer::Impl::staticTypeInfo() noexcept {
+ const static LayerTypeInfo typeInfo
{"background",
LayerTypeInfo::Source::NotRequired,
LayerTypeInfo::Pass3D::NotRequired,
LayerTypeInfo::Layout::NotRequired,
LayerTypeInfo::Clipping::NotRequired
};
-} // namespace
+ return &typeInfo;
+}
+
BackgroundLayer::BackgroundLayer(const std::string& layerID)
- : Layer(makeMutable<Impl>(LayerType::Background, layerID, std::string())) {
+ : Layer(makeMutable<Impl>(layerID, std::string())) {
}
BackgroundLayer::BackgroundLayer(Immutable<Impl> impl_)
@@ -52,10 +58,6 @@ std::unique_ptr<Layer> BackgroundLayer::cloneRef(const std::string& id_) const {
void BackgroundLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const {
}
-const LayerTypeInfo* BackgroundLayer::Impl::getTypeInfo() const noexcept {
- return &typeInfoBackground;
-}
-
// Layout properties
@@ -284,18 +286,20 @@ Mutable<Layer::Impl> BackgroundLayer::mutableBaseImpl() const {
return staticMutableCast<Layer::Impl>(mutableImpl());
}
-BackgroundLayerFactory::BackgroundLayerFactory() = default;
-
-BackgroundLayerFactory::~BackgroundLayerFactory() = default;
+} // namespace style
-const LayerTypeInfo* BackgroundLayerFactory::getTypeInfo() const noexcept {
- return &typeInfoBackground;
+const style::LayerTypeInfo* BackgroundLayerFactory::getTypeInfo() const noexcept {
+ return style::BackgroundLayer::Impl::staticTypeInfo();
}
-std::unique_ptr<style::Layer> BackgroundLayerFactory::createLayer(const std::string& id, const conversion::Convertible& value) {
+std::unique_ptr<style::Layer> BackgroundLayerFactory::createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept {
(void)value;
- return std::unique_ptr<style::Layer>(new BackgroundLayer(id));
+ return std::unique_ptr<style::Layer>(new style::BackgroundLayer(id));
+}
+
+std::unique_ptr<RenderLayer> BackgroundLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
+ assert(impl->getTypeInfo() == getTypeInfo());
+ return std::make_unique<RenderBackgroundLayer>(staticImmutableCast<style::BackgroundLayer::Impl>(std::move(impl)));
}
-} // namespace style
} // namespace mbgl