From 60ee192b07a9725e97b3105acfc1eea5f5f25b9f Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 31 May 2012 11:17:51 +0900 Subject: [PATCH] Utilize Rect's method Change-Id: Ia3df1baae4b92eca828c53c17f68ff26b25e525c --- .../android/inputmethod/keyboard/ProximityInfo.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java index 9d8bace71..1207c3fcd 100644 --- a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java +++ b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java @@ -168,15 +168,13 @@ public class ProximityInfo { final Rect hitBox = key.mHitBox; final int row = hitBox.top / mKeyHeight; if (row < touchPositionCorrection.mRadii.length) { - final float hitBoxCenterX = (hitBox.left + hitBox.right) * 0.5f; - final float hitBoxCenterY = (hitBox.top + hitBox.bottom) * 0.5f; - final float hitBoxWidth = hitBox.right - hitBox.left; - final float hitBoxHeight = hitBox.bottom - hitBox.top; + final int hitBoxWidth = hitBox.width(); + final int hitBoxHeight = hitBox.height(); final float x = touchPositionCorrection.mXs[row]; final float y = touchPositionCorrection.mYs[row]; final float radius = touchPositionCorrection.mRadii[row]; - sweetSpotCenterXs[i] = hitBoxCenterX + x * hitBoxWidth; - sweetSpotCenterYs[i] = hitBoxCenterY + y * hitBoxHeight; + sweetSpotCenterXs[i] = hitBox.exactCenterX() + x * hitBoxWidth; + sweetSpotCenterYs[i] = hitBox.exactCenterY() + y * hitBoxHeight; sweetSpotRadii[i] = radius * FloatMath.sqrt( hitBoxWidth * hitBoxWidth + hitBoxHeight * hitBoxHeight); }