 |
Flutter Impeller
|
|
Go to the documentation of this file.
5 #ifndef FLUTTER_IMPELLER_TOOLKIT_ANDROID_HARDWARE_BUFFER_H_
6 #define FLUTTER_IMPELLER_TOOLKIT_ANDROID_HARDWARE_BUFFER_H_
10 #include "flutter/fml/unique_fd.h"
11 #include "flutter/fml/unique_object.h"
115 static std::optional<AHardwareBuffer_Desc>
Describe(AHardwareBuffer* buffer);
159 struct UniqueAHardwareBufferTraits {
160 static AHardwareBuffer* InvalidValue() {
return nullptr; }
162 static bool IsValid(AHardwareBuffer* value) {
163 return value != InvalidValue();
166 static void Free(AHardwareBuffer* value) {
171 const HardwareBufferDescriptor descriptor_;
172 const AHardwareBuffer_Desc android_descriptor_;
173 fml::UniqueObject<AHardwareBuffer*, UniqueAHardwareBufferTraits> buffer_;
174 bool is_valid_ =
false;
185 #endif // FLUTTER_IMPELLER_TOOLKIT_ANDROID_HARDWARE_BUFFER_H_
static bool IsAvailableOnPlatform()
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...
void * Lock(CPUAccessType type) const
Lock the buffer for CPU access. This call may fail if the buffer was not created with one the usages ...
const HardwareBufferDescriptor & GetDescriptor() const
HardwareBuffer & operator=(const HardwareBuffer &)=delete
static HardwareBufferDescriptor MakeForSwapchainImage(const ISize &size)
Create a descriptor of the given size that is suitable for use as a swapchain image.
A wrapper for AHardwareBuffer https://developer.android.com/ndk/reference/group/a-hardware-buffer.
constexpr bool operator!=(const HardwareBufferDescriptor &o) const
constexpr bool operator==(const HardwareBufferDescriptor &o) const
A descriptor use to specify hardware buffer allocations.
AHardwareBuffer * GetHandle() const
static std::optional< AHardwareBuffer_Desc > Describe(AHardwareBuffer *buffer)
HardwareBufferUsage usage
HardwareBuffer(HardwareBufferDescriptor descriptor)
const ProcTable & GetProcTable()
HardwareBufferFormat format
bool Unlock() const
Unlock a mapping previously locked for CPU access.
bool IsAllocatable() const
If hardware buffers can be created using this descriptor. Allocatable descriptors may still cause fai...
const AHardwareBuffer_Desc & GetAndroidDescriptor() const
IMPELLER_ENUM_IS_MASK(MyMaskBits)