Skip to content

Commit be79e0a

Browse files
Rename FlRenderer to FlCompositorOpenGL (#166037)
Matches the Flutter engine compositor and is similar to the Windows embedder classes.
1 parent 8b0cf61 commit be79e0a

File tree

13 files changed

+434
-323
lines changed

13 files changed

+434
-323
lines changed

engine/src/flutter/ci/licenses_golden/licenses_flutter

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53211,6 +53211,11 @@ ORIGIN: ../../../flutter/shell/platform/linux/fl_binary_codec_test.cc + ../../..
5321153211
ORIGIN: ../../../flutter/shell/platform/linux/fl_binary_messenger.cc + ../../../flutter/LICENSE
5321253212
ORIGIN: ../../../flutter/shell/platform/linux/fl_binary_messenger_private.h + ../../../flutter/LICENSE
5321353213
ORIGIN: ../../../flutter/shell/platform/linux/fl_binary_messenger_test.cc + ../../../flutter/LICENSE
53214+
ORIGIN: ../../../flutter/shell/platform/linux/fl_compositor.cc + ../../../flutter/LICENSE
53215+
ORIGIN: ../../../flutter/shell/platform/linux/fl_compositor.h + ../../../flutter/LICENSE
53216+
ORIGIN: ../../../flutter/shell/platform/linux/fl_compositor_opengl.cc + ../../../flutter/LICENSE
53217+
ORIGIN: ../../../flutter/shell/platform/linux/fl_compositor_opengl.h + ../../../flutter/LICENSE
53218+
ORIGIN: ../../../flutter/shell/platform/linux/fl_compositor_opengl_test.cc + ../../../flutter/LICENSE
5321453219
ORIGIN: ../../../flutter/shell/platform/linux/fl_dart_project.cc + ../../../flutter/LICENSE
5321553220
ORIGIN: ../../../flutter/shell/platform/linux/fl_dart_project_private.h + ../../../flutter/LICENSE
5321653221
ORIGIN: ../../../flutter/shell/platform/linux/fl_dart_project_test.cc + ../../../flutter/LICENSE
@@ -53290,9 +53295,6 @@ ORIGIN: ../../../flutter/shell/platform/linux/fl_pointer_manager.h + ../../../fl
5329053295
ORIGIN: ../../../flutter/shell/platform/linux/fl_pointer_manager_test.cc + ../../../flutter/LICENSE
5329153296
ORIGIN: ../../../flutter/shell/platform/linux/fl_renderable.cc + ../../../flutter/LICENSE
5329253297
ORIGIN: ../../../flutter/shell/platform/linux/fl_renderable.h + ../../../flutter/LICENSE
53293-
ORIGIN: ../../../flutter/shell/platform/linux/fl_renderer.cc + ../../../flutter/LICENSE
53294-
ORIGIN: ../../../flutter/shell/platform/linux/fl_renderer.h + ../../../flutter/LICENSE
53295-
ORIGIN: ../../../flutter/shell/platform/linux/fl_renderer_test.cc + ../../../flutter/LICENSE
5329653298
ORIGIN: ../../../flutter/shell/platform/linux/fl_scrolling_manager.cc + ../../../flutter/LICENSE
5329753299
ORIGIN: ../../../flutter/shell/platform/linux/fl_scrolling_manager.h + ../../../flutter/LICENSE
5329853300
ORIGIN: ../../../flutter/shell/platform/linux/fl_scrolling_manager_test.cc + ../../../flutter/LICENSE
@@ -56228,6 +56230,11 @@ FILE: ../../../flutter/shell/platform/linux/fl_binary_codec_test.cc
5622856230
FILE: ../../../flutter/shell/platform/linux/fl_binary_messenger.cc
5622956231
FILE: ../../../flutter/shell/platform/linux/fl_binary_messenger_private.h
5623056232
FILE: ../../../flutter/shell/platform/linux/fl_binary_messenger_test.cc
56233+
FILE: ../../../flutter/shell/platform/linux/fl_compositor.cc
56234+
FILE: ../../../flutter/shell/platform/linux/fl_compositor.h
56235+
FILE: ../../../flutter/shell/platform/linux/fl_compositor_opengl.cc
56236+
FILE: ../../../flutter/shell/platform/linux/fl_compositor_opengl.h
56237+
FILE: ../../../flutter/shell/platform/linux/fl_compositor_opengl_test.cc
5623156238
FILE: ../../../flutter/shell/platform/linux/fl_dart_project.cc
5623256239
FILE: ../../../flutter/shell/platform/linux/fl_dart_project_private.h
5623356240
FILE: ../../../flutter/shell/platform/linux/fl_dart_project_test.cc
@@ -56307,9 +56314,6 @@ FILE: ../../../flutter/shell/platform/linux/fl_pointer_manager.h
5630756314
FILE: ../../../flutter/shell/platform/linux/fl_pointer_manager_test.cc
5630856315
FILE: ../../../flutter/shell/platform/linux/fl_renderable.cc
5630956316
FILE: ../../../flutter/shell/platform/linux/fl_renderable.h
56310-
FILE: ../../../flutter/shell/platform/linux/fl_renderer.cc
56311-
FILE: ../../../flutter/shell/platform/linux/fl_renderer.h
56312-
FILE: ../../../flutter/shell/platform/linux/fl_renderer_test.cc
5631356317
FILE: ../../../flutter/shell/platform/linux/fl_scrolling_manager.cc
5631456318
FILE: ../../../flutter/shell/platform/linux/fl_scrolling_manager.h
5631556319
FILE: ../../../flutter/shell/platform/linux/fl_scrolling_manager_test.cc

engine/src/flutter/shell/platform/linux/BUILD.gn

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ source_set("flutter_linux_sources") {
105105
"fl_basic_message_channel.cc",
106106
"fl_binary_codec.cc",
107107
"fl_binary_messenger.cc",
108+
"fl_compositor.cc",
109+
"fl_compositor_opengl.cc",
108110
"fl_dart_project.cc",
109111
"fl_display_monitor.cc",
110112
"fl_engine.cc",
@@ -136,7 +138,6 @@ source_set("flutter_linux_sources") {
136138
"fl_plugin_registry.cc",
137139
"fl_pointer_manager.cc",
138140
"fl_renderable.cc",
139-
"fl_renderer.cc",
140141
"fl_scrolling_manager.cc",
141142
"fl_settings.cc",
142143
"fl_settings_channel.cc",
@@ -213,6 +214,7 @@ executable("flutter_linux_unittests") {
213214
"fl_basic_message_channel_test.cc",
214215
"fl_binary_codec_test.cc",
215216
"fl_binary_messenger_test.cc",
217+
"fl_compositor_opengl_test.cc",
216218
"fl_dart_project_test.cc",
217219
"fl_display_monitor_test.cc",
218220
"fl_engine_test.cc",
@@ -235,7 +237,6 @@ executable("flutter_linux_unittests") {
235237
"fl_platform_handler_test.cc",
236238
"fl_plugin_registrar_test.cc",
237239
"fl_pointer_manager_test.cc",
238-
"fl_renderer_test.cc",
239240
"fl_scrolling_manager_test.cc",
240241
"fl_settings_handler_test.cc",
241242
"fl_settings_portal_test.cc",
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#include "fl_compositor.h"
6+
7+
G_DEFINE_QUARK(fl_compositor_error_quark, fl_compositor_error)
8+
9+
G_DEFINE_TYPE(FlCompositor, fl_compositor, G_TYPE_OBJECT)
10+
11+
static void fl_compositor_class_init(FlCompositorClass* klass) {}
12+
13+
static void fl_compositor_init(FlCompositor* self) {}
14+
15+
gboolean fl_compositor_create_backing_store(
16+
FlCompositor* self,
17+
const FlutterBackingStoreConfig* config,
18+
FlutterBackingStore* backing_store_out) {
19+
g_return_val_if_fail(FL_IS_COMPOSITOR(self), FALSE);
20+
return FL_COMPOSITOR_GET_CLASS(self)->create_backing_store(self, config,
21+
backing_store_out);
22+
}
23+
24+
gboolean fl_compositor_collect_backing_store(
25+
FlCompositor* self,
26+
const FlutterBackingStore* backing_store) {
27+
g_return_val_if_fail(FL_IS_COMPOSITOR(self), FALSE);
28+
return FL_COMPOSITOR_GET_CLASS(self)->collect_backing_store(self,
29+
backing_store);
30+
}
31+
32+
void fl_compositor_wait_for_frame(FlCompositor* self,
33+
int target_width,
34+
int target_height) {
35+
g_return_if_fail(FL_IS_COMPOSITOR(self));
36+
FL_COMPOSITOR_GET_CLASS(self)->wait_for_frame(self, target_width,
37+
target_height);
38+
}
39+
40+
gboolean fl_compositor_present_layers(FlCompositor* self,
41+
FlutterViewId view_id,
42+
const FlutterLayer** layers,
43+
size_t layers_count) {
44+
g_return_val_if_fail(FL_IS_COMPOSITOR(self), FALSE);
45+
return FL_COMPOSITOR_GET_CLASS(self)->present_layers(self, view_id, layers,
46+
layers_count);
47+
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_COMPOSITOR_H_
6+
#define FLUTTER_SHELL_PLATFORM_LINUX_FL_COMPOSITOR_H_
7+
8+
#include <glib-object.h>
9+
10+
#include "flutter/shell/platform/embedder/embedder.h"
11+
12+
G_BEGIN_DECLS
13+
14+
G_DECLARE_DERIVABLE_TYPE(FlCompositor, fl_compositor, FL, COMPOSITOR, GObject)
15+
16+
struct _FlCompositorClass {
17+
GObjectClass parent_class;
18+
19+
gboolean (*create_backing_store)(FlCompositor* compositor,
20+
const FlutterBackingStoreConfig* config,
21+
FlutterBackingStore* backing_store_out);
22+
23+
gboolean (*collect_backing_store)(FlCompositor* compositor,
24+
const FlutterBackingStore* backing_store);
25+
26+
gboolean (*present_layers)(FlCompositor* compositor,
27+
FlutterViewId view_id,
28+
const FlutterLayer** layers,
29+
size_t layers_count);
30+
31+
void (*wait_for_frame)(FlCompositor* compositor,
32+
int target_width,
33+
int target_height);
34+
};
35+
36+
/**
37+
* FlCompositor:
38+
*
39+
* #FlCompositor is an abstract class that implements Flutter compositing.
40+
*/
41+
42+
/**
43+
* fl_compositor_create_backing_store:
44+
* @compositor: an #FlCompositor.
45+
* @config: backing store config.
46+
* @backing_store_out: saves created backing store.
47+
*
48+
* Obtain a backing store for a specific #FlutterLayer.
49+
*
50+
* Returns %TRUE if successful.
51+
*/
52+
gboolean fl_compositor_create_backing_store(
53+
FlCompositor* compositor,
54+
const FlutterBackingStoreConfig* config,
55+
FlutterBackingStore* backing_store_out);
56+
57+
/**
58+
* fl_compositor_collect_backing_store:
59+
* @compositor: an #FlCompositor.
60+
* @backing_store: backing store to be released.
61+
*
62+
* A callback invoked by the engine to release the backing store. The
63+
* embedder may collect any resources associated with the backing store.
64+
*
65+
* Returns %TRUE if successful.
66+
*/
67+
gboolean fl_compositor_collect_backing_store(
68+
FlCompositor* compositor,
69+
const FlutterBackingStore* backing_store);
70+
71+
/**
72+
* fl_compositor_present_layers:
73+
* @compositor: an #FlCompositor.
74+
* @view_id: view to present.
75+
* @layers: layers to be composited.
76+
* @layers_count: number of layers.
77+
*
78+
* Callback invoked by the engine to composite the contents of each layer
79+
* onto the screen.
80+
*
81+
* Returns %TRUE if successful.
82+
*/
83+
gboolean fl_compositor_present_layers(FlCompositor* compositor,
84+
FlutterViewId view_id,
85+
const FlutterLayer** layers,
86+
size_t layers_count);
87+
88+
/**
89+
* fl_compositor_wait_for_frame:
90+
* @compositor: an #FlCompositor.
91+
* @target_width: width of frame being waited for
92+
* @target_height: height of frame being waited for
93+
*
94+
* Holds the thread until frame with requested dimensions is presented.
95+
* While waiting for frame Flutter platform and raster tasks are being
96+
* processed.
97+
*/
98+
void fl_compositor_wait_for_frame(FlCompositor* compositor,
99+
int target_width,
100+
int target_height);
101+
102+
G_END_DECLS
103+
104+
#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_COMPOSITOR_H_

0 commit comments

Comments
 (0)