summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2013-05-14 17:56:01 -0700
committerChet Haase <chet@google.com>2013-05-14 21:19:48 -0700
commit5495c726121737b5565ea58a28efdd6dbc471891 (patch)
tree04ad2471761c8429343263b8aaf1e49041d6f1e2
parent60347e98e22d13c6279c32dded92f6ec96a705a7 (diff)
downloadframeworks_base-5495c726121737b5565ea58a28efdd6dbc471891.zip
frameworks_base-5495c726121737b5565ea58a28efdd6dbc471891.tar.gz
frameworks_base-5495c726121737b5565ea58a28efdd6dbc471891.tar.bz2
Dirty rect must expand, not contract.
Different devices have different precision, leading to different pixels being touched during rendering operations. We need to ensure that the dirty rect we draw with (and which gets erased on the following frame) encompasses all possible pixels instead of some ideal rounded rectangle. The bug from this code led to dropped-pixels artifacts on some devices, where we'd scale a view, drawing it into some pixels, then invalidate that same area on the next frame, but the invalidation rectangle didn't cover the same pixels as the device drew into. The fix is to floor() the left/top pixels and ceil() the right/bottom pixels of the transformed invalidation rectangle. Issue #8971348 dropped pixel artifacts during some scaling operations Change-Id: Iedb1afd5621dff43bf7a3919bdbd8d2251647fd2
-rw-r--r--core/java/android/view/View.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 7f09a6a..0cd7c6e 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -10578,10 +10578,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
RectF boundingRect = mAttachInfo.mTmpTransformRect;
boundingRect.set(rect);
getMatrix().mapRect(boundingRect);
- rect.set((int) (boundingRect.left - 0.5f),
- (int) (boundingRect.top - 0.5f),
- (int) (boundingRect.right + 0.5f),
- (int) (boundingRect.bottom + 0.5f));
+ rect.set((int) Math.floor(boundingRect.left),
+ (int) Math.floor(boundingRect.top),
+ (int) Math.ceil(boundingRect.right),
+ (int) Math.ceil(boundingRect.bottom));
}
}