OSDN Git Service

Fix invalidation problem with display lists
authorChet Haase <chet@google.com>
Wed, 26 Jan 2011 07:22:09 +0000 (23:22 -0800)
committerChet Haase <chet@google.com>
Wed, 26 Jan 2011 07:22:09 +0000 (23:22 -0800)
It was previously the case that a view marked ~DRAWN must be
invalidated correctly already, so we would not mark any flags.
Display lists added new logic such that an undrawn node must still
be checked to see if its cache has been marked invalid. If not,
we must mark it invalid to make sure that a future rendering call
will cause the view to refresh its display list, thus refreshing its
child node tree's display lists, since that's where the invalidate
call must have originated.

Change-Id: I0f73c85459174c0e3f16d703f7eb914a706c808a

core/java/android/view/View.java
core/java/android/view/ViewGroup.java

index 65d2e11..449091a 100644 (file)
@@ -8249,7 +8249,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
             // If we got here, we're recreating it. Mark it as such to ensure that
             // we copy in child display lists into ours in drawChild()
             mRecreateDisplayList = true;
-
             if (mDisplayList == null) {
                 mDisplayList = mAttachInfo.mHardwareRenderer.createDisplayList(this);
                 // If we're creating a new display list, make sure our parent gets invalidated
@@ -8287,6 +8286,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
 
                 mDisplayList.end();
             }
+        } else {
+            mPrivateFlags |= DRAWN | DRAWING_CACHE_VALID;
+            mPrivateFlags &= ~DIRTY_MASK;
         }
 
         return mDisplayList;
index f198c46..9e5b23c 100644 (file)
@@ -3497,7 +3497,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                         ((ViewRoot) parent).invalidate();
                         parent = null;
                     } else if (view != null) {
-                        if ((mPrivateFlags & DRAWN) == DRAWN) {
+                        if ((view.mPrivateFlags & DRAWN) == DRAWN ||
+                                (view.mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID) {
                             view.mPrivateFlags &= ~DRAWING_CACHE_VALID;
                             view.mPrivateFlags |= DIRTY;
                             parent = view.mParent;
@@ -3594,7 +3595,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
             ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE_CHILD_IN_PARENT);
         }
 
-        if ((mPrivateFlags & DRAWN) == DRAWN) {
+        if ((mPrivateFlags & DRAWN) == DRAWN ||
+                (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID) {
             if ((mGroupFlags & (FLAG_OPTIMIZE_INVALIDATE | FLAG_ANIMATION_DONE)) !=
                         FLAG_OPTIMIZE_INVALIDATE) {
                 dirty.offset(location[CHILD_LEFT_INDEX] - mScrollX,