am 530fd15e: Fix bug to update last interpolated index of GestureStroke

* commit '530fd15eff8bd8df1c4c87cfeab379b5328748c1':
  Fix bug to update last interpolated index of GestureStroke
main
Tadashi G. Takaoka 2013-04-17 19:47:39 -07:00 committed by Android Git Automerger
commit 93c31e176f
1 changed files with 5 additions and 5 deletions

View File

@ -108,7 +108,7 @@ final class GesturePreviewTrail {
} }
private void addStrokeLocked(final GestureStrokeWithPreviewPoints stroke, final long downTime) { private void addStrokeLocked(final GestureStrokeWithPreviewPoints stroke, final long downTime) {
final int trailSize = mEventTimes.getLength(); final int trailSize = mEventTimes.getLength();
stroke.appendPreviewStroke(mEventTimes, mXCoordinates, mYCoordinates); stroke.appendPreviewStroke(mEventTimes, mXCoordinates, mYCoordinates);
if (mEventTimes.getLength() == trailSize) { if (mEventTimes.getLength() == trailSize) {
return; return;
@ -261,14 +261,14 @@ final class GesturePreviewTrail {
System.arraycopy(eventTimes, startIndex, eventTimes, 0, newSize); System.arraycopy(eventTimes, startIndex, eventTimes, 0, newSize);
System.arraycopy(xCoords, startIndex, xCoords, 0, newSize); System.arraycopy(xCoords, startIndex, xCoords, 0, newSize);
System.arraycopy(yCoords, startIndex, yCoords, 0, newSize); System.arraycopy(yCoords, startIndex, yCoords, 0, newSize);
// The start index of the last segment of the stroke
// {@link mLastInterpolatedDrawIndex} should also be updated because all array
// elements have just been shifted for compaction.
mLastInterpolatedDrawIndex = Math.max(mLastInterpolatedDrawIndex - startIndex, 0);
} }
mEventTimes.setLength(newSize); mEventTimes.setLength(newSize);
mXCoordinates.setLength(newSize); mXCoordinates.setLength(newSize);
mYCoordinates.setLength(newSize); mYCoordinates.setLength(newSize);
// The start index of the last segment of the stroke
// {@link mLastInterpolatedDrawIndex} should also be updated because all array
// elements have just been shifted for compaction or been zeroed.
mLastInterpolatedDrawIndex = Math.max(mLastInterpolatedDrawIndex - startIndex, 0);
} }
return newSize > 0; return newSize > 0;
} }