am 60ee192b: Utilize Rect\'s method

* commit '60ee192b07a9725e97b3105acfc1eea5f5f25b9f':
  Utilize Rect's method
This commit is contained in:
Tadashi G. Takaoka 2012-05-30 22:47:20 -07:00 committed by Android Git Automerger
commit c6791d6773

View file

@ -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);
}