From 2fe9a8f6f6a5264597a9dbed2fb2e02d84853189 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Mon, 4 Oct 2010 20:17:01 -0700 Subject: Correctly invalidate the drawing cache when an invalidate is requested. Change-Id: Ic78f85d728a14a9f2e4a1925d46b6db9a204bbb1 --- core/java/android/view/View.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'core') diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 8b1fc4e..63450de 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -5152,7 +5152,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility /** * Recomputes the transform matrix if necessary. */ - private final void updateMatrix() { + private void updateMatrix() { if (mMatrixDirty) { // transform-related properties have changed since the last time someone // asked for the matrix; recalculate it with the current values @@ -6207,7 +6207,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE); } - if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS)) { + if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) || + (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID) { mPrivateFlags &= ~DRAWING_CACHE_VALID; final ViewParent p = mParent; final AttachInfo ai = mAttachInfo; @@ -6238,7 +6239,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE); } - if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS)) { + if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) || + (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID) { mPrivateFlags &= ~DRAWING_CACHE_VALID; final ViewParent p = mParent; final AttachInfo ai = mAttachInfo; @@ -6277,7 +6279,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE); } - if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS)) { + if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) || + (invalidateCache && (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID)) { mPrivateFlags &= ~DRAWN; if (invalidateCache) { mPrivateFlags &= ~DRAWING_CACHE_VALID; @@ -7427,8 +7430,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility final int restoreCount = canvas.save(); - mPrivateFlags |= DRAWN; - mPrivateFlags |= DRAWING_CACHE_VALID; + mPrivateFlags |= DRAWN | DRAWING_CACHE_VALID; // Fast path for layouts with no backgrounds if ((mPrivateFlags & SKIP_DRAW) == SKIP_DRAW) { -- cgit v1.1