From 3ab40611a51e1917c1aea395b44e5efc91e3359e Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Tue, 1 Oct 2019 15:53:31 -0400 Subject: [PATCH 1/3] [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 { From 0b0bd8b49094517fd3d3427bc65844312064f57c Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Tue, 1 Oct 2019 16:00:24 -0400 Subject: [PATCH 2/3] fix formatting --- src/mbgl/renderer/paint_property_binder.hpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/mbgl/renderer/paint_property_binder.hpp b/src/mbgl/renderer/paint_property_binder.hpp index 402827de3c2..a93bf2e5415 100644 --- a/src/mbgl/renderer/paint_property_binder.hpp +++ b/src/mbgl/renderer/paint_property_binder.hpp @@ -370,11 +370,10 @@ class CompositeFunctionPaintPropertyBinder final : public PaintPropertyBinder interpolationFactor(float currentZoom) const override { - const float possiblyRoundedZoom = expression.useIntegerZoom ? - std::floor(currentZoom) : - 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))) }; + return std::tuple { + std::fmax(0.0, std::fmin(1.0, expression.interpolationFactor(zoomRange, possiblyRoundedZoom)))}; } std::tuple uniformValue(const PossiblyEvaluatedPropertyValue& currentValue) const override { From 3a3662f29d40daa01dc73adbdcb524315a372def Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Tue, 1 Oct 2019 16:04:14 -0400 Subject: [PATCH 3/3] fix --- src/mbgl/renderer/paint_property_binder.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mbgl/renderer/paint_property_binder.hpp b/src/mbgl/renderer/paint_property_binder.hpp index a93bf2e5415..db9f61411a8 100644 --- a/src/mbgl/renderer/paint_property_binder.hpp +++ b/src/mbgl/renderer/paint_property_binder.hpp @@ -372,8 +372,8 @@ class CompositeFunctionPaintPropertyBinder final : public PaintPropertyBinder interpolationFactor(float currentZoom) const override { const float possiblyRoundedZoom = expression.useIntegerZoom ? std::floor(currentZoom) : currentZoom; - return std::tuple { - std::fmax(0.0, std::fmin(1.0, expression.interpolationFactor(zoomRange, possiblyRoundedZoom)))}; + return std::tuple{ + ::fmax(0.0, ::fmin(1.0, expression.interpolationFactor(zoomRange, possiblyRoundedZoom)))}; } std::tuple uniformValue(const PossiblyEvaluatedPropertyValue& currentValue) const override {