5#ifndef FLUTTER_IMPELLER_TOOLKIT_ANDROID_HARDWARE_BUFFER_H_
6#define FLUTTER_IMPELLER_TOOLKIT_ANDROID_HARDWARE_BUFFER_H_
109 static std::optional<AHardwareBuffer_Desc>
Describe(AHardwareBuffer* buffer);
153 struct UniqueAHardwareBufferTraits {
154 static AHardwareBuffer* InvalidValue() {
return nullptr; }
156 static bool IsValid(AHardwareBuffer* value) {
157 return value != InvalidValue();
160 static void Free(AHardwareBuffer* value) {
165 const HardwareBufferDescriptor descriptor_;
166 const AHardwareBuffer_Desc android_descriptor_;
168 bool is_valid_ =
false;
A wrapper for AHardwareBuffer https://developer.android.com/ndk/reference/group/a-hardware-buffer.
HardwareBuffer & operator=(const HardwareBuffer &)=delete
static bool IsAvailableOnPlatform()
const HardwareBufferDescriptor & GetDescriptor() const
AHardwareBuffer * GetHandle() const
const AHardwareBuffer_Desc & GetAndroidDescriptor() const
bool Unlock() const
Unlock a mapping previously locked for CPU access.
static std::optional< AHardwareBuffer_Desc > Describe(AHardwareBuffer *buffer)
HardwareBuffer(const HardwareBuffer &)=delete
std::optional< uint64_t > GetSystemUniqueID() const
Get the system wide unique ID of the hardware buffer if possible. This is only available on Android A...
#define IMPELLER_ENUM_IS_MASK(enum_name)
Declare this in the "impeller" namespace to make the enum maskable.
const ProcTable & GetProcTable()
A descriptor use to specify hardware buffer allocations.
static HardwareBufferDescriptor MakeForSwapchainImage(const ISize &size)
Create a descriptor of the given size that is suitable for use as a swapchain image.
HardwareBufferUsage usage
bool IsAllocatable() const
If hardware buffers can be created using this descriptor. Allocatable descriptors may still cause fai...
HardwareBufferFormat format
constexpr bool operator==(const HardwareBufferDescriptor &o) const =default