FakeHardwareBufferNativeHelpers


@RequiresApi(value = 26)
@ExperimentalApi
public class FakeHardwareBufferNativeHelpers implements HardwareBufferNativeHelpers


Fake class to simulate HardwareBufferNativeHelpers.

Summary

Public fields

boolean

Whether the operations should succeed.

Public constructors

Public methods

boolean

Copies a Bitmap to a HardwareBuffer.

boolean

Copies the contents of a source HardwareBuffer to a destination HardwareBuffer.

Public fields

shouldSucceed

public boolean shouldSucceed

Whether the operations should succeed.

Public constructors

FakeHardwareBufferNativeHelpers

public FakeHardwareBufferNativeHelpers()

Public methods

nativeCopyBitmapToHardwareBuffer

public boolean nativeCopyBitmapToHardwareBuffer(Bitmap bitmap, HardwareBuffer hb)

Copies a Bitmap to a HardwareBuffer.

The destination HardwareBuffer must have USAGE_CPU_WRITE_OFTEN usage.

The source Bitmap.Config must match the destination getFormat, and be either ARGB_8888 and RGBA_8888 or RGBA_1010102 and RGBA_1010102.

Parameters
Bitmap bitmap

The source bitmap.

HardwareBuffer hb

The destination hardware buffer.

Returns
boolean

Whether the copy is successful.

nativeCopyHardwareBufferToHardwareBuffer

public boolean nativeCopyHardwareBufferToHardwareBuffer(
    HardwareBuffer srcHb,
    HardwareBuffer dstHb
)

Copies the contents of a source HardwareBuffer to a destination HardwareBuffer.

The source HardwareBuffer must have USAGE_CPU_READ_OFTEN usage, and the destination HardwareBuffer must have USAGE_CPU_WRITE_OFTEN usage.

The formats of the source and destination buffers must match, and be either RGBA_8888 or RGBA_1010102.

Parameters
HardwareBuffer srcHb

The source hardware buffer.

HardwareBuffer dstHb

The destination hardware buffer.

Returns
boolean

Whether the copy is successful.