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

Commit d0ff41c4 authored by Doris Liu's avatar Doris Liu
Browse files

Rounding per-channel interpolation in ArgbEvaluator to closest integer

In case of interpolating between x+1 and x in a color channel, the
previous implementation would jump to x in the *beginning* of the
animation, as it rounds down the interpolated float that's [x, x+1].
This CL rounds the per-channel interpolated float to the closest
integer.

Change-Id: I8610fb14ab3dd0ee2b1816868977c5653c178660
parent abcc4392
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -85,6 +85,6 @@ public class ArgbEvaluator implements TypeEvaluator {
        g = (float) Math.pow(g, 1.0 / 2.2) * 255.0f;
        b = (float) Math.pow(b, 1.0 / 2.2) * 255.0f;

        return ((int) a) << 24 | ((int) r) << 16 | ((int) g) << 8 | (int) b;
        return Math.round(a) << 24 | Math.round(r) << 16 | Math.round(g) << 8 | Math.round(b);
    }
}
 No newline at end of file