From fc5e3f973c043e88e1859f5dafe8df9b417dc3ca Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 13 Aug 2012 12:44:10 +0900 Subject: [PATCH] Remove unnecessary drawing point Change-Id: Ib9cba3484a72306320eb9c1744d940da1a0998c7 --- .../com/android/inputmethod/keyboard/PointerTracker.java | 2 +- .../inputmethod/keyboard/internal/GestureStroke.java | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java index faa08db24..99b43bb3a 100644 --- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java +++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java @@ -521,7 +521,7 @@ public class PointerTracker implements PointerTrackerQueue.Element { public void drawGestureTrail(Canvas canvas, Paint paint) { if (mInGesture) { - mGestureStroke.drawGestureTrail(canvas, paint, mLastX, mLastY); + mGestureStroke.drawGestureTrail(canvas, paint); } } diff --git a/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java b/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java index 778e8e5ef..fc813a3d9 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java +++ b/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java @@ -166,12 +166,12 @@ public class GestureStroke { 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 // that implements an interface such as Paint getPaint(int step, int strokePoints) final int size = mXCoordinates.getLength(); - int[] xCoords = mXCoordinates.getPrimitiveArray(); - int[] yCoords = mYCoordinates.getPrimitiveArray(); + final int[] xCoords = mXCoordinates.getPrimitiveArray(); + final int[] yCoords = mYCoordinates.getPrimitiveArray(); int alpha = Constants.Color.ALPHA_OPAQUE; for (int i = size - 1; i > 0 && alpha > 0; i--) { paint.setAlpha(alpha); @@ -179,9 +179,6 @@ public class GestureStroke { alpha -= DRAWING_GESTURE_FADE_RATE; } 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); - } } } }