summaryrefslogtreecommitdiffstats
path: root/core/java/android/view/View.java
diff options
context:
space:
mode:
authorJun Mukai <mukai@google.com>2015-06-03 00:59:13 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-03 00:59:15 +0000
commit3c1348773ad48edbd73cf32d9ae6d23841ea4cff (patch)
tree25061e44aa4e40afb64436b9cfa254a120e7725f /core/java/android/view/View.java
parentc021632e0750e495e62c3952c506a3e5ed516dc2 (diff)
parent3427f57e036b3e535ca40076524eb53a72df4980 (diff)
downloadframeworks_base-3c1348773ad48edbd73cf32d9ae6d23841ea4cff.zip
frameworks_base-3c1348773ad48edbd73cf32d9ae6d23841ea4cff.tar.gz
frameworks_base-3c1348773ad48edbd73cf32d9ae6d23841ea4cff.tar.bz2
Merge "Retire PFLAG_ONLY_DRAWS_BACKGROUND." into mnc-dev
Diffstat (limited to 'core/java/android/view/View.java')
-rw-r--r--core/java/android/view/View.java44
1 files changed, 20 insertions, 24 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index cfd504d..37c8100 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -1661,8 +1661,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
/** {@hide} */
static final int PFLAG_SKIP_DRAW = 0x00000080;
/** {@hide} */
- static final int PFLAG_ONLY_DRAWS_BACKGROUND = 0x00000100;
- /** {@hide} */
static final int PFLAG_REQUEST_TRANSPARENT_REGIONS = 0x00000200;
/** {@hide} */
static final int PFLAG_DRAWABLE_STATE_DIRTY = 0x00000400;
@@ -10619,9 +10617,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
if ((changed & DRAW_MASK) != 0) {
if ((mViewFlags & WILL_NOT_DRAW) != 0) {
- if (mBackground != null) {
+ if (mBackground != null
+ || (mForegroundInfo != null && mForegroundInfo.mDrawable != null)) {
mPrivateFlags &= ~PFLAG_SKIP_DRAW;
- mPrivateFlags |= PFLAG_ONLY_DRAWS_BACKGROUND;
} else {
mPrivateFlags |= PFLAG_SKIP_DRAW;
}
@@ -17260,20 +17258,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
if ((mPrivateFlags & PFLAG_SKIP_DRAW) != 0) {
mPrivateFlags &= ~PFLAG_SKIP_DRAW;
- mPrivateFlags |= PFLAG_ONLY_DRAWS_BACKGROUND;
requestLayout = true;
}
} else {
/* Remove the background */
mBackground = null;
-
- if ((mPrivateFlags & PFLAG_ONLY_DRAWS_BACKGROUND) != 0) {
- /*
- * This view ONLY drew the background before and we're removing
- * the background, so now it won't draw anything
- * (hence we SKIP_DRAW)
- */
- mPrivateFlags &= ~PFLAG_ONLY_DRAWS_BACKGROUND;
+ if ((mViewFlags & WILL_NOT_DRAW) != 0
+ && (mForegroundInfo == null || mForegroundInfo.mDrawable == null)) {
mPrivateFlags |= PFLAG_SKIP_DRAW;
}
@@ -17447,13 +17438,17 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
mForegroundInfo.mDrawable = foreground;
mForegroundInfo.mBoundsChanged = true;
if (foreground != null) {
- setWillNotDraw(false);
+ if ((mPrivateFlags & PFLAG_SKIP_DRAW) != 0) {
+ mPrivateFlags &= ~PFLAG_SKIP_DRAW;
+ }
foreground.setCallback(this);
foreground.setLayoutDirection(getLayoutDirection());
if (foreground.isStateful()) {
foreground.setState(getDrawableState());
}
applyForegroundTint();
+ } else if ((mViewFlags & WILL_NOT_DRAW) != 0 && mBackground == null) {
+ mPrivateFlags |= PFLAG_SKIP_DRAW;
}
requestLayout();
invalidate();
@@ -19181,16 +19176,17 @@ 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 &&
- 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.
- applyDrawableToTransparentRegion(mBackground, region);
- }
- final Drawable foreground = mForegroundInfo != null ? mForegroundInfo.mDrawable : null;
- if (foreground != null) {
- applyDrawableToTransparentRegion(mForegroundInfo.mDrawable, region);
+ } else {
+ if (mBackground != null && mBackground.getOpacity() != PixelFormat.TRANSPARENT) {
+ // The SKIP_DRAW flag IS set and the background drawable exists, we remove
+ // the background drawable's non-transparent parts from this transparent region.
+ applyDrawableToTransparentRegion(mBackground, region);
+ }
+ if (mForegroundInfo != null && mForegroundInfo.mDrawable != null
+ && mForegroundInfo.mDrawable.getOpacity() != PixelFormat.TRANSPARENT) {
+ // Similarly, we remove the foreground drawable's non-transparent parts.
+ applyDrawableToTransparentRegion(mForegroundInfo.mDrawable, region);
+ }
}
}
return true;