From 05d5edfa74ebc74d5e74560b597be5aec6f4e9e8 Mon Sep 17 00:00:00 2001 From: Alexander Shalamov Date: Tue, 30 Oct 2018 15:59:47 +0200 Subject: [core] Remove casts where expected type is part of the contract --- src/mbgl/layout/pattern_layout.hpp | 4 ++-- src/mbgl/layout/symbol_layout.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/mbgl/layout') diff --git a/src/mbgl/layout/pattern_layout.hpp b/src/mbgl/layout/pattern_layout.hpp index 0ffac36b75..a29221c547 100644 --- a/src/mbgl/layout/pattern_layout.hpp +++ b/src/mbgl/layout/pattern_layout.hpp @@ -37,14 +37,14 @@ public: hasPattern(false) { using PatternLayer = typename B::RenderLayerType; - const auto renderLayer = layers.at(0)->as(); + const auto renderLayer = static_cast(layers.at(0)); const typename PatternLayer::StyleLayerImpl& leader = renderLayer->impl(); layout = leader.layout.evaluate(PropertyEvaluationParameters(zoom)); sourceLayerID = leader.sourceLayer; groupID = renderLayer->getID(); for (const auto& layer : layers) { - const typename B::PossiblyEvaluatedPaintProperties evaluatedProps = layer->as()->paintProperties(); + const typename B::PossiblyEvaluatedPaintProperties evaluatedProps = static_cast(layer)->paintProperties(); layerPaintProperties.emplace(layer->getID(), std::move(evaluatedProps)); const auto patternProperty = evaluatedProps.template get(); const auto constantPattern = patternProperty.constantOr(Faded >{ "", ""}); diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp index 6d20afeb8d..332fb3f46a 100644 --- a/src/mbgl/layout/symbol_layout.cpp +++ b/src/mbgl/layout/symbol_layout.cpp @@ -50,11 +50,11 @@ SymbolLayout::SymbolLayout(const BucketParameters& parameters, pixelRatio(parameters.pixelRatio), tileSize(util::tileSize * overscaling), tilePixelRatio(float(util::EXTENT) / tileSize), - textSize(layers.at(0)->as()->impl().layout.get()), - iconSize(layers.at(0)->as()->impl().layout.get()) + textSize(toRenderSymbolLayer(layers.at(0))->impl().layout.get()), + iconSize(toRenderSymbolLayer(layers.at(0))->impl().layout.get()) { - const SymbolLayer::Impl& leader = layers.at(0)->as()->impl(); + const SymbolLayer::Impl& leader = toRenderSymbolLayer(layers.at(0))->impl(); layout = leader.layout.evaluate(PropertyEvaluationParameters(zoom)); @@ -91,8 +91,8 @@ SymbolLayout::SymbolLayout(const BucketParameters& parameters, for (const auto& layer : layers) { layerPaintProperties.emplace(layer->getID(), std::make_pair( - layer->as()->iconPaintProperties(), - layer->as()->textPaintProperties() + toRenderSymbolLayer(layer)->iconPaintProperties(), + toRenderSymbolLayer(layer)->textPaintProperties() )); } -- cgit v1.2.1