From 095dc7b16793ed502b3429e0e4c2db7f1207094e Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Thu, 11 May 2017 10:29:37 -0700 Subject: [core] Replace createRender{Source,Layer} with Render{Source,Layer}::create * Eliminates the need for EnableImmutableFromThis * Eliminates the dependency of {Source,Layer}::Impl on corresponding Render class (circular dependency) --- src/mbgl/renderer/render_layer.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/mbgl/renderer/render_layer.cpp') diff --git a/src/mbgl/renderer/render_layer.cpp b/src/mbgl/renderer/render_layer.cpp index 2f30b2ce21..ca4999e606 100644 --- a/src/mbgl/renderer/render_layer.cpp +++ b/src/mbgl/renderer/render_layer.cpp @@ -1,8 +1,43 @@ #include +#include +#include +#include +#include +#include +#include +#include +#include #include namespace mbgl { +using namespace style; + +std::unique_ptr RenderLayer::create(Immutable impl) { + switch (impl->type) { + case LayerType::Fill: + return std::make_unique(staticImmutableCast(impl)); + case LayerType::Line: + return std::make_unique(staticImmutableCast(impl)); + case LayerType::Circle: + return std::make_unique(staticImmutableCast(impl)); + case LayerType::Symbol: + return std::make_unique(staticImmutableCast(impl)); + case LayerType::Raster: + return std::make_unique(staticImmutableCast(impl)); + case LayerType::Background: + return std::make_unique(staticImmutableCast(impl)); + case LayerType::Custom: + return std::make_unique(staticImmutableCast(impl)); + case LayerType::FillExtrusion: + return std::make_unique(staticImmutableCast(impl)); + } + + // Not reachable, but placate GCC. + assert(false); + return nullptr; +} + RenderLayer::RenderLayer(style::LayerType type_, Immutable baseImpl_) : type(type_), baseImpl(baseImpl_) { -- cgit v1.2.1