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

Commit 4346189a authored by Alec Mouri's avatar Alec Mouri
Browse files

Increase precision in rounded corner shader

Otherwise, there's some floating point error when the corner radius is
large. In testing, this is the smallest change that allows for
rendering reasonably correct corners.

Bug: 129866411
Test: launcher animation
Change-Id: I5c016b6454e9fb9b4d5ed6e42e36c23da83430a8
parent bc703749
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -575,7 +575,9 @@ String8 ProgramCache::generateFragmentShader(const Key& needs) {
            float applyCornerRadius(vec2 cropCoords)
            {
                vec2 position = cropCoords - cropCenter;
                vec2 dist = abs(position) + vec2(cornerRadius) - cropCenter;
                // Increase precision here so that a large corner radius doesn't
                // cause floating point error
                highp vec2 dist = abs(position) + vec2(cornerRadius) - cropCenter;
                float plane = length(max(dist, vec2(0.0)));
                return 1.0 - clamp(plane - cornerRadius, 0.0, 1.0);
            }