diff options
author | Ansis Brammanis <ansis@mapbox.com> | 2019-10-02 13:49:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-02 13:49:33 -0400 |
commit | dfca8fb2149eea69e7cff08a15d964b4a5e4d710 (patch) | |
tree | cf1f4948db763bf42533cb50a6760b54edc80ba4 | |
parent | 90b37927eb67be18c60b05336730d9ea419d8b5e (diff) | |
download | qtlocation-mapboxgl-dfca8fb2149eea69e7cff08a15d964b4a5e4d710.tar.gz |
[core] fix opacity interpolation for composition expressions (#15738)
port https://github.com/mapbox/mapbox-gl-js/pull/8818
-rw-r--r-- | platform/node/test/ignores.json | 1 | ||||
-rw-r--r-- | 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<float> interpolationFactor(float currentZoom) const override { - if (expression.useIntegerZoom) { - return std::tuple<float> { expression.interpolationFactor(zoomRange, std::floor(currentZoom)) }; - } else { - return std::tuple<float> { expression.interpolationFactor(zoomRange, currentZoom) }; - } + const float possiblyRoundedZoom = expression.useIntegerZoom ? std::floor(currentZoom) : currentZoom; + + return std::tuple<float>{ + ::fmax(0.0, ::fmin(1.0, expression.interpolationFactor(zoomRange, possiblyRoundedZoom)))}; } std::tuple<T> uniformValue(const PossiblyEvaluatedPropertyValue<T>& currentValue) const override { |