From 3ab40611a51e1917c1aea395b44e5efc91e3359e Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Tue, 1 Oct 2019 15:53:31 -0400 Subject: [PATCH] [core] fix opacity interpolation for composition expressions port https://github.com/mapbox/mapbox-gl-js/pull/8818 --- platform/node/test/ignores.json | 1 + src/mbgl/renderer/paint_property_binder.hpp | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/platform/node/test/ignores.json b/platform/node/test/ignores.json index f053b2add1e..8da2905dbb0 100644 --- a/platform/node/test/ignores.json +++ b/platform/node/test/ignores.json @@ -71,6 +71,7 @@ "render-tests/circle-sort-key/literal": "https://github.com/mapbox/mapbox-gl-native/issues/15008", "render-tests/fill-sort-key/literal": "https://github.com/mapbox/mapbox-gl-native/issues/15008", "render-tests/line-sort-key/literal": "https://github.com/mapbox/mapbox-gl-native/issues/15008", + "render-tests/regressions/mapbox-gl-js#8817": "skip - https://github.com/mapbox/mapbox-gl-native/issues/15737", "query-tests/fill-extrusion/base-in": "https://github.com/mapbox/mapbox-gl-native/issues/13139", "query-tests/fill-extrusion/box-in": "https://github.com/mapbox/mapbox-gl-native/issues/13139", "query-tests/fill-extrusion/side-in": "https://github.com/mapbox/mapbox-gl-native/issues/13139", diff --git a/src/mbgl/renderer/paint_property_binder.hpp b/src/mbgl/renderer/paint_property_binder.hpp index 1a36f8a2e58..402827de3c2 100644 --- a/src/mbgl/renderer/paint_property_binder.hpp +++ b/src/mbgl/renderer/paint_property_binder.hpp @@ -370,11 +370,11 @@ class CompositeFunctionPaintPropertyBinder final : public PaintPropertyBinder interpolationFactor(float currentZoom) const override { - if (expression.useIntegerZoom) { - return std::tuple { expression.interpolationFactor(zoomRange, std::floor(currentZoom)) }; - } else { - return std::tuple { expression.interpolationFactor(zoomRange, currentZoom) }; - } + const float possiblyRoundedZoom = expression.useIntegerZoom ? + std::floor(currentZoom) : + currentZoom; + + return std::tuple { std::fmax(0.0, std::fmin(1.0, expression.interpolationFactor(zoomRange, possiblyRoundedZoom))) }; } std::tuple uniformValue(const PossiblyEvaluatedPropertyValue& currentValue) const override {