Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ef70c21 authored by John Reck's avatar John Reck
Browse files

Clarify cutoff priorities

Fixes: 279812401
Test: existing gainmap tests
Change-Id: Idabb13bb730ff69909cad7daf1028422142b727e
parent 7f7a3e1d
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -245,11 +245,18 @@ private:
            // This can happen if a BitmapShader is used on multiple canvas', such as a
            // software + hardware canvas, which is otherwise valid as SkShader is "immutable"
            std::lock_guard _lock(mUniformGuard);
            const float Wunclamped = (sk_float_log(targetHdrSdrRatio) -
            // Compute the weight parameter that will be used to blend between the images.
            float W = 0.f;
            if (targetHdrSdrRatio > mGainmapInfo.fDisplayRatioSdr) {
                if (targetHdrSdrRatio < mGainmapInfo.fDisplayRatioHdr) {
                    W = (sk_float_log(targetHdrSdrRatio) -
                         sk_float_log(mGainmapInfo.fDisplayRatioSdr)) /
                        (sk_float_log(mGainmapInfo.fDisplayRatioHdr) -
                         sk_float_log(mGainmapInfo.fDisplayRatioSdr));
            const float W = std::max(std::min(Wunclamped, 1.f), 0.f);
                } else {
                    W = 1.f;
                }
            }
            mBuilder.uniform("W") = W;
            uniforms = mBuilder.uniforms();
        }