Skip to content

Commit d95316e

Browse files
chethaaseAndroid (Google) Code Review
authored andcommitted
Merge "Skip drawing offscreen objects" into jb-mr1-dev
2 parents 1662734 + b78ee0e commit d95316e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

core/java/android/view/ViewRootImpl.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -887,11 +887,12 @@ public ViewParent invalidateChildInParent(int[] location, Rect dirty) {
887887
// Intersect with the bounds of the window to skip
888888
// updates that lie outside of the visible region
889889
final float appScale = mAttachInfo.mApplicationScale;
890-
localDirty.intersect(0, 0,
891-
(int) (mWidth * appScale + 0.5f), (int) (mHeight * appScale + 0.5f));
892-
893-
if (!mWillDrawSoon) {
890+
if (localDirty.intersect(0, 0,
891+
(int) (mWidth * appScale + 0.5f), (int) (mHeight * appScale + 0.5f)) &&
892+
!mWillDrawSoon) {
894893
scheduleTraversals();
894+
} else {
895+
localDirty.setEmpty();
895896
}
896897

897898
return null;

0 commit comments

Comments
 (0)