20G_DEFINE_TYPE(FlCompositorSoftware, fl_compositor_software, G_TYPE_OBJECT)
23 FlCompositorSoftware*
self = FL_COMPOSITOR_SOFTWARE(
object);
25 if (
self->surface !=
nullptr) {
26 g_free(cairo_image_surface_get_data(
self->surface));
28 g_clear_pointer(&
self->surface, cairo_surface_destroy);
30 G_OBJECT_CLASS(fl_compositor_software_parent_class)->dispose(
object);
34 FlCompositorSoftwareClass* klass) {
41 return FL_COMPOSITOR_SOFTWARE(
42 g_object_new(fl_compositor_software_get_type(),
nullptr));
62 size_t allocation_length =
64 unsigned char* old_data =
self->surface !=
nullptr
65 ? cairo_image_surface_get_data(
self->surface)
68 static_cast<unsigned char*
>(g_realloc(old_data, allocation_length));
70 cairo_surface_destroy(
self->surface);
71 self->surface = cairo_image_surface_create_for_data(
82 if (
width !=
nullptr) {
93 if (
self->surface ==
nullptr) {
97 cairo_surface_set_device_scale(
self->surface, scale_factor, scale_factor);
98 cairo_set_source_surface(cr,
self->surface, 0.0, 0.0);
@ kFlutterLayerContentTypeBackingStore
@ kFlutterBackingStoreTypeSoftware
Specified an software allocation for Flutter to render into using the CPU.
G_DEFINE_TYPE(FlBasicMessageChannelResponseHandle, fl_basic_message_channel_response_handle, G_TYPE_OBJECT) static void fl_basic_message_channel_response_handle_dispose(GObject *object)
gboolean fl_compositor_software_render(FlCompositorSoftware *self, cairo_t *cr, gint scale_factor)
FlCompositorSoftware * fl_compositor_software_new()
static void fl_compositor_software_class_init(FlCompositorSoftwareClass *klass)
static void fl_compositor_software_init(FlCompositorSoftware *self)
void fl_compositor_software_get_frame_size(FlCompositorSoftware *self, size_t *width, size_t *height)
gboolean fl_compositor_software_composite_layers(FlCompositorSoftware *self, const FlutterLayer **layers, size_t layers_count)
static void fl_compositor_software_dispose(GObject *object)
const FlutterLayer size_t layers_count
const FlutterLayer ** layers
cairo_surface_t * surface
FlutterBackingStoreType type
Specifies the type of backing store.
FlutterSoftwareBackingStore software
The description of the software backing store.
FlutterLayerContentType type
const FlutterBackingStore * backing_store
FlutterSize size
The size of the layer (in physical pixels).
size_t row_bytes
The number of bytes in a single row of the allocation.
size_t height
The number of rows in the allocation.