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

Commit be85725e authored by Chris Craik's avatar Chris Craik Committed by Android (Google) Code Review
Browse files

Merge "Damage IsolatedZVolume when shadows change"

parents 0b1591c1 ff641477
Loading
Loading
Loading
Loading
+34 −1
Original line number Diff line number Diff line
@@ -11554,6 +11554,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                    receiver.damageInParent();
                }
            }
            // Damage the entire IsolatedZVolume recieving this view's shadow.
            if (getCastsShadow() && getTranslationZ() != 0) {
                damageIsolatedZVolume();
            }
        }
    }
@@ -11580,6 +11585,29 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        return mBackground != null;
    }
    /**
     * Damage area of the screen covered by the current isolated Z volume
     *
     * This method will guarantee that any changes to shadows cast by a View
     * are damaged on the screen for future redraw.
     */
    private void damageIsolatedZVolume() {
        final AttachInfo ai = mAttachInfo;
        if (ai != null) {
            ViewParent p = getParent();
            while (p != null) {
                if (p instanceof ViewGroup) {
                    final ViewGroup vg = (ViewGroup) p;
                    if (vg.hasIsolatedZVolume()) {
                        vg.damageInParent();
                        return;
                    }
                }
                p = p.getParent();
            }
        }
    }
    /**
     * Quick invalidation for View property changes (alpha, translationXY, etc.). We don't want to
     * set any flags or handle all of the cases handled by the default invalidation methods.
@@ -11608,12 +11636,17 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        } else {
            damageInParent();
        }
        if (invalidateParent && getCastsShadow() && getTranslationZ() != 0) {
            damageIsolatedZVolume();
        }
    }
    /**
     * Tells the parent view to damage this view's bounds.
     *
     * @hide
     */
    private void damageInParent() {
    protected void damageInParent() {
        final AttachInfo ai = mAttachInfo;
        final ViewParent p = mParent;
        if (p != null && ai != null) {