diff options
author | Svetoslav <svetoslavganov@google.com> | 2014-08-22 12:14:28 -0700 |
---|---|---|
committer | Svetoslav <svetoslavganov@google.com> | 2014-08-22 12:14:47 -0700 |
commit | 7505e3315cb997165035f3bcc736d9d257b1fe3c (patch) | |
tree | a5ee1606c4e83df2ee9cda28f5e0d8b88b4f13e2 /services | |
parent | 105f6ceb0f123d365e1ff5837f0442b3e377a056 (diff) | |
download | frameworks_base-7505e3315cb997165035f3bcc736d9d257b1fe3c.zip frameworks_base-7505e3315cb997165035f3bcc736d9d257b1fe3c.tar.gz frameworks_base-7505e3315cb997165035f3bcc736d9d257b1fe3c.tar.bz2 |
Fix jank in when drawing magnification bounds
There was an off-by-one error in computing the invalidated
rectangle when drawing the magnified region border.
bug:17199352
Change-Id: Id0a1af092b7124bbdca316534c035ed9af829326
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/wm/AccessibilityController.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/wm/AccessibilityController.java b/services/core/java/com/android/server/wm/AccessibilityController.java index d05d0c7..61ad7aa 100644 --- a/services/core/java/com/android/server/wm/AccessibilityController.java +++ b/services/core/java/com/android/server/wm/AccessibilityController.java @@ -412,8 +412,9 @@ final class AccessibilityController { private final WindowManager mWindowManager; - private final int mBorderWidth; + private final float mBorderWidth; private final int mHalfBorderWidth; + private final int mDrawBorderInset; private final ViewportWindow mWindow; @@ -421,10 +422,11 @@ final class AccessibilityController { public MagnifiedViewport() { mWindowManager = (WindowManager) mContext.getSystemService(Service.WINDOW_SERVICE); - mBorderWidth = (int) TypedValue.applyDimension( + mBorderWidth = TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, DEFAUTLT_BORDER_WIDTH_DIP, mContext.getResources().getDisplayMetrics()); - mHalfBorderWidth = (int) (mBorderWidth + 0.5) / 2; + mHalfBorderWidth = (int) Math.ceil(mBorderWidth / 2); + mDrawBorderInset = (int) mBorderWidth / 2; mWindow = new ViewportWindow(mContext); recomputeBoundsLocked(); } @@ -437,7 +439,8 @@ final class AccessibilityController { } // If this message is pending we are in a rotation animation and do not want // to show the border. We will do so when the pending message is handled. - if (!mHandler.hasMessages(MyHandler.MESSAGE_SHOW_MAGNIFIED_REGION_BOUNDS_IF_NEEDED)) { + if (!mHandler.hasMessages( + MyHandler.MESSAGE_SHOW_MAGNIFIED_REGION_BOUNDS_IF_NEEDED)) { setMagnifiedRegionBorderShownLocked(isMagnifyingLocked(), true); } } @@ -513,8 +516,8 @@ final class AccessibilityController { visibleWindows.clear(); - magnifiedBounds.op(mHalfBorderWidth, mHalfBorderWidth, - screenWidth - mHalfBorderWidth, screenHeight - mHalfBorderWidth, + magnifiedBounds.op(mDrawBorderInset, mDrawBorderInset, + screenWidth - mDrawBorderInset, screenHeight - mDrawBorderInset, Region.Op.INTERSECT); if (!mOldMagnifiedBounds.equals(magnifiedBounds)) { @@ -527,8 +530,8 @@ final class AccessibilityController { Rect dirtyRect = mTempRect1; if (mFullRedrawNeeded) { mFullRedrawNeeded = false; - dirtyRect.set(mHalfBorderWidth, mHalfBorderWidth, - screenWidth - mHalfBorderWidth, screenHeight - mHalfBorderWidth); + dirtyRect.set(mDrawBorderInset, mDrawBorderInset, + screenWidth - mDrawBorderInset, screenHeight - mDrawBorderInset); mWindow.invalidate(dirtyRect); } else { Region dirtyRegion = mTempRegion3; |