27 fl_compositor_software,
28 fl_compositor_get_type())
30static gboolean fl_compositor_software_present_layers(
31 FlCompositor* compositor,
34 FlCompositorSoftware*
self = FL_COMPOSITOR_SOFTWARE(compositor);
36 g_autoptr(GMutexLocker) locker = g_mutex_locker_new(&
self->frame_mutex);
52 size_t allocation_length =
54 unsigned char* old_data =
self->surface !=
nullptr
55 ? cairo_image_surface_get_data(
self->surface)
58 static_cast<unsigned char*
>(realloc(old_data, allocation_length));
60 cairo_surface_destroy(
self->surface);
61 self->surface = cairo_image_surface_create_for_data(
74 FlCompositorSoftware*
self = FL_COMPOSITOR_SOFTWARE(compositor);
76 g_autoptr(GMutexLocker) locker = g_mutex_locker_new(&
self->frame_mutex);
78 if (
self->surface ==
nullptr) {
87 g_mutex_unlock(&
self->frame_mutex);
89 g_mutex_lock(&
self->frame_mutex);
92 cairo_surface_set_device_scale(
self->surface, scale_factor, scale_factor);
93 cairo_set_source_surface(cr,
self->surface, 0.0, 0.0);
100 FlCompositorSoftware*
self = FL_COMPOSITOR_SOFTWARE(
object);
102 g_clear_object(&
self->task_runner);
103 if (
self->surface !=
nullptr) {
104 free(cairo_image_surface_get_data(
self->surface));
106 g_clear_pointer(&
self->surface, cairo_surface_destroy);
107 g_mutex_clear(&
self->frame_mutex);
109 G_OBJECT_CLASS(fl_compositor_software_parent_class)->dispose(
object);
113 FlCompositorSoftwareClass* klass) {
114 FL_COMPOSITOR_CLASS(klass)->present_layers =
115 fl_compositor_software_present_layers;
122 g_mutex_init(&
self->frame_mutex);
126 FlCompositorSoftware*
self = FL_COMPOSITOR_SOFTWARE(
127 g_object_new(fl_compositor_software_get_type(),
nullptr));
128 self->task_runner = FL_TASK_RUNNER(g_object_ref(task_runner));
@ kFlutterLayerContentTypeBackingStore
@ kFlutterBackingStoreTypeSoftware
Specified an software allocation for Flutter to render into using the CPU.
const FlutterLayer size_t layers_count
const FlutterLayer ** layers
FlCompositorSoftware * fl_compositor_software_new(FlTaskRunner *task_runner)
static gboolean fl_compositor_software_render(FlCompositor *compositor, cairo_t *cr, GdkWindow *window)
g_autoptr(GMutexLocker) locker
static void fl_compositor_software_class_init(FlCompositorSoftwareClass *klass)
G_DEFINE_TYPE(FlCompositorSoftware, fl_compositor_software, fl_compositor_get_type()) static gboolean fl_compositor_software_present_layers(FlCompositor *compositor
static void fl_compositor_software_init(FlCompositorSoftware *self)
fl_task_runner_stop_wait(self->task_runner)
static void fl_compositor_software_dispose(GObject *object)
void fl_task_runner_wait(FlTaskRunner *self)
int gdk_window_get_width(GdkWindow *window)
gint gdk_window_get_scale_factor(GdkWindow *window)
int gdk_window_get_height(GdkWindow *window)
FlTaskRunner * task_runner
FlCompositor parent_instance
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.
std::shared_ptr< const fml::Mapping > data