Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f10615d8 authored by Adam Cohen's avatar Adam Cohen Committed by Android (Google) Code Review
Browse files

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

parents c9e59899 321aa2b0
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -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);
        }
    }

    private void onLayout() {