diff options
author | Chet Haase <chet@google.com> | 2012-09-30 15:54:09 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-09-30 15:54:10 -0700 |
commit | 62ea4363362526d32b48f920601d3b4e27a117bb (patch) | |
tree | febaa445c655a7638c7024ad4c3c308406a192a2 /core/java | |
parent | 2a30547af44536f6b0e2f7020ac1a435c72afc84 (diff) | |
parent | 6a2d17f71342f981c9df1dc5beff33e30eb3ae2b (diff) | |
download | frameworks_base-62ea4363362526d32b48f920601d3b4e27a117bb.zip frameworks_base-62ea4363362526d32b48f920601d3b4e27a117bb.tar.gz frameworks_base-62ea4363362526d32b48f920601d3b4e27a117bb.tar.bz2 |
Merge "Fix texture corruption" into jb-mr1-dev
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/view/DisplayList.java | 7 | ||||
-rw-r--r-- | core/java/android/view/GLES20DisplayList.java | 8 | ||||
-rw-r--r-- | core/java/android/view/HardwareRenderer.java | 6 | ||||
-rw-r--r-- | core/java/android/view/View.java | 3 |
4 files changed, 24 insertions, 0 deletions
diff --git a/core/java/android/view/DisplayList.java b/core/java/android/view/DisplayList.java index a42e156..5e34a36 100644 --- a/core/java/android/view/DisplayList.java +++ b/core/java/android/view/DisplayList.java @@ -332,4 +332,11 @@ public abstract class DisplayList { * @see View#offsetTopAndBottom(int) */ public abstract void offsetTopBottom(int offset); + + /** + * Reset native resources. This is called when cleaning up the state of DisplayLists + * during destruction of hardware resources, to ensure that we do not hold onto + * obsolete resources after related resources are gone. + */ + public abstract void reset(); } diff --git a/core/java/android/view/GLES20DisplayList.java b/core/java/android/view/GLES20DisplayList.java index 3bdd5c0..e9bd0c4 100644 --- a/core/java/android/view/GLES20DisplayList.java +++ b/core/java/android/view/GLES20DisplayList.java @@ -87,6 +87,13 @@ class GLES20DisplayList extends DisplayList { } @Override + public void reset() { + if (hasNativeDisplayList()) { + nReset(mFinalizer.mNativeDisplayList); + } + } + + @Override public boolean isValid() { return mValid; } @@ -294,6 +301,7 @@ class GLES20DisplayList extends DisplayList { } } + private static native void nReset(int displayList); private static native void nOffsetTopBottom(int displayList, int offset); private static native void nOffsetLeftRight(int displayList, int offset); private static native void nSetLeftTopRightBottom(int displayList, int left, int top, diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index 28763b3..99987bf 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -1508,6 +1508,9 @@ public abstract class HardwareRenderer { @Override void destroyLayers(View view) { if (view != null && isEnabled() && checkCurrent() != SURFACE_STATE_ERROR) { + if (mCanvas != null) { + mCanvas.clearLayerUpdates(); + } destroyHardwareLayer(view); GLES20Canvas.flushCaches(GLES20Canvas.FLUSH_CACHES_LAYERS); } @@ -1556,6 +1559,9 @@ public abstract class HardwareRenderer { safelyRun(new Runnable() { @Override public void run() { + if (mCanvas != null) { + mCanvas.clearLayerUpdates(); + } destroyResources(view); GLES20Canvas.flushCaches(GLES20Canvas.FLUSH_CACHES_LAYERS); } diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 6eca8fd..4b6f4ea 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -12394,6 +12394,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mHardwareLayer.destroy(); mHardwareLayer = null; + if (mDisplayList != null) { + mDisplayList.reset(); + } invalidate(true); invalidateParentCaches(); } |