LowLatencyCanvasView.Callback


public interface LowLatencyCanvasView.Callback


Provides callbacks for consumers to draw into the front buffered overlay as well as provide opportunities to synchronize SurfaceControlCompat.Transactions to submit the layers to the hardware compositor

Summary

Public methods

abstract void
@WorkerThread
onDrawFrontBufferedLayer(@NonNull Canvas canvas, int width, int height)

Callback invoked to render content into the front buffered layer with the specified parameters.

default void

Optional callback invoked when rendering to the front buffered layer is complete but before the buffers are submitted to the hardware compositor.

abstract void
@WorkerThread
onRedrawRequested(@NonNull Canvas canvas, int width, int height)

Callback invoked when the entire scene should be re-rendered.

Public methods

onDrawFrontBufferedLayer

Added in 1.0.0-rc01
@WorkerThread
abstract void onDrawFrontBufferedLayer(@NonNull Canvas canvas, int width, int height)

Callback invoked to render content into the front buffered layer with the specified parameters.

Parameters
@NonNull Canvas canvas

Canvas used to issue drawing instructions into the front buffered layer

int width

Logical width of the content that is being rendered.

int height

Logical height of the content that is being rendered.

onFrontBufferedLayerRenderComplete

Added in 1.0.0-rc01
@WorkerThread
default void onFrontBufferedLayerRenderComplete(
    @NonNull SurfaceControlCompat frontBufferedLayerSurfaceControl,
    @NonNull SurfaceControlCompat.Transaction transaction
)

Optional callback invoked when rendering to the front buffered layer is complete but before the buffers are submitted to the hardware compositor. This provides consumers a mechanism for synchronizing the transaction with other SurfaceControlCompat objects that maybe rendered within the scene.

Parameters
@NonNull SurfaceControlCompat frontBufferedLayerSurfaceControl

Handle to the SurfaceControlCompat where the front buffered layer content is drawn. This can be used to configure various properties of the SurfaceControlCompat like z-ordering or visibility with the corresponding SurfaceControlCompat.Transaction.

@NonNull SurfaceControlCompat.Transaction transaction

Current SurfaceControlCompat.Transaction to apply updated buffered content to the front buffered layer.

onRedrawRequested

Added in 1.0.0-rc01
@WorkerThread
abstract void onRedrawRequested(@NonNull Canvas canvas, int width, int height)

Callback invoked when the entire scene should be re-rendered. This is invoked during initialization and when the corresponding Activity is resumed from a background state.

Parameters
@NonNull Canvas canvas

Canvas used to issue drawing instructions into the front buffered layer

int width

Logical width of the content that is being rendered.

int height

Logical height of the content that is being rendered.