Flutter Linux Embedder
fl_compositor_software.cc File Reference

Go to the source code of this file.

Classes

struct  _FlCompositorSoftware
 

Functions

 G_DEFINE_TYPE (FlCompositorSoftware, fl_compositor_software, fl_compositor_get_type()) static gboolean fl_compositor_software_present_layers(FlCompositor *compositor
 
 g_autoptr (GMutexLocker) locker
 
 if (layers_count==0)
 
 fl_task_runner_stop_wait (self->task_runner)
 
static gboolean fl_compositor_software_render (FlCompositor *compositor, cairo_t *cr, GdkWindow *window)
 
static void fl_compositor_software_dispose (GObject *object)
 
static void fl_compositor_software_class_init (FlCompositorSoftwareClass *klass)
 
static void fl_compositor_software_init (FlCompositorSoftware *self)
 
FlCompositorSoftware * fl_compositor_software_new (FlTaskRunner *task_runner)
 

Variables

const FlutterLayer ** layers
 
const FlutterLayer size_t layers_count
 
self width = layers[0]->size.width
 
self height = layers[0]->size.height
 
return TRUE
 

Function Documentation

◆ fl_compositor_software_class_init()

static void fl_compositor_software_class_init ( FlCompositorSoftwareClass *  klass)
static

Definition at line 112 of file fl_compositor_software.cc.

113  {
114  FL_COMPOSITOR_CLASS(klass)->present_layers =
115  fl_compositor_software_present_layers;
116  FL_COMPOSITOR_CLASS(klass)->render = fl_compositor_software_render;
117 
118  G_OBJECT_CLASS(klass)->dispose = fl_compositor_software_dispose;
119 }
static gboolean fl_compositor_software_render(FlCompositor *compositor, cairo_t *cr, GdkWindow *window)
static void fl_compositor_software_dispose(GObject *object)

References fl_compositor_software_dispose(), and fl_compositor_software_render().

◆ fl_compositor_software_dispose()

static void fl_compositor_software_dispose ( GObject *  object)
static

Definition at line 99 of file fl_compositor_software.cc.

99  {
100  FlCompositorSoftware* self = FL_COMPOSITOR_SOFTWARE(object);
101 
102  g_clear_object(&self->task_runner);
103  if (self->surface != nullptr) {
104  free(cairo_image_surface_get_data(self->surface));
105  }
106  g_clear_pointer(&self->surface, cairo_surface_destroy);
107  g_mutex_clear(&self->frame_mutex);
108 
109  G_OBJECT_CLASS(fl_compositor_software_parent_class)->dispose(object);
110 }

Referenced by fl_compositor_software_class_init().

◆ fl_compositor_software_init()

static void fl_compositor_software_init ( FlCompositorSoftware *  self)
static

Definition at line 121 of file fl_compositor_software.cc.

121  {
122  g_mutex_init(&self->frame_mutex);
123 }

◆ fl_compositor_software_new()

FlCompositorSoftware* fl_compositor_software_new ( FlTaskRunner *  task_runner)

Definition at line 125 of file fl_compositor_software.cc.

125  {
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));
129  return self;
130 }

Referenced by setup_software(), and TEST().

◆ fl_compositor_software_render()

static gboolean fl_compositor_software_render ( FlCompositor *  compositor,
cairo_t *  cr,
GdkWindow *  window 
)
static

Definition at line 71 of file fl_compositor_software.cc.

73  {
74  FlCompositorSoftware* self = FL_COMPOSITOR_SOFTWARE(compositor);
75 
76  g_autoptr(GMutexLocker) locker = g_mutex_locker_new(&self->frame_mutex);
77 
78  if (self->surface == nullptr) {
79  return FALSE;
80  }
81 
82  // If frame not ready, then wait for it.
83  gint scale_factor = gdk_window_get_scale_factor(window);
84  size_t width = gdk_window_get_width(window) * scale_factor;
85  size_t height = gdk_window_get_height(window) * scale_factor;
86  while (self->width != width || self->height != height) {
87  g_mutex_unlock(&self->frame_mutex);
88  fl_task_runner_wait(self->task_runner);
89  g_mutex_lock(&self->frame_mutex);
90  }
91 
92  cairo_surface_set_device_scale(self->surface, scale_factor, scale_factor);
93  cairo_set_source_surface(cr, self->surface, 0.0, 0.0);
94  cairo_paint(cr);
95 
96  return TRUE;
97 }
self height
g_autoptr(GMutexLocker) locker
self width
return TRUE
void fl_task_runner_wait(FlTaskRunner *self)

References fl_task_runner_wait(), g_autoptr(), height, TRUE, and width.

Referenced by fl_compositor_software_class_init().

◆ fl_task_runner_stop_wait()

fl_task_runner_stop_wait ( self->  task_runner)

◆ g_autoptr()

g_autoptr ( GMutexLocker  )

◆ G_DEFINE_TYPE()

G_DEFINE_TYPE ( FlCompositorSoftware  ,
fl_compositor_software  ,
fl_compositor_get_type()   
)

◆ if()

if ( layers_count  = = 0)

Definition at line 38 of file fl_compositor_software.cc.

38  {
39  return TRUE;
40  }

References TRUE.

Variable Documentation

◆ height

◆ layers

◆ layers_count

const FlutterLayer size_t layers_count
Initial value:
{
FlCompositorSoftware* self = FL_COMPOSITOR_SOFTWARE(compositor)

Definition at line 33 of file fl_compositor_software.cc.

Referenced by fl_compositor_opengl_present_layers(), fl_compositor_present_layers(), fl_renderable_present_layers(), and fl_view_present_layers().

◆ TRUE

return TRUE

Definition at line 68 of file fl_compositor_software.cc.

Referenced by announcement_cb(), channel_closed_cb(), check_size(), complete_handle_event(), create_settings(), delete_event_cb(), ensure_pointer_added(), event_is_redispatched(), fl_accessible_node_do_action(), fl_accessible_text_field_add_selection(), fl_accessible_text_field_remove_selection(), fl_accessible_text_field_set_caret_offset(), fl_accessible_text_field_set_selection(), fl_application_create_window(), fl_application_local_command_line(), fl_binary_messenger_handle_message(), fl_compositor_opengl_present_layers(), fl_compositor_opengl_render(), fl_compositor_software_render(), fl_engine_send_key_event_finish(), fl_engine_send_platform_message_response(), fl_engine_start(), fl_event_channel_send(), fl_event_channel_send_end_of_stream(), fl_event_channel_send_error(), fl_gnome_settings_get_enable_animations(), fl_json_method_codec_decode_method_call(), fl_key_channel_responder_handle_event_finish(), fl_key_embedder_responder_handle_event_finish(), fl_key_embedder_responder_handle_event_impl(), fl_key_event_channel_send_finish(), fl_keyboard_manager_handle_event(), fl_method_call_respond(), fl_pixel_buffer_texture_populate(), fl_platform_channel_system_request_app_exit_finish(), fl_pointer_manager_handle_button_press(), fl_pointer_manager_handle_button_release(), fl_pointer_manager_handle_enter(), fl_pointer_manager_handle_leave(), fl_pointer_manager_handle_motion(), fl_scrolling_manager_handle_rotation_begin(), fl_scrolling_manager_handle_scroll_event(), fl_scrolling_manager_handle_zoom_begin(), fl_standard_message_codec_read_size(), fl_standard_message_codec_read_value_of_type(), fl_standard_message_codec_real_write_value(), fl_standard_method_codec_decode_method_call(), fl_test_application_activate(), fl_test_codec_decode_method_call(), fl_test_texture_populate(), fl_text_input_handler_filter_keypress(), fl_texture_gl_populate(), fl_view_accessible_handle_update_semantics(), fl_view_init(), G_DEFINE_TYPE(), G_DEFINE_TYPE_WITH_CODE(), get_mouse_button(), has_child(), if(), im_delete_surrounding_cb(), im_retrieve_surrounding_cb(), notification_assertive_cb(), notification_polite_cb(), read_align(), read_uint16(), read_uint32(), read_uint8(), register_texture(), responder_handle_channel_event_cb(), responder_handle_embedder_event_cb(), scroll_event_cb(), send_response(), set_client(), set_editing_state(), settings_portal_read(), system_initialization_complete(), TEST(), TEST_F(), test_lock_event(), touch_event_cb(), view_added_cb(), view_removed_cb(), and window_delete_event_cb().

◆ width