am f10615d8: Merge "Fixing inconsistency between invalidate region and draw region" into honeycomb-mr1

* commit 'f10615d8d86f4324bf5f6b5a2eb2874cc2b5ef3d':
  Fixing inconsistency between invalidate region and draw region
This commit is contained in:
Adam Cohen
2011-03-08 15:02:34 -08:00
committed by Android Git Automerger

View File

@@ -531,6 +531,8 @@ public class StackView extends AdapterViewAnimator {
@Override
protected void dispatchDraw(Canvas canvas) {
boolean expandClipRegion = false;
canvas.getClipBounds(stackInvalidateRect);
final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
@@ -540,12 +542,22 @@ public class StackView extends AdapterViewAnimator {
child.getAlpha() == 0f || child.getVisibility() != VISIBLE) {
lp.resetInvalidateRect();
}
stackInvalidateRect.union(lp.getInvalidateRect());
Rect childInvalidateRect = lp.getInvalidateRect();
if (!childInvalidateRect.isEmpty()) {
expandClipRegion = true;
stackInvalidateRect.union(childInvalidateRect);
}
}
// We only expand the clip bounds if necessary.
if (expandClipRegion) {
canvas.save(Canvas.CLIP_SAVE_FLAG);
canvas.clipRect(stackInvalidateRect, Region.Op.UNION);
super.dispatchDraw(canvas);
canvas.restore();
} else {
super.dispatchDraw(canvas);
}
canvas.save(Canvas.CLIP_SAVE_FLAG);
canvas.clipRect(stackInvalidateRect, Region.Op.UNION);
super.dispatchDraw(canvas);
canvas.restore();
}
private void onLayout() {