[core] Fix layer impl cast in render layer implementations
This PR puts `impl()` functions definitions into a nameless namespace to provide internal linkage and to make sure that appropriate cast function is invoked.
This commit is contained in:
@@ -16,10 +16,15 @@ namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
namespace {
|
||||
|
||||
inline const BackgroundLayer::Impl& impl(const Immutable<style::Layer::Impl>& impl) {
|
||||
assert(impl->getTypeInfo() == BackgroundLayer::Impl::staticTypeInfo());
|
||||
return static_cast<const style::BackgroundLayer::Impl&>(*impl);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
RenderBackgroundLayer::RenderBackgroundLayer(Immutable<style::BackgroundLayer::Impl> _impl)
|
||||
: RenderLayer(makeMutable<BackgroundLayerProperties>(std::move(_impl))),
|
||||
unevaluated(impl(baseImpl).paint.untransitioned()) {
|
||||
|
||||
@@ -15,10 +15,15 @@ namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
namespace {
|
||||
|
||||
inline const style::CircleLayer::Impl& impl(const Immutable<style::Layer::Impl>& impl) {
|
||||
assert(impl->getTypeInfo() == CircleLayer::Impl::staticTypeInfo());
|
||||
return static_cast<const style::CircleLayer::Impl&>(*impl);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
RenderCircleLayer::RenderCircleLayer(Immutable<style::CircleLayer::Impl> _impl)
|
||||
: RenderLayer(makeMutable<CircleLayerProperties>(std::move(_impl))),
|
||||
unevaluated(impl(baseImpl).paint.untransitioned()) {
|
||||
|
||||
@@ -14,10 +14,15 @@ namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
namespace {
|
||||
|
||||
inline const CustomLayer::Impl& impl(const Immutable<style::Layer::Impl>& impl) {
|
||||
assert(impl->getTypeInfo() == CustomLayer::Impl::staticTypeInfo());
|
||||
return static_cast<const CustomLayer::Impl&>(*impl);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
RenderCustomLayer::RenderCustomLayer(Immutable<style::CustomLayer::Impl> _impl)
|
||||
: RenderLayer(makeMutable<CustomLayerProperties>(std::move(_impl))),
|
||||
host(impl(baseImpl).host) {
|
||||
|
||||
@@ -20,10 +20,15 @@ namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
namespace {
|
||||
|
||||
inline const FillExtrusionLayer::Impl& impl(const Immutable<style::Layer::Impl>& impl) {
|
||||
assert(impl->getTypeInfo() == FillExtrusionLayer::Impl::staticTypeInfo());
|
||||
return static_cast<const FillExtrusionLayer::Impl&>(*impl);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
RenderFillExtrusionLayer::RenderFillExtrusionLayer(Immutable<style::FillExtrusionLayer::Impl> _impl)
|
||||
: RenderLayer(makeMutable<FillExtrusionLayerProperties>(std::move(_impl))),
|
||||
unevaluated(impl(baseImpl).paint.untransitioned()) {
|
||||
|
||||
@@ -21,10 +21,15 @@ namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
namespace {
|
||||
|
||||
inline const FillLayer::Impl& impl(const Immutable<style::Layer::Impl>& impl) {
|
||||
assert(impl->getTypeInfo() == FillLayer::Impl::staticTypeInfo());
|
||||
return static_cast<const FillLayer::Impl&>(*impl);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
RenderFillLayer::RenderFillLayer(Immutable<style::FillLayer::Impl> _impl)
|
||||
: RenderLayer(makeMutable<FillLayerProperties>(std::move(_impl))),
|
||||
unevaluated(impl(baseImpl).paint.untransitioned()) {
|
||||
|
||||
@@ -19,10 +19,15 @@ namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
namespace {
|
||||
|
||||
inline const HeatmapLayer::Impl& impl(const Immutable<Layer::Impl>& impl) {
|
||||
assert(impl->getTypeInfo() == HeatmapLayer::Impl::staticTypeInfo());
|
||||
return static_cast<const HeatmapLayer::Impl&>(*impl);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
RenderHeatmapLayer::RenderHeatmapLayer(Immutable<HeatmapLayer::Impl> _impl)
|
||||
: RenderLayer(makeMutable<HeatmapLayerProperties>(std::move(_impl))),
|
||||
unevaluated(impl(baseImpl).paint.untransitioned()), colorRamp({256, 1}) {
|
||||
|
||||
@@ -18,10 +18,15 @@ namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
namespace {
|
||||
|
||||
inline const HillshadeLayer::Impl& impl(const Immutable<style::Layer::Impl>& impl) {
|
||||
assert(impl->getTypeInfo() == HillshadeLayer::Impl::staticTypeInfo());
|
||||
return static_cast<const HillshadeLayer::Impl&>(*impl);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
RenderHillshadeLayer::RenderHillshadeLayer(Immutable<style::HillshadeLayer::Impl> _impl)
|
||||
: RenderLayer(makeMutable<HillshadeLayerProperties>(std::move(_impl))),
|
||||
unevaluated(impl(baseImpl).paint.untransitioned()) {
|
||||
|
||||
@@ -20,10 +20,15 @@ namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
namespace {
|
||||
|
||||
inline const LineLayer::Impl& impl(const Immutable<style::Layer::Impl>& impl) {
|
||||
assert(impl->getTypeInfo() == LineLayer::Impl::staticTypeInfo());
|
||||
return static_cast<const LineLayer::Impl&>(*impl);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
RenderLineLayer::RenderLineLayer(Immutable<style::LineLayer::Impl> _impl)
|
||||
: RenderLayer(makeMutable<LineLayerProperties>(std::move(_impl))),
|
||||
unevaluated(impl(baseImpl).paint.untransitioned()),
|
||||
|
||||
@@ -14,10 +14,15 @@ namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
namespace {
|
||||
|
||||
inline const RasterLayer::Impl& impl(const Immutable<style::Layer::Impl>& impl) {
|
||||
assert(impl->getTypeInfo() == RasterLayer::Impl::staticTypeInfo());
|
||||
return static_cast<const RasterLayer::Impl&>(*impl);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
RenderRasterLayer::RenderRasterLayer(Immutable<style::RasterLayer::Impl> _impl)
|
||||
: RenderLayer(makeMutable<RasterLayerProperties>(std::move(_impl))),
|
||||
unevaluated(impl(baseImpl).paint.untransitioned()) {
|
||||
|
||||
@@ -227,6 +227,7 @@ void drawText(const DrawFn& draw,
|
||||
}
|
||||
|
||||
inline const SymbolLayer::Impl& impl(const Immutable<style::Layer::Impl>& impl) {
|
||||
assert(impl->getTypeInfo() == SymbolLayer::Impl::staticTypeInfo());
|
||||
return static_cast<const SymbolLayer::Impl&>(*impl);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user