summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnsis Brammanis <ansis@mapbox.com>2019-10-02 13:49:33 -0400
committerGitHub <noreply@github.com>2019-10-02 13:49:33 -0400
commitdfca8fb2149eea69e7cff08a15d964b4a5e4d710 (patch)
treecf1f4948db763bf42533cb50a6760b54edc80ba4 /src
parent90b37927eb67be18c60b05336730d9ea419d8b5e (diff)
downloadqtlocation-mapboxgl-dfca8fb2149eea69e7cff08a15d964b4a5e4d710.tar.gz
[core] fix opacity interpolation for composition expressions (#15738)
port https://github.com/mapbox/mapbox-gl-js/pull/8818
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/renderer/paint_property_binder.hpp9
1 files changed, 4 insertions, 5 deletions
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 {