Loading core/java/android/view/TextureView.java +14 −9 Original line number Original line Diff line number Diff line Loading @@ -189,7 +189,7 @@ public class TextureView extends View { if (opaque != mOpaque) { if (opaque != mOpaque) { mOpaque = opaque; mOpaque = opaque; if (mLayer != null) { if (mLayer != null) { updateLayer(); updateLayerAndInvalidate(); } } } } } } Loading Loading @@ -310,6 +310,7 @@ public class TextureView extends View { super.onSizeChanged(w, h, oldw, oldh); super.onSizeChanged(w, h, oldw, oldh); if (mSurface != null) { if (mSurface != null) { nSetDefaultBufferSize(mSurface, getWidth(), getHeight()); nSetDefaultBufferSize(mSurface, getWidth(), getHeight()); updateLayer(); if (mListener != null) { if (mListener != null) { mListener.onSurfaceTextureSizeChanged(mSurface, getWidth(), getHeight()); mListener.onSurfaceTextureSizeChanged(mSurface, getWidth(), getHeight()); } } Loading Loading @@ -352,9 +353,7 @@ public class TextureView extends View { public void onFrameAvailable(SurfaceTexture surfaceTexture) { public void onFrameAvailable(SurfaceTexture surfaceTexture) { // Per SurfaceTexture's documentation, the callback may be invoked // Per SurfaceTexture's documentation, the callback may be invoked // from an arbitrary thread // from an arbitrary thread synchronized (mLock) { updateLayer(); mUpdateLayer = true; } if (Looper.myLooper() == Looper.getMainLooper()) { if (Looper.myLooper() == Looper.getMainLooper()) { invalidate(); invalidate(); Loading @@ -379,9 +378,7 @@ public class TextureView extends View { // Since we are updating the layer, force an update to ensure its // Since we are updating the layer, force an update to ensure its // parameters are correct (width, height, transform, etc.) // parameters are correct (width, height, transform, etc.) synchronized (mLock) { updateLayer(); mUpdateLayer = true; } mMatrixChanged = true; mMatrixChanged = true; mAttachInfo.mHardwareRenderer.setSurfaceTexture(mLayer, mSurface); mAttachInfo.mHardwareRenderer.setSurfaceTexture(mLayer, mSurface); Loading @@ -404,7 +401,7 @@ public class TextureView extends View { // updates listener // updates listener if (visibility == VISIBLE) { if (visibility == VISIBLE) { mSurface.setOnFrameAvailableListener(mUpdateListener); mSurface.setOnFrameAvailableListener(mUpdateListener); updateLayer(); updateLayerAndInvalidate(); } else { } else { mSurface.setOnFrameAvailableListener(null); mSurface.setOnFrameAvailableListener(null); } } Loading @@ -412,7 +409,15 @@ public class TextureView extends View { } } private void updateLayer() { private void updateLayer() { synchronized (mLock) { mUpdateLayer = true; mUpdateLayer = true; } } private void updateLayerAndInvalidate() { synchronized (mLock) { mUpdateLayer = true; } invalidate(); invalidate(); } } Loading Loading
core/java/android/view/TextureView.java +14 −9 Original line number Original line Diff line number Diff line Loading @@ -189,7 +189,7 @@ public class TextureView extends View { if (opaque != mOpaque) { if (opaque != mOpaque) { mOpaque = opaque; mOpaque = opaque; if (mLayer != null) { if (mLayer != null) { updateLayer(); updateLayerAndInvalidate(); } } } } } } Loading Loading @@ -310,6 +310,7 @@ public class TextureView extends View { super.onSizeChanged(w, h, oldw, oldh); super.onSizeChanged(w, h, oldw, oldh); if (mSurface != null) { if (mSurface != null) { nSetDefaultBufferSize(mSurface, getWidth(), getHeight()); nSetDefaultBufferSize(mSurface, getWidth(), getHeight()); updateLayer(); if (mListener != null) { if (mListener != null) { mListener.onSurfaceTextureSizeChanged(mSurface, getWidth(), getHeight()); mListener.onSurfaceTextureSizeChanged(mSurface, getWidth(), getHeight()); } } Loading Loading @@ -352,9 +353,7 @@ public class TextureView extends View { public void onFrameAvailable(SurfaceTexture surfaceTexture) { public void onFrameAvailable(SurfaceTexture surfaceTexture) { // Per SurfaceTexture's documentation, the callback may be invoked // Per SurfaceTexture's documentation, the callback may be invoked // from an arbitrary thread // from an arbitrary thread synchronized (mLock) { updateLayer(); mUpdateLayer = true; } if (Looper.myLooper() == Looper.getMainLooper()) { if (Looper.myLooper() == Looper.getMainLooper()) { invalidate(); invalidate(); Loading @@ -379,9 +378,7 @@ public class TextureView extends View { // Since we are updating the layer, force an update to ensure its // Since we are updating the layer, force an update to ensure its // parameters are correct (width, height, transform, etc.) // parameters are correct (width, height, transform, etc.) synchronized (mLock) { updateLayer(); mUpdateLayer = true; } mMatrixChanged = true; mMatrixChanged = true; mAttachInfo.mHardwareRenderer.setSurfaceTexture(mLayer, mSurface); mAttachInfo.mHardwareRenderer.setSurfaceTexture(mLayer, mSurface); Loading @@ -404,7 +401,7 @@ public class TextureView extends View { // updates listener // updates listener if (visibility == VISIBLE) { if (visibility == VISIBLE) { mSurface.setOnFrameAvailableListener(mUpdateListener); mSurface.setOnFrameAvailableListener(mUpdateListener); updateLayer(); updateLayerAndInvalidate(); } else { } else { mSurface.setOnFrameAvailableListener(null); mSurface.setOnFrameAvailableListener(null); } } Loading @@ -412,7 +409,15 @@ public class TextureView extends View { } } private void updateLayer() { private void updateLayer() { synchronized (mLock) { mUpdateLayer = true; mUpdateLayer = true; } } private void updateLayerAndInvalidate() { synchronized (mLock) { mUpdateLayer = true; } invalidate(); invalidate(); } } Loading