diff options
| author | Adam Powell <adamp@google.com> | 2010-11-08 19:25:54 -0800 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2010-11-08 19:25:54 -0800 |
| commit | 848ae6e48b7942ced2ce149b167774db038cc741 (patch) | |
| tree | 029e5280bc0c27490101e064a31f46fa1b5d234d /core | |
| parent | d1959717c28766d4a7fecedd703a79e17c532da8 (diff) | |
| parent | 6bb4f67ac29b916b8ea4f08b79a7bc46c5844646 (diff) | |
| download | frameworks_base-848ae6e48b7942ced2ce149b167774db038cc741.zip frameworks_base-848ae6e48b7942ced2ce149b167774db038cc741.tar.gz frameworks_base-848ae6e48b7942ced2ce149b167774db038cc741.tar.bz2 | |
am 6bb4f67a: am 26153a33: Fix bug 3163052 - always use 32-bit drawing caches when destination window is 32-bit
* commit '6bb4f67ac29b916b8ea4f08b79a7bc46c5844646':
Fix bug 3163052 - always use 32-bit drawing caches when destination window is 32-bit
Diffstat (limited to 'core')
| -rw-r--r-- | core/java/android/view/View.java | 12 | ||||
| -rw-r--r-- | core/java/android/view/ViewRoot.java | 3 |
2 files changed, 8 insertions, 7 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 340678d..454ef4d 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -7616,11 +7616,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility final int drawingCacheBackgroundColor = mDrawingCacheBackgroundColor; final boolean opaque = drawingCacheBackgroundColor != 0 || isOpaque(); - final boolean translucentWindow = attachInfo != null && attachInfo.mTranslucentWindow; + final boolean use32BitCache = attachInfo != null && attachInfo.mUse32BitDrawingCache; if (width <= 0 || height <= 0 || // Projected bitmap size in bytes - (width * height * (opaque && !translucentWindow ? 2 : 4) > + (width * height * (opaque && !use32BitCache ? 2 : 4) > ViewConfiguration.get(mContext).getScaledMaximumDrawingCacheSize())) { destroyDrawingCache(); return; @@ -7649,7 +7649,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility } else { // Optimization for translucent windows // If the window is translucent, use a 32 bits bitmap to benefit from memcpy() - quality = translucentWindow ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565; + quality = use32BitCache ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565; } // Try to cleanup memory @@ -7663,7 +7663,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility } else { mUnscaledDrawingCache = bitmap; } - if (opaque && translucentWindow) bitmap.setHasAlpha(false); + if (opaque && use32BitCache) bitmap.setHasAlpha(false); } catch (OutOfMemoryError e) { // If there is not enough memory to create the bitmap cache, just // ignore the issue as bitmap caches are not required to draw the @@ -10527,9 +10527,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility int mWindowTop; /** - * Indicates whether the window is translucent/transparent + * Indicates whether views need to use 32-bit drawing caches */ - boolean mTranslucentWindow; + boolean mUse32BitDrawingCache; /** * For windows that are full-screen but using insets to layout inside diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java index 026684b..e04916f 100644 --- a/core/java/android/view/ViewRoot.java +++ b/core/java/android/view/ViewRoot.java @@ -671,7 +671,8 @@ public final class ViewRoot extends Handler implements ViewParent, View.AttachIn // object is not initialized to its backing store, but soon it // will be (assuming the window is visible). attachInfo.mSurface = mSurface; - attachInfo.mTranslucentWindow = PixelFormat.formatHasAlpha(lp.format); + attachInfo.mUse32BitDrawingCache = PixelFormat.formatHasAlpha(lp.format) || + lp.format == PixelFormat.RGBX_8888; attachInfo.mHasWindowFocus = false; attachInfo.mWindowVisibility = viewVisibility; attachInfo.mRecomputeGlobalAttributes = false; |
