Merge "Fix invalidation issue for optimized/GL case."

This commit is contained in:
Chet Haase
2010-12-03 15:17:01 -08:00
committed by Android (Google) Code Review
2 changed files with 15 additions and 0 deletions

View File

@@ -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;

View File

@@ -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);