Loading core/java/android/view/View.java +2 −4 Original line number Original line Diff line number Diff line Loading @@ -12363,9 +12363,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, canvas.setViewport(width, height); canvas.setViewport(width, height); // The dirty rect should always be null for a display list // The dirty rect should always be null for a display list canvas.onPreDraw(null); canvas.onPreDraw(null); int layerType = ( int layerType = getLayerType(); !(mParent instanceof ViewGroup) || ((ViewGroup)mParent).mDrawLayers) ? getLayerType() : LAYER_TYPE_NONE; if (!isLayer && layerType != LAYER_TYPE_NONE) { if (!isLayer && layerType != LAYER_TYPE_NONE) { if (layerType == LAYER_TYPE_HARDWARE) { if (layerType == LAYER_TYPE_HARDWARE) { final HardwareLayer layer = getHardwareLayer(); final HardwareLayer layer = getHardwareLayer(); Loading Loading @@ -13072,7 +13070,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, boolean scalingRequired = false; boolean scalingRequired = false; boolean caching; boolean caching; int layerType = parent.mDrawLayers ? getLayerType() : LAYER_TYPE_NONE; int layerType = getLayerType(); final boolean hardwareAccelerated = canvas.isHardwareAccelerated(); final boolean hardwareAccelerated = canvas.isHardwareAccelerated(); if ((flags & ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE) != 0 || if ((flags & ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE) != 0 || Loading core/java/android/view/ViewGroup.java +0 −43 Original line number Original line Diff line number Diff line Loading @@ -404,10 +404,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager // views during a transition when they otherwise would have become gone/invisible // views during a transition when they otherwise would have become gone/invisible private ArrayList<View> mVisibilityChangingChildren; private ArrayList<View> mVisibilityChangingChildren; // Indicates whether this container will use its children layers to draw @ViewDebug.ExportedProperty(category = "drawing") boolean mDrawLayers = true; // Indicates how many of this container's child subtrees contain transient state // Indicates how many of this container's child subtrees contain transient state @ViewDebug.ExportedProperty(category = "layout") @ViewDebug.ExportedProperty(category = "layout") private int mChildCountWithTransientState = 0; private int mChildCountWithTransientState = 0; Loading Loading @@ -2929,45 +2925,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager return child.draw(canvas, this, drawingTime); return child.draw(canvas, this, drawingTime); } } /** * * @param enabled True if children should be drawn with layers, false otherwise. * * @hide */ public void setChildrenLayersEnabled(boolean enabled) { if (enabled != mDrawLayers) { mDrawLayers = enabled; invalidate(true); boolean flushLayers = !enabled; AttachInfo info = mAttachInfo; if (info != null && info.mHardwareRenderer != null && info.mHardwareRenderer.isEnabled()) { if (!info.mHardwareRenderer.validate()) { flushLayers = false; } } else { flushLayers = false; } // We need to invalidate any child with a layer. For instance, // if a child is backed by a hardware layer and we disable layers // the child is marked as not dirty (flags cleared the last time // the child was drawn inside its layer.) However, that child might // never have created its own display list or have an obsolete // display list. By invalidating the child we ensure the display // list is in sync with the content of the hardware layer. for (int i = 0; i < mChildrenCount; i++) { View child = mChildren[i]; if (child.mLayerType != LAYER_TYPE_NONE) { if (flushLayers) child.flushLayer(); child.invalidate(true); } } } } /** /** * By default, children are clipped to their bounds before drawing. This * By default, children are clipped to their bounds before drawing. This * allows view groups to override this behavior for animations, etc. * allows view groups to override this behavior for animations, etc. Loading tests/HwAccelerationTest/AndroidManifest.xml +0 −9 Original line number Original line Diff line number Diff line Loading @@ -276,15 +276,6 @@ </intent-filter> </intent-filter> </activity> </activity> <activity android:name="ViewLayersActivity6" android:label="_ViewLayers6"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity <activity android:name="AlphaLayersActivity" android:name="AlphaLayersActivity" android:label="_αLayers"> android:label="_αLayers"> Loading tests/HwAccelerationTest/res/layout/view_layers_5.xml +14 −2 Original line number Original line Diff line number Diff line Loading @@ -26,17 +26,29 @@ android:layout_weight="1"> android:layout_weight="1"> <Button <Button android:onClick="setLayerEnabled" android:onClick="enableLayer" android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_height="wrap_content" android:text="Enable layer" /> android:text="Enable layer" /> <Button <Button android:onClick="setLayerDisabled" android:onClick="disableLayer" android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_height="wrap_content" android:text="Disable layer" /> android:text="Disable layer" /> <Button android:onClick="shrinkLayer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Shrink layer" /> <Button android:onClick="growLayer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Grow layer" /> </LinearLayout> </LinearLayout> <ListView <ListView Loading tests/HwAccelerationTest/res/layout/view_layers_6.xmldeleted 100644 → 0 +0 −60 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2011 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:orientation="vertical" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="1"> <Button android:onClick="enableLayer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Enable layer" /> <Button android:onClick="disableLayer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Disable layer" /> <Button android:onClick="shrinkLayer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Shrink layer" /> <Button android:onClick="growLayer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Grow layer" /> </LinearLayout> <ListView android:id="@+id/list1" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="1" /> </LinearLayout> Loading
core/java/android/view/View.java +2 −4 Original line number Original line Diff line number Diff line Loading @@ -12363,9 +12363,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, canvas.setViewport(width, height); canvas.setViewport(width, height); // The dirty rect should always be null for a display list // The dirty rect should always be null for a display list canvas.onPreDraw(null); canvas.onPreDraw(null); int layerType = ( int layerType = getLayerType(); !(mParent instanceof ViewGroup) || ((ViewGroup)mParent).mDrawLayers) ? getLayerType() : LAYER_TYPE_NONE; if (!isLayer && layerType != LAYER_TYPE_NONE) { if (!isLayer && layerType != LAYER_TYPE_NONE) { if (layerType == LAYER_TYPE_HARDWARE) { if (layerType == LAYER_TYPE_HARDWARE) { final HardwareLayer layer = getHardwareLayer(); final HardwareLayer layer = getHardwareLayer(); Loading Loading @@ -13072,7 +13070,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, boolean scalingRequired = false; boolean scalingRequired = false; boolean caching; boolean caching; int layerType = parent.mDrawLayers ? getLayerType() : LAYER_TYPE_NONE; int layerType = getLayerType(); final boolean hardwareAccelerated = canvas.isHardwareAccelerated(); final boolean hardwareAccelerated = canvas.isHardwareAccelerated(); if ((flags & ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE) != 0 || if ((flags & ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE) != 0 || Loading
core/java/android/view/ViewGroup.java +0 −43 Original line number Original line Diff line number Diff line Loading @@ -404,10 +404,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager // views during a transition when they otherwise would have become gone/invisible // views during a transition when they otherwise would have become gone/invisible private ArrayList<View> mVisibilityChangingChildren; private ArrayList<View> mVisibilityChangingChildren; // Indicates whether this container will use its children layers to draw @ViewDebug.ExportedProperty(category = "drawing") boolean mDrawLayers = true; // Indicates how many of this container's child subtrees contain transient state // Indicates how many of this container's child subtrees contain transient state @ViewDebug.ExportedProperty(category = "layout") @ViewDebug.ExportedProperty(category = "layout") private int mChildCountWithTransientState = 0; private int mChildCountWithTransientState = 0; Loading Loading @@ -2929,45 +2925,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager return child.draw(canvas, this, drawingTime); return child.draw(canvas, this, drawingTime); } } /** * * @param enabled True if children should be drawn with layers, false otherwise. * * @hide */ public void setChildrenLayersEnabled(boolean enabled) { if (enabled != mDrawLayers) { mDrawLayers = enabled; invalidate(true); boolean flushLayers = !enabled; AttachInfo info = mAttachInfo; if (info != null && info.mHardwareRenderer != null && info.mHardwareRenderer.isEnabled()) { if (!info.mHardwareRenderer.validate()) { flushLayers = false; } } else { flushLayers = false; } // We need to invalidate any child with a layer. For instance, // if a child is backed by a hardware layer and we disable layers // the child is marked as not dirty (flags cleared the last time // the child was drawn inside its layer.) However, that child might // never have created its own display list or have an obsolete // display list. By invalidating the child we ensure the display // list is in sync with the content of the hardware layer. for (int i = 0; i < mChildrenCount; i++) { View child = mChildren[i]; if (child.mLayerType != LAYER_TYPE_NONE) { if (flushLayers) child.flushLayer(); child.invalidate(true); } } } } /** /** * By default, children are clipped to their bounds before drawing. This * By default, children are clipped to their bounds before drawing. This * allows view groups to override this behavior for animations, etc. * allows view groups to override this behavior for animations, etc. Loading
tests/HwAccelerationTest/AndroidManifest.xml +0 −9 Original line number Original line Diff line number Diff line Loading @@ -276,15 +276,6 @@ </intent-filter> </intent-filter> </activity> </activity> <activity android:name="ViewLayersActivity6" android:label="_ViewLayers6"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity <activity android:name="AlphaLayersActivity" android:name="AlphaLayersActivity" android:label="_αLayers"> android:label="_αLayers"> Loading
tests/HwAccelerationTest/res/layout/view_layers_5.xml +14 −2 Original line number Original line Diff line number Diff line Loading @@ -26,17 +26,29 @@ android:layout_weight="1"> android:layout_weight="1"> <Button <Button android:onClick="setLayerEnabled" android:onClick="enableLayer" android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_height="wrap_content" android:text="Enable layer" /> android:text="Enable layer" /> <Button <Button android:onClick="setLayerDisabled" android:onClick="disableLayer" android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_height="wrap_content" android:text="Disable layer" /> android:text="Disable layer" /> <Button android:onClick="shrinkLayer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Shrink layer" /> <Button android:onClick="growLayer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Grow layer" /> </LinearLayout> </LinearLayout> <ListView <ListView Loading
tests/HwAccelerationTest/res/layout/view_layers_6.xmldeleted 100644 → 0 +0 −60 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2011 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:orientation="vertical" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="1"> <Button android:onClick="enableLayer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Enable layer" /> <Button android:onClick="disableLayer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Disable layer" /> <Button android:onClick="shrinkLayer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Shrink layer" /> <Button android:onClick="growLayer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Grow layer" /> </LinearLayout> <ListView android:id="@+id/list1" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="1" /> </LinearLayout>