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

Commit 52c145ff authored by Romain Guy's avatar Romain Guy
Browse files

Call invalidate() immediately when a frame is available

This change ensures that applications producing surface texture updates
at a steady rate will display the updates on screen at the same rate,
v-synced.

Change-Id: I663685b34d12809fbf8945c44851e30a2052ce74
parent 9cb376e7
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
import android.os.Looper;
import android.util.AttributeSet;
import android.util.Log;

@@ -353,8 +354,13 @@ public class TextureView extends View {
                    synchronized (mLock) {
                        mUpdateLayer = true;
                    }

                    if (Looper.myLooper() == Looper.getMainLooper()) {
                        invalidate();
                    } else {
                        postInvalidate();
                    }
                }
            };
            mSurface.setOnFrameAvailableListener(mUpdateListener);