diff --git a/drape_frontend/render_state_extension.cpp b/drape_frontend/render_state_extension.cpp index 4fd406632f..a99bda2156 100644 --- a/drape_frontend/render_state_extension.cpp +++ b/drape_frontend/render_state_extension.cpp @@ -2,22 +2,35 @@ #include +namespace +{ +using namespace df; + +std::array(DepthLayer::LayersCount)> kStateExtensions = { + RenderStateExtension(DepthLayer::GeometryLayer), + RenderStateExtension(DepthLayer::Geometry3dLayer), + RenderStateExtension(DepthLayer::UserLineLayer), + RenderStateExtension(DepthLayer::OverlayLayer), + RenderStateExtension(DepthLayer::TransitSchemeLayer), + RenderStateExtension(DepthLayer::UserMarkLayer), + RenderStateExtension(DepthLayer::NavigationLayer), + RenderStateExtension(DepthLayer::RoutingBottomMarkLayer), + RenderStateExtension(DepthLayer::RoutingMarkLayer), + RenderStateExtension(DepthLayer::SearchMarkLayer), + RenderStateExtension(DepthLayer::GuiLayer)}; + +struct RenderStateExtensionFactory +{ + static ref_ptr Get(DepthLayer depthLayer) + { + ASSERT_LESS(static_cast(depthLayer), kStateExtensions.size(), ()); + return make_ref(&kStateExtensions[static_cast(depthLayer)]); + } +}; +} // namespace + namespace df { -std::array, static_cast(DepthLayer::LayersCount)> kStateExtensions = { - make_unique_dp(DepthLayer::GeometryLayer), - make_unique_dp(DepthLayer::Geometry3dLayer), - make_unique_dp(DepthLayer::UserLineLayer), - make_unique_dp(DepthLayer::OverlayLayer), - make_unique_dp(DepthLayer::TransitSchemeLayer), - make_unique_dp(DepthLayer::UserMarkLayer), - make_unique_dp(DepthLayer::NavigationLayer), - make_unique_dp(DepthLayer::RoutingBottomMarkLayer), - make_unique_dp(DepthLayer::RoutingMarkLayer), - make_unique_dp(DepthLayer::SearchMarkLayer), - make_unique_dp(DepthLayer::GuiLayer) -}; - RenderStateExtension::RenderStateExtension(DepthLayer depthLayer) : m_depthLayer(depthLayer) {} @@ -36,13 +49,6 @@ bool RenderStateExtension::Equal(ref_ptr other) co return m_depthLayer == renderState->m_depthLayer; } -// static -ref_ptr RenderStateExtensionFactory::Get(DepthLayer depthLayer) -{ - ASSERT_LESS(static_cast(depthLayer), kStateExtensions.size(), ()); - return make_ref(kStateExtensions[static_cast(depthLayer)]); -} - DepthLayer GetDepthLayer(dp::RenderState const & state) { return state.GetRenderStateExtension()->GetDepthLayer(); diff --git a/drape_frontend/render_state_extension.hpp b/drape_frontend/render_state_extension.hpp index b55e38b1bc..60c46d593d 100644 --- a/drape_frontend/render_state_extension.hpp +++ b/drape_frontend/render_state_extension.hpp @@ -40,12 +40,6 @@ private: DepthLayer const m_depthLayer; }; -class RenderStateExtensionFactory -{ -public: - static ref_ptr Get(DepthLayer depthLayer); -}; - extern DepthLayer GetDepthLayer(dp::RenderState const & state); extern dp::RenderState CreateRenderState(gpu::Program program, DepthLayer depthLayer);