From b85967b9af76e1e60f7a96603e2567a6449d2e04 Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Mon, 26 Mar 2012 14:37:51 -0700 Subject: Re-enabling DisplayList properties Several issues came up after DisplayList properties were enabled, so they were disabled pending fixes. Those issues have been fixed, so DisplayList properties are once again being enabled by default. This CL both re-enables these properties (in View.java and DisplayListRenderer.h) and fixes the various issues that enabling them caused the first time around. Related issues (all currently marked as Fixed, though that was simply because DL properties were disabled - this CL provides the real fixes now that DL properties are enabled by default): Issue #6198276 Text input broken Issue #6198472 Native crash at pc 00076428 in many different apps in JRM80 Issue #6204173 Date/time picker isn't rendering all parts of UI Issue #6203941 All Apps overscroll effect is rendered weirdly/has flickering Issue #6200058 CAB rendering issue - not drawing items? Issue #6198578 Front camera shows black screen after taking picture. Issue #6232010 Layers not recreated when children change (DisplayList properties) Change-Id: I8b5f9ec342208ecb20d3e6a60d26cf7c6112ec8b --- core/java/android/view/View.java | 43 ++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 13 deletions(-) (limited to 'core/java/android/view/View.java') diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index f769e96..2deeba6 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -1459,7 +1459,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * apps. * @hide */ - public static final boolean USE_DISPLAY_LIST_PROPERTIES = false; + public static final boolean USE_DISPLAY_LIST_PROPERTIES = true; /** * Map used to store views' tags. @@ -7401,7 +7401,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal invalidateViewProperty(false, false); if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { - mDisplayList.setCameraDistance(distance); + mDisplayList.setCameraDistance(-Math.abs(distance) / dpi); } } @@ -10747,16 +10747,25 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal int layerType = ( !(mParent instanceof ViewGroup) || ((ViewGroup)mParent).mDrawLayers) ? getLayerType() : LAYER_TYPE_NONE; - if (!isLayer && layerType == LAYER_TYPE_HARDWARE && USE_DISPLAY_LIST_PROPERTIES) { - final HardwareLayer layer = getHardwareLayer(); - if (layer != null && layer.isValid()) { - canvas.drawHardwareLayer(layer, 0, 0, mLayerPaint); + if (!isLayer && layerType != LAYER_TYPE_NONE && USE_DISPLAY_LIST_PROPERTIES) { + if (layerType == LAYER_TYPE_HARDWARE) { + final HardwareLayer layer = getHardwareLayer(); + if (layer != null && layer.isValid()) { + canvas.drawHardwareLayer(layer, 0, 0, mLayerPaint); + } else { + canvas.saveLayer(0, 0, mRight - mLeft, mBottom - mTop, mLayerPaint, + Canvas.HAS_ALPHA_LAYER_SAVE_FLAG | + Canvas.CLIP_TO_LAYER_SAVE_FLAG); + } + caching = true; } else { - canvas.saveLayer(0, 0, - mRight - mLeft, mBottom - mTop, mLayerPaint, - Canvas.HAS_ALPHA_LAYER_SAVE_FLAG | Canvas.CLIP_TO_LAYER_SAVE_FLAG); + buildDrawingCache(true); + Bitmap cache = getDrawingCache(true); + if (cache != null) { + canvas.drawBitmap(cache, 0, 0, mLayerPaint); + caching = true; + } } - caching = true; } else { computeScroll(); @@ -11395,7 +11404,11 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal mTransformationInfo.mRotation, mTransformationInfo.mRotationX, mTransformationInfo.mRotationY, mTransformationInfo.mScaleX, mTransformationInfo.mScaleY); - displayList.setCameraDistance(getCameraDistance()); + if (mTransformationInfo.mCamera == null) { + mTransformationInfo.mCamera = new Camera(); + mTransformationInfo.matrix3D = new Matrix(); + } + displayList.setCameraDistance(mTransformationInfo.mCamera.getLocationZ()); if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == PIVOT_EXPLICITLY_SET) { displayList.setPivotX(getPivotX()); displayList.setPivotY(getPivotY()); @@ -11489,8 +11502,12 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } else { switch (layerType) { case LAYER_TYPE_SOFTWARE: - buildDrawingCache(true); - cache = getDrawingCache(true); + if (useDisplayListProperties) { + hasDisplayList = canHaveDisplayList(); + } else { + buildDrawingCache(true); + cache = getDrawingCache(true); + } break; case LAYER_TYPE_HARDWARE: if (useDisplayListProperties) { -- cgit v1.1