24 return transaction_.is_valid();
37 callback = [](
auto) {};
42 auto data = std::make_unique<TransactionInFlightData>();
43 data->callback = callback;
44 proc_table.ASurfaceTransaction_setOnComplete(
45 transaction_.get().tx,
47 [](
void* context, ASurfaceTransactionStats* stats) ->
void {
48 auto data = reinterpret_cast<TransactionInFlightData*>(context);
49 data->callback(stats);
55 if (!transaction_.get().owned) {
60 proc_table.ASurfaceTransaction_apply(transaction_.get().tx);
69 fml::UniqueFD acquire_fence) {
70 if (control ==
nullptr || buffer ==
nullptr) {
75 transaction_.get().tx,
78 acquire_fence.is_valid() ? acquire_fence.release() : -1
88 GetProcTable().ASurfaceTransaction_setColor(transaction_.get().tx,
94 ADATASPACE_SRGB_LINEAR
104 if (new_parent && !new_parent->
IsValid()) {
108 transaction_.get().tx,
110 new_parent ==
nullptr ?
nullptr : new_parent->
GetHandle()
117 GetProcTable().ASurfaceTransaction_create.IsAvailable();
A wrapper for AHardwareBuffer https://developer.android.com/ndk/reference/group/a-hardware-buffer.
AHardwareBuffer * GetHandle() const
A wrapper for ASurfaceControl. https://developer.android.com/ndk/reference/group/native-activity#asur...
ASurfaceControl * GetHandle() const
bool SetContents(const SurfaceControl *control, const HardwareBuffer *buffer, fml::UniqueFD acquire_fence={})
Encodes that the updated contents of a surface control are specified by the given hardware buffer....
std::function< void(ASurfaceTransactionStats *)> OnCompleteCallback
bool Apply(OnCompleteCallback callback=nullptr)
Applies the updated encoded in the transaction and invokes the callback when the updated are complete...
bool SetBackgroundColor(const SurfaceControl &control, const Color &color)
Encodes the updated background color of the surface control. The update will not be committed till th...
bool SetParent(const SurfaceControl &control, const SurfaceControl *new_parent=nullptr)
Set the new parent control of the given control. If the new parent is null, it is removed from the co...
static bool IsAvailableOnPlatform()
const ProcTable & GetProcTable()
bool IsValid() const
If a valid proc table could be setup. This may fail in case of setup on non-Android platforms.
SurfaceTransaction::OnCompleteCallback callback
A wrapper class that indicates whether a SurfaceTransaction was created by the flutter engine or was ...
std::shared_ptr< const fml::Mapping > data