summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chris Craik <ccraik@google.com> 2012-09-06 14:42:44 -0700
committer Chris Craik <ccraik@google.com> 2012-09-06 14:45:45 -0700
commit10e9d1d7ad6296fca388451c71238cc43fe54756 (patch)
treed82b42edd10925539523f389def1f85cb9a9dda4
parentfb3ec448f1208d75edebff0e93fa97a8913ff29e (diff)
Log if a view fails to fit in the drawing cache
Large software layers won't draw if they're larger than the size of the drawing cache, in which case this log will be triggered. bug:7078391 Change-Id: Ib42a060b8e3b3642417df9243a086aa15b2989b1
-rw-r--r--core/java/android/view/View.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index b6f07fac5513..7cf2202f200a 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -12537,10 +12537,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
final boolean opaque = drawingCacheBackgroundColor != 0 || isOpaque();
final boolean use32BitCache = attachInfo != null && attachInfo.mUse32BitDrawingCache;
- if (width <= 0 || height <= 0 ||
- // Projected bitmap size in bytes
- (width * height * (opaque && !use32BitCache ? 2 : 4) >
- ViewConfiguration.get(mContext).getScaledMaximumDrawingCacheSize())) {
+ final int projectedBitmapSize = width * height * (opaque && !use32BitCache ? 2 : 4);
+ final int drawingCacheSize =
+ ViewConfiguration.get(mContext).getScaledMaximumDrawingCacheSize();
+ if (width <= 0 || height <= 0 || projectedBitmapSize > drawingCacheSize) {
+ Log.w(VIEW_LOG_TAG, "View too large to fit into drawing cache, needs "
+ + projectedBitmapSize + " bytes, only "
+ + drawingCacheSize + " available");
destroyDrawingCache();
mCachingFailed = true;
return;