From dfca8fb2149eea69e7cff08a15d964b4a5e4d710 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Wed, 2 Oct 2019 13:49:33 -0400 Subject: [core] fix opacity interpolation for composition expressions (#15738) port https://github.com/mapbox/mapbox-gl-js/pull/8818 --- platform/node/test/ignores.json | 1 + src/mbgl/renderer/paint_property_binder.hpp | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/node/test/ignores.json b/platform/node/test/ignores.json index f053b2add1..8da2905dbb 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 1a36f8a2e5..db9f61411a 100644 --- a/src/mbgl/renderer/paint_property_binder.hpp +++ b/src/mbgl/renderer/paint_property_binder.hpp @@ -370,11 +370,10 @@ public: } std::tuple 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{ + ::fmax(0.0, ::fmin(1.0, expression.interpolationFactor(zoomRange, possiblyRoundedZoom)))}; } std::tuple uniformValue(const PossiblyEvaluatedPropertyValue& currentValue) const override { -- cgit v1.2.1