Loading core/java/android/animation/PathKeyframes.java +23 −19 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package android.animation; import android.graphics.Path; import android.graphics.PointF; import android.util.MathUtils; import java.util.ArrayList; Loading Loading @@ -64,11 +63,12 @@ class PathKeyframes implements Keyframes { @Override public Object getValue(float fraction) { fraction = MathUtils.constrain(fraction, 0, 1); int numPoints = mKeyframeData.length / 3; if (fraction == 0) { if (fraction < 0) { return interpolateInRange(fraction, 0, 1); } else if (fraction > 1) { return interpolateInRange(fraction, numPoints - 2, numPoints - 1); } else if (fraction == 0) { return pointForIndex(0); } else if (fraction == 1) { return pointForIndex(numPoints - 1); Loading @@ -91,8 +91,13 @@ class PathKeyframes implements Keyframes { } // now high is below the fraction and low is above the fraction int startBase = (high * NUM_COMPONENTS); int endBase = (low * NUM_COMPONENTS); return interpolateInRange(fraction, high, low); } } private PointF interpolateInRange(float fraction, int startIndex, int endIndex) { int startBase = (startIndex * NUM_COMPONENTS); int endBase = (endIndex * NUM_COMPONENTS); float startFraction = mKeyframeData[startBase + FRACTION_OFFSET]; float endFraction = mKeyframeData[endBase + FRACTION_OFFSET]; Loading @@ -110,7 +115,6 @@ class PathKeyframes implements Keyframes { mTempPointF.set(x, y); return mTempPointF; } } @Override public void invalidateCache() { Loading Loading
core/java/android/animation/PathKeyframes.java +23 −19 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package android.animation; import android.graphics.Path; import android.graphics.PointF; import android.util.MathUtils; import java.util.ArrayList; Loading Loading @@ -64,11 +63,12 @@ class PathKeyframes implements Keyframes { @Override public Object getValue(float fraction) { fraction = MathUtils.constrain(fraction, 0, 1); int numPoints = mKeyframeData.length / 3; if (fraction == 0) { if (fraction < 0) { return interpolateInRange(fraction, 0, 1); } else if (fraction > 1) { return interpolateInRange(fraction, numPoints - 2, numPoints - 1); } else if (fraction == 0) { return pointForIndex(0); } else if (fraction == 1) { return pointForIndex(numPoints - 1); Loading @@ -91,8 +91,13 @@ class PathKeyframes implements Keyframes { } // now high is below the fraction and low is above the fraction int startBase = (high * NUM_COMPONENTS); int endBase = (low * NUM_COMPONENTS); return interpolateInRange(fraction, high, low); } } private PointF interpolateInRange(float fraction, int startIndex, int endIndex) { int startBase = (startIndex * NUM_COMPONENTS); int endBase = (endIndex * NUM_COMPONENTS); float startFraction = mKeyframeData[startBase + FRACTION_OFFSET]; float endFraction = mKeyframeData[endBase + FRACTION_OFFSET]; Loading @@ -110,7 +115,6 @@ class PathKeyframes implements Keyframes { mTempPointF.set(x, y); return mTempPointF; } } @Override public void invalidateCache() { Loading