Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
surface.cc File Reference

Go to the source code of this file.

Namespaces

namespace  flutter
 
namespace  flutter::gpu
 

Functions

 flutter::gpu::IMPLEMENT_WRAPPERTYPEINFO (flutter_gpu, Surface)
 
Dart_Handle InternalFlutterGpu_Surface_Initialize (Dart_Handle wrapper, flutter::gpu::Context *gpu_context, int width, int height, int format)
 
int InternalFlutterGpu_Surface_AcquireNextFrame (flutter::gpu::Surface *wrapper, Dart_Handle texture_wrapper)
 
Dart_Handle InternalFlutterGpu_Surface_PresentFrame (flutter::gpu::Surface *wrapper, int texture_index, flutter::gpu::CommandBuffer *command_buffer)
 
void InternalFlutterGpu_Surface_DiscardFrame (flutter::gpu::Surface *wrapper, int texture_index)
 
Dart_Handle InternalFlutterGpu_Surface_GetCurrentImage (flutter::gpu::Surface *wrapper)
 
Dart_Handle InternalFlutterGpu_Surface_Resize (flutter::gpu::Surface *wrapper, int width, int height)
 
int InternalFlutterGpu_Surface_GetBackingTextureCount (flutter::gpu::Surface *wrapper)
 

Function Documentation

◆ InternalFlutterGpu_Surface_AcquireNextFrame()

int InternalFlutterGpu_Surface_AcquireNextFrame ( flutter::gpu::Surface wrapper,
Dart_Handle  texture_wrapper 
)

Definition at line 276 of file surface.cc.

277 {
278 return wrapper->AcquireNextFrame(texture_wrapper);
279}
int AcquireNextFrame(Dart_Handle texture_wrapper)
Definition surface.cc:124

References flutter::gpu::Surface::AcquireNextFrame().

◆ InternalFlutterGpu_Surface_DiscardFrame()

void InternalFlutterGpu_Surface_DiscardFrame ( flutter::gpu::Surface wrapper,
int  texture_index 
)

Definition at line 292 of file surface.cc.

293 {
294 if (texture_index < 0) {
295 return;
296 }
297 wrapper->DiscardFrame(static_cast<size_t>(texture_index));
298}
void DiscardFrame(size_t texture_index)
Definition surface.cc:199

References flutter::gpu::Surface::DiscardFrame().

◆ InternalFlutterGpu_Surface_GetBackingTextureCount()

int InternalFlutterGpu_Surface_GetBackingTextureCount ( flutter::gpu::Surface wrapper)

Definition at line 318 of file surface.cc.

319 {
320 return static_cast<int>(wrapper->GetBackingTextureCount());
321}
size_t GetBackingTextureCount() const
Definition surface.cc:233

References flutter::gpu::Surface::GetBackingTextureCount().

◆ InternalFlutterGpu_Surface_GetCurrentImage()

Dart_Handle InternalFlutterGpu_Surface_GetCurrentImage ( flutter::gpu::Surface wrapper)

Definition at line 300 of file surface.cc.

301 {
302 return wrapper->GetCurrentImage();
303}
Dart_Handle GetCurrentImage() const
Definition surface.cc:209

References flutter::gpu::Surface::GetCurrentImage().

◆ InternalFlutterGpu_Surface_Initialize()

Dart_Handle InternalFlutterGpu_Surface_Initialize ( Dart_Handle  wrapper,
flutter::gpu::Context gpu_context,
int  width,
int  height,
int  format 
)

Exports

Definition at line 250 of file surface.cc.

255 {
256 if (width <= 0 || height <= 0) {
257 return tonic::ToDart("GpuSurface dimensions must be greater than zero.");
258 }
259
260#if !IMPELLER_SUPPORTS_RENDERING
261 return tonic::ToDart("GpuSurface requires Impeller rendering support.");
262#else
263 auto pixel_format = flutter::gpu::ToImpellerPixelFormat(format);
264 if (pixel_format == impeller::PixelFormat::kUnknown) {
265 return tonic::ToDart("Unsupported GpuSurface pixel format.");
266 }
267
268 auto res = fml::MakeRefCounted<flutter::gpu::Surface>(
269 gpu_context->GetContextShared(), impeller::ISize{width, height},
270 pixel_format);
271 res->AssociateWithDartWrapper(wrapper);
272 return Dart_Null();
273#endif
274}
std::shared_ptr< impeller::Context > & GetContextShared()
Definition context.cc:91
constexpr impeller::PixelFormat ToImpellerPixelFormat(FlutterGPUPixelFormat value)
Definition formats.h:104
Dart_Handle ToDart(const T &object)
int32_t height
int32_t width

References format, height, impeller::kUnknown, tonic::ToDart(), flutter::gpu::ToImpellerPixelFormat(), and width.

◆ InternalFlutterGpu_Surface_PresentFrame()

Dart_Handle InternalFlutterGpu_Surface_PresentFrame ( flutter::gpu::Surface wrapper,
int  texture_index,
flutter::gpu::CommandBuffer command_buffer 
)

Definition at line 281 of file surface.cc.

284 {
285 if (texture_index < 0) {
286 return tonic::ToDart("Invalid SurfaceFrame texture index.");
287 }
288 return wrapper->PresentFrame(static_cast<size_t>(texture_index),
290}
Dart_Handle PresentFrame(size_t texture_index, CommandBuffer &command_buffer)
Definition surface.cc:168
std::shared_ptr< CommandBuffer > command_buffer

References command_buffer, flutter::gpu::Surface::PresentFrame(), and tonic::ToDart().

◆ InternalFlutterGpu_Surface_Resize()

Dart_Handle InternalFlutterGpu_Surface_Resize ( flutter::gpu::Surface wrapper,
int  width,
int  height 
)

Definition at line 305 of file surface.cc.

307 {
308 if (width <= 0 || height <= 0) {
309 return tonic::ToDart("GpuSurface dimensions must be greater than zero.");
310 }
311 auto error = wrapper->Resize(impeller::ISize{width, height});
312 if (error.has_value()) {
313 return tonic::ToDart(error.value());
314 }
315 return Dart_Null();
316}
std::optional< std::string > Resize(impeller::ISize size)
Definition surface.cc:221
const uint8_t uint32_t uint32_t GError ** error

References error, height, flutter::gpu::Surface::Resize(), tonic::ToDart(), and width.