diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index 61ed26b06..6d9f0139c 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -919,15 +919,14 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { if (mPreviewPlacer == null) { createPreviewPlacer(); } - final Rect r = tracker.getDrawingRect(); + final Rect r = tracker.getBoundingBox(); if (!r.isEmpty()) { // Invalidate the rectangular region encompassing the gesture. This is needed because // past points along the gesture will fade and gradually disappear. final KeyPreviewDrawParams params = mKeyPreviewDrawParams; - mInvalidatedGesturesRect.set(r.left + params.mCoordinates[0] - GESTURE_DRAWING_WIDTH, - r.top + params.mCoordinates[1] - GESTURE_DRAWING_WIDTH, - r.right + params.mCoordinates[0] + GESTURE_DRAWING_WIDTH, - r.bottom + params.mCoordinates[1] + GESTURE_DRAWING_WIDTH); + mInvalidatedGesturesRect.set(r); + mInvalidatedGesturesRect.offset(params.mCoordinates[0], params.mCoordinates[1]); + mInvalidatedGesturesRect.inset(-GESTURE_DRAWING_WIDTH, -GESTURE_DRAWING_WIDTH); mPreviewPlacer.invalidate(mInvalidatedGesturesRect); } else { mPreviewPlacer.invalidate(); diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java index fb795f2cd..9542ee7c4 100644 --- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java +++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java @@ -536,8 +536,8 @@ public class PointerTracker { public long getDownTime() { return mDownTime; } - public Rect getDrawingRect() { - return mGestureStroke.getDrawingRect(); + public Rect getBoundingBox() { + return mGestureStroke.getBoundingBox(); } private Key onDownKey(int x, int y, long eventTime) { diff --git a/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java b/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java index 6e3295e59..c16b70ef0 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java +++ b/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java @@ -199,7 +199,7 @@ public class GestureStroke { } } - public Rect getDrawingRect() { + public Rect getBoundingBox() { return mDrawingRect; } }