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

Commit 2b45a16b authored by Chet Haase's avatar Chet Haase
Browse files

Optimize gatherTransparentRegions to account for transparent bg

gatherTransparentRegions() incorrectly takes the background into account
even when that background drawable is a completely transparent ColorDrawable
(which you can get by calling View.setBackgroundColor(0)). Checking
the opacity of the drawable allows us to ignore drawables that are not
visible.

Issue #13465427 Performance suggestion: View.setBackgroundColor(0) should set background to null

Change-Id: Ic552bf6a07cc9229fd32febc3ada73a0701cad0c
parent c09a04da
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -17492,7 +17492,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                getLocationInWindow(location);
                region.op(location[0], location[1], location[0] + mRight - mLeft,
                        location[1] + mBottom - mTop, Region.Op.DIFFERENCE);
            } else if ((pflags & PFLAG_ONLY_DRAWS_BACKGROUND) != 0 && mBackground != null) {
            } else if ((pflags & PFLAG_ONLY_DRAWS_BACKGROUND) != 0 && mBackground != null &&
                    mBackground.getOpacity() != PixelFormat.TRANSPARENT) {
                // The ONLY_DRAWS_BACKGROUND flag IS set and the background drawable
                // exists, so we remove the background drawable's non-transparent
                // parts from this transparent region.