am f5fba0c1: Merge "Remove unnecessary drawing point" into jb-mr1-dev

* commit 'f5fba0c1f095266aa1cc084917d06f66e4b23009':
  Remove unnecessary drawing point
main
Tadashi G. Takaoka 2012-08-13 02:08:26 -07:00 committed by Android Git Automerger
commit 9d7924dc82
2 changed files with 4 additions and 7 deletions

View File

@ -521,7 +521,7 @@ public class PointerTracker implements PointerTrackerQueue.Element {
public void drawGestureTrail(Canvas canvas, Paint paint) { public void drawGestureTrail(Canvas canvas, Paint paint) {
if (mInGesture) { if (mInGesture) {
mGestureStroke.drawGestureTrail(canvas, paint, mLastX, mLastY); mGestureStroke.drawGestureTrail(canvas, paint);
} }
} }

View File

@ -166,12 +166,12 @@ public class GestureStroke {
return diff; return diff;
} }
public void drawGestureTrail(Canvas canvas, Paint paint, int lastX, int lastY) { public void drawGestureTrail(final Canvas canvas, final Paint paint) {
// TODO: These paint parameter interpolation should be tunable, possibly introduce an object // TODO: These paint parameter interpolation should be tunable, possibly introduce an object
// that implements an interface such as Paint getPaint(int step, int strokePoints) // that implements an interface such as Paint getPaint(int step, int strokePoints)
final int size = mXCoordinates.getLength(); final int size = mXCoordinates.getLength();
int[] xCoords = mXCoordinates.getPrimitiveArray(); final int[] xCoords = mXCoordinates.getPrimitiveArray();
int[] yCoords = mYCoordinates.getPrimitiveArray(); final int[] yCoords = mYCoordinates.getPrimitiveArray();
int alpha = Constants.Color.ALPHA_OPAQUE; int alpha = Constants.Color.ALPHA_OPAQUE;
for (int i = size - 1; i > 0 && alpha > 0; i--) { for (int i = size - 1; i > 0 && alpha > 0; i--) {
paint.setAlpha(alpha); paint.setAlpha(alpha);
@ -179,9 +179,6 @@ public class GestureStroke {
alpha -= DRAWING_GESTURE_FADE_RATE; alpha -= DRAWING_GESTURE_FADE_RATE;
} }
canvas.drawLine(xCoords[i - 1], yCoords[i - 1], xCoords[i], yCoords[i], paint); canvas.drawLine(xCoords[i - 1], yCoords[i - 1], xCoords[i], yCoords[i], paint);
if (i == size - 1) {
canvas.drawLine(lastX, lastY, xCoords[i], yCoords[i], paint);
}
} }
} }
} }