[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:
Mikhail Pozdnyakov
2019-08-16 16:34:07 +03:00
parent 5de27d5200
commit c7169e6f8d
10 changed files with 46 additions and 0 deletions

View File

@@ -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()) {