#include #include #include #include namespace mbgl { void FillLayer::parsePaints(const JSVal& layer) { paints.parseEach(layer, [&] (ClassProperties& paint, const JSVal& value) { parseProperty>("fill-antialias", PropertyKey::FillAntialias, paint, value); parseProperty>("fill-opacity", PropertyKey::FillOpacity, paint, value); parseProperty("fill-opacity-transition", PropertyKey::FillOpacity, paint, value); parseProperty>("fill-color", PropertyKey::FillColor, paint, value); parseProperty("fill-color-transition", PropertyKey::FillColor, paint, value); parseProperty>("fill-outline-color", PropertyKey::FillOutlineColor, paint, value); parseProperty("fill-outline-color-transition", PropertyKey::FillOutlineColor, paint, value); parseProperty>>("fill-translate", PropertyKey::FillTranslate, paint, value); parseProperty("fill-translate-transition", PropertyKey::FillTranslate, paint, value); parseProperty>("fill-translate-anchor", PropertyKey::FillTranslateAnchor, paint, value); parseProperty>>("fill-pattern", PropertyKey::FillImage, paint, value, "fill-pattern-transition"); }); } void FillLayer::recalculate(const StyleCalculationParameters& parameters) { paints.removeExpiredTransitions(parameters.now); paints.calculate(PropertyKey::FillAntialias, properties.antialias, parameters); paints.calculateTransitioned(PropertyKey::FillOpacity, properties.opacity, parameters); paints.calculateTransitioned(PropertyKey::FillColor, properties.fill_color, parameters); paints.calculateTransitioned(PropertyKey::FillOutlineColor, properties.stroke_color, parameters); paints.calculateTransitioned(PropertyKey::FillTranslate, properties.translate, parameters); paints.calculate(PropertyKey::FillTranslateAnchor, properties.translateAnchor, parameters); paints.calculate(PropertyKey::FillImage, properties.image, parameters); passes = RenderPass::None; if (properties.antialias) { passes |= RenderPass::Translucent; } if (!properties.image.from.empty() || (properties.fill_color[3] * properties.opacity) < 1.0f) { passes |= RenderPass::Translucent; } else { passes |= RenderPass::Opaque; } } std::unique_ptr FillLayer::createBucket(StyleBucketParameters& parameters) const { auto bucket = std::make_unique(); parameters.eachFilteredFeature(filter, [&] (const auto& feature) { bucket->addGeometry(feature.getGeometries()); }); return std::move(bucket); } }