summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2011-01-21 19:01:46 -0800
committerRomain Guy <romainguy@google.com>2011-01-21 19:03:58 -0800
commitc5d55863ec0290370a17d37d06feab743626b12f (patch)
tree1df83ffda9d6e24ab0cbf3b3491a269c69f7c460 /core/java/android
parent2152ca58c256f4e7d8a5d895eb96cdc2d2580a05 (diff)
downloadframeworks_base-c5d55863ec0290370a17d37d06feab743626b12f.zip
frameworks_base-c5d55863ec0290370a17d37d06feab743626b12f.tar.gz
frameworks_base-c5d55863ec0290370a17d37d06feab743626b12f.tar.bz2
Correctly invalidate views that transition from opaque to non-opaque.
Bug #3337037 Change-Id: I31397273a31b6004e2e3801866122bcbb3ebee5d
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/view/View.java9
-rw-r--r--core/java/android/view/ViewRoot.java6
2 files changed, 11 insertions, 4 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 811a633..c4bfe6c 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -1813,6 +1813,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
private int mPrevWidth = -1;
private int mPrevHeight = -1;
+ private boolean mLastIsOpaque;
+
/**
* Convenience value to check for float values that are close enough to zero to be considered
* zero.
@@ -6717,7 +6719,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
public void invalidate() {
invalidate(true);
}
-
+
/**
* This is where the invalidate() work actually happens. A full invalidate()
* causes the drawing cache to be invalidated, but this function can be called with
@@ -6734,8 +6736,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE);
}
+ boolean opaque = isOpaque();
if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) ||
- (invalidateCache && (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID)) {
+ (invalidateCache && (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID) ||
+ opaque != mLastIsOpaque) {
+ mLastIsOpaque = opaque;
mPrivateFlags &= ~DRAWN;
if (invalidateCache) {
mPrivateFlags &= ~DRAWING_CACHE_VALID;
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java
index 2c6ec71..ad101f8 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewRoot.java
@@ -710,8 +710,10 @@ public final class ViewRoot extends Handler implements ViewParent,
// object is not initialized to its backing store, but soon it
// will be (assuming the window is visible).
attachInfo.mSurface = mSurface;
- attachInfo.mUse32BitDrawingCache = PixelFormat.formatHasAlpha(lp.format) ||
- lp.format == PixelFormat.RGBX_8888;
+ // We used to use the following condition to choose 32 bits drawing caches:
+ // PixelFormat.hasAlpha(lp.format) || lp.format == PixelFormat.RGBX_8888
+ // However, windows are now always 32 bits by default, so choose 32 bits
+ attachInfo.mUse32BitDrawingCache = true;
attachInfo.mHasWindowFocus = false;
attachInfo.mWindowVisibility = viewVisibility;
attachInfo.mRecomputeGlobalAttributes = false;