Skip to content

Commit acf74db

Browse files
Romain GuyAndroid Git Automerger
authored andcommitted
am bfb2883: am b0f8514: am 133fcdf: Merge "Clear draw flags when updating TextureView\'s layer Bug #7171323" into jb-mr1-dev
* commit 'bfb2883b57a0eabb83d786a1f9d187a26e36d7f5': Clear draw flags when updating TextureView's layer Bug #7171323
2 parents 34a24c3 + bfb2883 commit acf74db

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

core/java/android/view/TextureView.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ public void run() {
224224
private void destroySurface() {
225225
if (mLayer != null) {
226226
mSurface.detachFromGLContext();
227+
// SurfaceTexture owns the texture name and detachFromGLContext
228+
// should have deleted it
227229
mLayer.clearStorage();
228230

229231
boolean shouldRelease = true;
@@ -291,6 +293,9 @@ public void buildLayer() {
291293
*/
292294
@Override
293295
public final void draw(Canvas canvas) {
296+
// NOTE: Maintain this carefully (see View.java)
297+
mPrivateFlags = (mPrivateFlags & ~PFLAG_DIRTY_MASK) | PFLAG_DRAWN;
298+
294299
applyUpdate();
295300
applyTransformMatrix();
296301
}
@@ -335,6 +340,10 @@ protected void destroyHardwareResources() {
335340

336341
@Override
337342
HardwareLayer getHardwareLayer() {
343+
// NOTE: Maintain these two lines very carefully (see View.java)
344+
mPrivateFlags |= PFLAG_DRAWN | PFLAG_DRAWING_CACHE_VALID;
345+
mPrivateFlags &= ~PFLAG_DIRTY_MASK;
346+
338347
if (mLayer == null) {
339348
if (mAttachInfo == null || mAttachInfo.mHardwareRenderer == null) {
340349
return null;
@@ -773,6 +782,7 @@ public static interface SurfaceTextureListener {
773782
* Invoked when the specified {@link SurfaceTexture} is about to be destroyed.
774783
* If returns true, no rendering should happen inside the surface texture after this method
775784
* is invoked. If returns false, the client needs to call {@link SurfaceTexture#release()}.
785+
* Most applications should return true.
776786
*
777787
* @param surface The surface about to be destroyed
778788
*/

0 commit comments

Comments
 (0)