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

Commit 321aa2b0 authored by Adam Cohen's avatar Adam Cohen
Browse files

Fixing inconsistency between invalidate region and draw region

Change-Id: I84458b31b4d3e8c305d64eb25e352fc4aba933d0
parent 6478e4f0
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() {