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

Commit a5dcc6c2 authored by Teng-Hui Zhu's avatar Teng-Hui Zhu
Browse files

LUTInterpolator needs to have 2 frame at minimal

Otherwise, it could be having invalid data, here NAN.
Fix:27343522

Change-Id: I5bb17f04c62f268ec633675015ef589be2413338
parent af64f634
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -45,7 +45,8 @@ public class FallbackLUTInterpolator implements NativeInterpolatorFactory, TimeI
    private static float[] createLUT(TimeInterpolator interpolator, long duration) {
        long frameIntervalNanos = Choreographer.getInstance().getFrameIntervalNanos();
        int animIntervalMs = (int) (frameIntervalNanos / TimeUtils.NANOS_PER_MS);
        int numAnimFrames = (int) Math.ceil(((double) duration) / animIntervalMs);
        // We need 2 frame values as the minimal.
        int numAnimFrames = Math.max(2, (int) Math.ceil(((double) duration) / animIntervalMs));
        float values[] = new float[numAnimFrames];
        float lastFrame = numAnimFrames - 1;
        for (int i = 0; i < numAnimFrames; i++) {