Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4a4e2c1a authored by Romain Guy's avatar Romain Guy Committed by Android Git Automerger
Browse files

am 5075f8e3: Merge "Update TextureView\'s layer on size change Bug #7171323" into jb-mr1-dev

* commit '5075f8e3':
  Update TextureView's layer on size change Bug #7171323
parents 513b8ea1 5075f8e3
Loading
Loading
Loading
Loading
+14 −9
Original line number Original line Diff line number Diff line
@@ -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();
            }
            }
        }
        }
    }
    }
@@ -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());
            }
            }
@@ -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();
@@ -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);
@@ -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);
            }
            }
@@ -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();
    }
    }