Update gesture bounding box handling.

Change-Id: I085611ce6fd82608f284d74973e5bb14258cdc24
This commit is contained in:
Tom Ouyang 2012-07-22 08:36:13 +09:00
parent 7e220d3c3a
commit ccaa799ee9
3 changed files with 7 additions and 8 deletions

View file

@ -919,15 +919,14 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
if (mPreviewPlacer == null) { if (mPreviewPlacer == null) {
createPreviewPlacer(); createPreviewPlacer();
} }
final Rect r = tracker.getDrawingRect(); final Rect r = tracker.getBoundingBox();
if (!r.isEmpty()) { if (!r.isEmpty()) {
// Invalidate the rectangular region encompassing the gesture. This is needed because // Invalidate the rectangular region encompassing the gesture. This is needed because
// past points along the gesture will fade and gradually disappear. // past points along the gesture will fade and gradually disappear.
final KeyPreviewDrawParams params = mKeyPreviewDrawParams; final KeyPreviewDrawParams params = mKeyPreviewDrawParams;
mInvalidatedGesturesRect.set(r.left + params.mCoordinates[0] - GESTURE_DRAWING_WIDTH, mInvalidatedGesturesRect.set(r);
r.top + params.mCoordinates[1] - GESTURE_DRAWING_WIDTH, mInvalidatedGesturesRect.offset(params.mCoordinates[0], params.mCoordinates[1]);
r.right + params.mCoordinates[0] + GESTURE_DRAWING_WIDTH, mInvalidatedGesturesRect.inset(-GESTURE_DRAWING_WIDTH, -GESTURE_DRAWING_WIDTH);
r.bottom + params.mCoordinates[1] + GESTURE_DRAWING_WIDTH);
mPreviewPlacer.invalidate(mInvalidatedGesturesRect); mPreviewPlacer.invalidate(mInvalidatedGesturesRect);
} else { } else {
mPreviewPlacer.invalidate(); mPreviewPlacer.invalidate();

View file

@ -536,8 +536,8 @@ public class PointerTracker {
public long getDownTime() { public long getDownTime() {
return mDownTime; return mDownTime;
} }
public Rect getDrawingRect() { public Rect getBoundingBox() {
return mGestureStroke.getDrawingRect(); return mGestureStroke.getBoundingBox();
} }
private Key onDownKey(int x, int y, long eventTime) { private Key onDownKey(int x, int y, long eventTime) {

View file

@ -199,7 +199,7 @@ public class GestureStroke {
} }
} }
public Rect getDrawingRect() { public Rect getBoundingBox() {
return mDrawingRect; return mDrawingRect;
} }
} }