summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2014-07-11 13:38:51 -0700
committerChet Haase <chet@google.com>2014-07-11 13:38:51 -0700
commit2b45a16b8b0f46090c0e612ef8a3d6084997fc27 (patch)
tree8d1c837afd95400f3bf1625224e5bef7c72538ab /core
parentc09a04da297ff85b97aa6ec0a457e9292b8bf7fa (diff)
downloadframeworks_base-2b45a16b8b0f46090c0e612ef8a3d6084997fc27.zip
frameworks_base-2b45a16b8b0f46090c0e612ef8a3d6084997fc27.tar.gz
frameworks_base-2b45a16b8b0f46090c0e612ef8a3d6084997fc27.tar.bz2
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
Diffstat (limited to 'core')
-rw-r--r--core/java/android/view/View.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 1e5f448..a63bc87 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -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.