am 64339168: Merge "Don\'t destroy the same texture twice Bug #7221449" into jb-mr1-dev

* commit '64339168c4ff0b3ac249398811db7c88eca8f95c':
  Don't destroy the same texture twice Bug #7221449
This commit is contained in:
Romain Guy
2012-09-25 12:50:37 -07:00
committed by Android Git Automerger
7 changed files with 38 additions and 8 deletions

View File

@@ -166,6 +166,7 @@ class GLES20Canvas extends HardwareCanvas {
static native void nSetLayerColorFilter(int layerId, int nativeColorFilter);
static native void nUpdateTextureLayer(int layerId, int width, int height, boolean opaque,
SurfaceTexture surface);
static native void nClearLayerTexture(int layerId);
static native void nSetTextureLayerTransform(int layerId, int matrix);
static native void nDestroyLayer(int layerId);
static native void nDestroyLayerDeferred(int layerId);

View File

@@ -66,6 +66,11 @@ abstract class GLES20Layer extends HardwareLayer {
mLayer = 0;
}
@Override
void clearStorage() {
if (mLayer != 0) GLES20Canvas.nClearLayerTexture(mLayer);
}
static class Finalizer {
private int mLayerId;

View File

@@ -39,7 +39,7 @@ class GLES20TextureLayer extends GLES20Layer {
mFinalizer = new Finalizer(mLayer);
} else {
mFinalizer = null;
}
}
}
@Override

View File

@@ -204,4 +204,9 @@ abstract class HardwareLayer {
* @param dirtyRect The dirty region of the layer that needs to be redrawn
*/
abstract void redrawLater(DisplayList displayList, Rect dirtyRect);
/**
* Indicates that this layer has lost its underlying storage.
*/
abstract void clearStorage();
}

View File

@@ -224,6 +224,7 @@ public class TextureView extends View {
private void destroySurface() {
if (mLayer != null) {
mSurface.detachFromGLContext();
mLayer.clearStorage();
boolean shouldRelease = true;
if (mListener != null) {