From 52b307ebc86e12e368694442eb8751e7e0de239e Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Sun, 7 Oct 2012 17:55:17 -0700 Subject: Clear draw flags when updating TextureView's layer Bug #7171323 Finally! Change-Id: Iefef8fb9a8ef1fe4b374005067145319312c57cf --- core/java/android/view/TextureView.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'core/java/android/view/TextureView.java') diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java index a9b6e097daf4..230f426626a0 100644 --- a/core/java/android/view/TextureView.java +++ b/core/java/android/view/TextureView.java @@ -224,6 +224,8 @@ public class TextureView extends View { private void destroySurface() { if (mLayer != null) { mSurface.detachFromGLContext(); + // SurfaceTexture owns the texture name and detachFromGLContext + // should have deleted it mLayer.clearStorage(); boolean shouldRelease = true; @@ -291,6 +293,9 @@ public class TextureView extends View { */ @Override public final void draw(Canvas canvas) { + // NOTE: Maintain this carefully (see View.java) + mPrivateFlags = (mPrivateFlags & ~PFLAG_DIRTY_MASK) | PFLAG_DRAWN; + applyUpdate(); applyTransformMatrix(); } @@ -335,6 +340,10 @@ public class TextureView extends View { @Override HardwareLayer getHardwareLayer() { + // NOTE: Maintain these two lines very carefully (see View.java) + mPrivateFlags |= PFLAG_DRAWN | PFLAG_DRAWING_CACHE_VALID; + mPrivateFlags &= ~PFLAG_DIRTY_MASK; + if (mLayer == null) { if (mAttachInfo == null || mAttachInfo.mHardwareRenderer == null) { return null; @@ -773,6 +782,7 @@ public class TextureView extends View { * Invoked when the specified {@link SurfaceTexture} is about to be destroyed. * If returns true, no rendering should happen inside the surface texture after this method * is invoked. If returns false, the client needs to call {@link SurfaceTexture#release()}. + * Most applications should return true. * * @param surface The surface about to be destroyed */ -- cgit v1.2.3