From f2f7d8f9dd75c6e32a46a28fd3f53435addf0746 Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Fri, 3 Dec 2010 14:08:14 -0800 Subject: [PATCH] Fix invalidation issue for optimized/GL case. The bug caused intermittent artifacts where some apps would not get repainted until some overall screen invalidation occurred. Change-Id: I82a3294429f15fe51cc8f4b47134e3b5540cb240 --- core/java/android/view/View.java | 12 ++++++++++++ core/java/android/view/ViewGroup.java | 3 +++ 2 files changed, 15 insertions(+) diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index daf9ac48d4b33..e3a07157dd21f 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -6453,6 +6453,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility mPrivateFlags &= ~DRAWING_CACHE_VALID; final ViewParent p = mParent; final AttachInfo ai = mAttachInfo; + if (p != null && ai != null && ai.mHardwareAccelerated) { + // fast-track for GL-enabled applications; just invalidate the whole hierarchy + // with a null dirty rect, which tells the ViewRoot to redraw everything + p.invalidateChild(this, null); + return; + } if (p != null && ai != null && l < r && t < b) { final int scrollX = mScrollX; final int scrollY = mScrollY; @@ -6496,6 +6502,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility } final AttachInfo ai = mAttachInfo; final ViewParent p = mParent; + if (p != null && ai != null && ai.mHardwareAccelerated) { + // fast-track for GL-enabled applications; just invalidate the whole hierarchy + // with a null dirty rect, which tells the ViewRoot to redraw everything + p.invalidateChild(this, null); + return; + } if (p != null && ai != null) { final Rect r = ai.mTmpInvalRect; diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index ac63742b6bbba..7b81b8fe1e920 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -2349,9 +2349,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager child.draw(canvas); } } else { + child.mPrivateFlags &= ~DIRTY_MASK; ((HardwareCanvas) canvas).drawDisplayList(displayList); } } else if (cache != null) { + child.mPrivateFlags &= ~DIRTY_MASK; final Paint cachePaint = mCachePaint; if (alpha < 1.0f) { cachePaint.setAlpha((int) (alpha * 255)); @@ -2583,6 +2585,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager // addViewInner() will call child.requestLayout() when setting the new LayoutParams // therefore, we call requestLayout() on ourselves before, so that the child's request // will be blocked at our level + child.mPrivateFlags &= ~DIRTY_MASK; requestLayout(); invalidate(); addViewInner(child, index, params, false);