Package io.flutter.embedding.engine.renderer

# Class SurfaceTextureWrapper

java.lang.Object
io.flutter.embedding.engine.renderer.SurfaceTextureWrapper

public class SurfaceTextureWrapper extends Object
A wrapper for a SurfaceTexture that tracks whether the texture has been released.

The engine calls `SurfaceTexture.release` on the platform thread, but `updateTexImage` is called on the raster thread. This wrapper will prevent `updateTexImage` calls on an abandoned texture.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SurfaceTextureWrapper(SurfaceTexture surfaceTexture)`
  `SurfaceTextureWrapper(SurfaceTexture surfaceTexture, Runnable onFrameConsumed)`
  A wrapper for a SurfaceTexture.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `attachToGLContext(int texName)`
  `void`
  `detachFromGLContext()`
  `void`
  `getTransformMatrix(float[] mtx)`
  `void`
  `markDirty()`
  `void`
  `release()`
  `boolean`
  `shouldUpdate()`
  `SurfaceTexture`
  `surfaceTexture()`
  `void`
  `updateTexImage()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### SurfaceTextureWrapper

    public SurfaceTextureWrapper(@NonNull SurfaceTexture surfaceTexture)

  - ### SurfaceTextureWrapper

    public SurfaceTextureWrapper(@NonNull SurfaceTexture surfaceTexture, @Nullable Runnable onFrameConsumed)
    A wrapper for a SurfaceTexture.

    The provided `onFrameConsumed` callback must be invoked when the most recent image was consumed.

    Parameters:
      `onFrameConsumed` - The callback after the `updateTexImage` is called.

- ## Method Details

  - ### surfaceTexture

    @NonNull public SurfaceTexture surfaceTexture()

  - ### markDirty

    public void markDirty()

  - ### shouldUpdate

    public boolean shouldUpdate()

  - ### updateTexImage

    public void updateTexImage()

  - ### release

    public void release()

  - ### attachToGLContext

    public void attachToGLContext(int texName)

  - ### detachFromGLContext

    public void detachFromGLContext()

  - ### getTransformMatrix

    public void getTransformMatrix(@NonNull float[] mtx)