| Flutter Linux Embedder |

Classes | Functions | Variables
fl_compositor_software.cc File Reference
`#include "fl_compositor_software.h"`

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 }
fl_compositor_software_render
static gboolean fl_compositor_software_render(FlCompositor *compositor, cairo_t *cr, GdkWindow *window)
Definition: fl_compositor_software.cc:71
fl_compositor_software_dispose
static void fl_compositor_software_dispose(GObject *object)
Definition: fl_compositor_software.cc:99

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 }
window
return window
Definition: fl_application.cc:41
height
self height
Definition: fl_compositor_software.cc:43
g_autoptr
g_autoptr(GMutexLocker) locker
width
self width
Definition: fl_compositor_software.cc:42
TRUE
return TRUE
Definition: fl_compositor_software.cc:68
fl_task_runner_wait
void fl_task_runner_wait(FlTaskRunner *self)
Definition: fl_task_runner.cc:172

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

Referenced by fl_compositor_software_class_init().

## ◆ fl_task_runner_stop_wait()

fl_task_runner_stop_wait | ( | self-> | task_runner | ) |

Referenced by fl_compositor_opengl_present_layers().

## ◆ g_autoptr()

g_autoptr | ( | GMutexLocker |  | ) |

Referenced by FlValueHandler::add(), add_mock_texture_to_registrar(), add_view_cb(), add_view_engine_error_cb(), add_view_error_cb(), channel_closed_cb(), clipboard_text_cb(), clipboard_text_has_strings_cb(), compositor_present_view_callback(), create_node(), create_pango_layout(), create_regular(), create_settings(), cursor_changed_cb(), decode_error_message(), decode_error_method_call(), decode_error_response(), decode_error_value(), decode_message(), decode_message_with_codec(), decode_method_call(), decode_response_with_error(), decode_response_with_success(), decode_semantic_data(), encode_bool(), encode_error_envelope(), encode_error_message(), encode_float(), encode_int(), encode_message(), encode_message_error(), encode_message_with_codec(), encode_method_call(), encode_string(), encode_success_envelope(), ensure_pointer_added(), ensure_touch_added(), finish_method(), fl_accessible_text_field_perform_action(), fl_application_activate(), fl_application_local_command_line(), fl_basic_message_channel_respond(), fl_basic_message_channel_send(), fl_basic_message_channel_send_finish(), fl_binary_messenger_handle_message(), fl_binary_messenger_response_handle_impl_dispose(), fl_compositor_opengl_render(), fl_compositor_software_render(), fl_engine_add_view(), fl_engine_gl_external_texture_frame_callback(), fl_engine_new_with_binary_messenger(), fl_engine_platform_message_cb(), fl_engine_platform_message_response_cb(), fl_engine_remove_view(), fl_engine_send_key_event(), fl_engine_start(), fl_event_channel_send(), fl_event_channel_send_error(), fl_gnome_settings_new(), fl_json_message_codec_decode(), fl_json_method_codec_decode_method_call(), fl_json_method_codec_decode_response(), fl_json_method_codec_encode_error_envelope(), fl_json_method_codec_encode_method_call(), fl_json_method_codec_encode_success_envelope(), fl_key_embedder_responder_handle_event(), fl_key_embedder_responder_handle_event_impl(), fl_key_event_channel_new(), fl_key_event_channel_send(), fl_key_event_channel_send_finish(), fl_keyboard_channel_new(), fl_keyboard_manager_handle_event(), fl_message_codec_encode_message(), fl_method_call_respond(), fl_method_call_respond_error(), fl_method_call_respond_not_implemented(), fl_method_call_respond_success(), fl_method_channel_invoke_method(), fl_method_channel_invoke_method_finish(), fl_method_channel_respond(), fl_method_response_get_result(), fl_mouse_cursor_channel_new(), fl_platform_channel_make_system_request_app_exit_response(), fl_platform_channel_new(), fl_platform_channel_respond_clipboard_get_data(), fl_platform_channel_respond_clipboard_has_strings(), fl_platform_channel_respond_system_exit_application(), fl_platform_channel_system_request_app_exit(), 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_rotation_end(), fl_scrolling_manager_handle_rotation_update(), fl_scrolling_manager_handle_scroll_event(), fl_scrolling_manager_handle_zoom_begin(), fl_scrolling_manager_handle_zoom_end(), fl_scrolling_manager_handle_zoom_update(), fl_settings_channel_new(), fl_settings_channel_send(), fl_settings_new(), fl_settings_portal_get_clock_format(), fl_settings_portal_get_color_scheme(), fl_settings_portal_get_enable_animations(), fl_settings_portal_get_high_contrast(), fl_settings_portal_get_text_scaling_factor(), fl_settings_portal_new(), fl_settings_portal_start(), fl_standard_message_codec_decode_message(), fl_standard_message_codec_encode_message(), fl_standard_message_codec_read_value_of_type(), fl_standard_method_codec_decode_method_call(), fl_standard_method_codec_decode_response(), fl_standard_method_codec_encode_error_envelope(), fl_standard_method_codec_encode_method_call(), fl_standard_method_codec_encode_success_envelope(), fl_standard_method_codec_new(), fl_task_runner_on_expired_timeout(), fl_task_runner_post_flutter_task(), fl_task_runner_process_expired_tasks_locked(), fl_task_runner_wait(), fl_test_application_activate(), fl_test_codec_decode_response(), fl_text_input_channel_new(), fl_text_input_channel_perform_action(), fl_text_input_channel_perform_action_finish(), fl_text_input_channel_update_editing_state(), fl_text_input_channel_update_editing_state_finish(), fl_text_input_channel_update_editing_state_with_deltas(), fl_text_input_channel_update_editing_state_with_deltas_finish(), fl_touch_manager_handle_touch_event(), fl_value_new_list_from_strv(), fl_view_accessible_handle_update_semantics(), fl_view_new(), fl_windowing_channel_make_create_regular_response(), fl_windowing_channel_new(), get_executable_dir(), get_exit_response(), get_keyboard_state(), get_line_at_offset(), get_paragraph_at_offset(), get_string_at_offset(), get_view(), handle_key_event(), handle_response(), mark_texture_frame_available(), message_cb(), message_response_cb(), method_call_cb(), modify_regular(), notify_display_update(), perform_action_response_cb(), perform_set_selection_action(), perform_set_text_action(), platform_message_ready_cb(), quit_application(), read_list_value(), read_map_value(), realize_cb(), register_texture(), remove_view_cb(), remove_view_engine_error_cb(), remove_view_error_cb(), request_app_exit_response_cb(), resize_channel(), resize_channel_response_cb(), responder_handle_channel_event_cb(), responder_handle_embedder_event_cb(), send_key_event(), send_key_event_cb(), send_lifecycle_state(), send_on_channel(), send_on_channel_finish(), set_client(), set_editing_state(), set_message_handler_on_channel(), set_size_arg(), set_value(), set_warns_on_channel_overflow(), set_warns_on_channel_overflow_response_cb(), settings_portal_changed_cb(), settings_portal_read(), FlAccessibleNodeTest::SetUp(), setup_locales(), setup_opengl(), shutdown(), synthesize_simple_event(), TEST(), TEST_F(), test_lock_event(), unregister_texture(), update_editing_state_response_cb(), update_editing_state_with_deltas_response_cb(), update_settings(), view_added_cb(), and view_removed_cb().

## ◆ 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

* height = layers[0]->size.height

Definition at line 43 of file fl_compositor_software.cc.

Referenced by composite_layer(), flutter::PixelBufferTexture::CopyPixelBuffer(), fl_accessible_node_get_extents(), fl_accessible_node_set_extents(), fl_accessible_node_set_extents_impl(), fl_compositor_opengl_present_layers(), fl_compositor_opengl_render(), fl_compositor_software_render(), fl_engine_add_view(), fl_engine_gl_external_texture_frame_callback(), fl_engine_send_window_metrics_event(), fl_engine_start(), fl_framebuffer_new(), fl_pixel_buffer_texture_populate(), fl_test_texture_populate(), fl_texture_gl_populate(), G_DECLARE_DERIVABLE_TYPE(), make_create_regular_args(), flutter::GpuSurfaceTexture::ObtainDescriptor(), flutter::TextureRegistrarImpl::RegisterTexture(), set_marked_text_rect(), set_size_arg(), TEST(), flutter::TEST(), and TEST_F().

## ◆ layers

const FlutterLayer** layers

Definition at line 32 of file fl_compositor_software.cc.

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

## ◆ 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 channel_closed_cb(), check_size(), complete_handle_event(), create_settings(), 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(), parse_window_state_value(), 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

* width = layers[0]->size.width

Definition at line 42 of file fl_compositor_software.cc.

Referenced by composite_layer(), flutter::PixelBufferTexture::CopyPixelBuffer(), fl_accessible_node_get_extents(), fl_accessible_node_set_extents(), fl_accessible_node_set_extents_impl(), fl_compositor_opengl_present_layers(), fl_compositor_opengl_render(), fl_compositor_software_render(), fl_engine_add_view(), fl_engine_gl_external_texture_frame_callback(), fl_engine_send_window_metrics_event(), fl_framebuffer_new(), fl_pixel_buffer_texture_populate(), fl_test_texture_populate(), fl_texture_gl_populate(), G_DECLARE_DERIVABLE_TYPE(), make_create_regular_args(), flutter::GpuSurfaceTexture::ObtainDescriptor(), flutter::TextureRegistrarImpl::RegisterTexture(), set_marked_text_rect(), set_size_arg(), TEST(), flutter::TEST(), and TEST_F().