Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 57a667d

Browse files
committed
Refactor GL rendering to prepare for GTK4
- Remove FlGLArea - we can just use GtkGLArea directly - Stop using gdk_cairo_draw_from_gl, it's not available in GTK4. - Rename FlRendererGL to FlRendererGdk, this was implying that FlRenderer could be something other than OpenGL which is not the case currently. - Remove unnecessary virtual methods in FlRenderer, just implement them as standard methods.
1 parent 049d824 commit 57a667d

15 files changed

Lines changed: 564 additions & 626 deletions

ci/licenses_golden/licenses_flutter

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10926,8 +10926,8 @@ ORIGIN: ../../../flutter/shell/platform/linux/fl_plugin_registrar_test.cc + ../.
1092610926
ORIGIN: ../../../flutter/shell/platform/linux/fl_plugin_registry.cc + ../../../flutter/LICENSE
1092710927
ORIGIN: ../../../flutter/shell/platform/linux/fl_renderer.cc + ../../../flutter/LICENSE
1092810928
ORIGIN: ../../../flutter/shell/platform/linux/fl_renderer.h + ../../../flutter/LICENSE
10929-
ORIGIN: ../../../flutter/shell/platform/linux/fl_renderer_gl.cc + ../../../flutter/LICENSE
10930-
ORIGIN: ../../../flutter/shell/platform/linux/fl_renderer_gl.h + ../../../flutter/LICENSE
10929+
ORIGIN: ../../../flutter/shell/platform/linux/fl_renderer_gdk.cc + ../../../flutter/LICENSE
10930+
ORIGIN: ../../../flutter/shell/platform/linux/fl_renderer_gdk.h + ../../../flutter/LICENSE
1093110931
ORIGIN: ../../../flutter/shell/platform/linux/fl_renderer_headless.cc + ../../../flutter/LICENSE
1093210932
ORIGIN: ../../../flutter/shell/platform/linux/fl_renderer_headless.h + ../../../flutter/LICENSE
1093310933
ORIGIN: ../../../flutter/shell/platform/linux/fl_scrolling_manager.cc + ../../../flutter/LICENSE
@@ -13787,8 +13787,8 @@ FILE: ../../../flutter/shell/platform/linux/fl_plugin_registrar_test.cc
1378713787
FILE: ../../../flutter/shell/platform/linux/fl_plugin_registry.cc
1378813788
FILE: ../../../flutter/shell/platform/linux/fl_renderer.cc
1378913789
FILE: ../../../flutter/shell/platform/linux/fl_renderer.h
13790-
FILE: ../../../flutter/shell/platform/linux/fl_renderer_gl.cc
13791-
FILE: ../../../flutter/shell/platform/linux/fl_renderer_gl.h
13790+
FILE: ../../../flutter/shell/platform/linux/fl_renderer_gdk.cc
13791+
FILE: ../../../flutter/shell/platform/linux/fl_renderer_gdk.h
1379213792
FILE: ../../../flutter/shell/platform/linux/fl_renderer_headless.cc
1379313793
FILE: ../../../flutter/shell/platform/linux/fl_renderer_headless.h
1379413794
FILE: ../../../flutter/shell/platform/linux/fl_scrolling_manager.cc

shell/platform/linux/BUILD.gn

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ source_set("flutter_linux_sources") {
106106
"fl_dart_project.cc",
107107
"fl_engine.cc",
108108
"fl_event_channel.cc",
109-
"fl_gl_area.cc",
110109
"fl_gnome_settings.cc",
111110
"fl_json_message_codec.cc",
112111
"fl_json_method_codec.cc",
@@ -127,7 +126,7 @@ source_set("flutter_linux_sources") {
127126
"fl_plugin_registrar.cc",
128127
"fl_plugin_registry.cc",
129128
"fl_renderer.cc",
130-
"fl_renderer_gl.cc",
129+
"fl_renderer_gdk.cc",
131130
"fl_renderer_headless.cc",
132131
"fl_scrolling_manager.cc",
133132
"fl_scrolling_view_delegate.cc",
@@ -247,7 +246,10 @@ executable("flutter_linux_unittests") {
247246

248247
public_configs = [ "//flutter:config" ]
249248

250-
configs += [ "//flutter/shell/platform/linux/config:gtk" ]
249+
configs += [
250+
"//flutter/shell/platform/linux/config:gtk",
251+
"//flutter/shell/platform/linux/config:epoxy",
252+
]
251253

252254
defines = [
253255
"FLUTTER_ENGINE_NO_PROTOTYPES",

shell/platform/linux/fl_engine.cc

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -217,22 +217,14 @@ static void* fl_engine_gl_proc_resolver(void* user_data, const char* name) {
217217

218218
static bool fl_engine_gl_make_current(void* user_data) {
219219
FlEngine* self = static_cast<FlEngine*>(user_data);
220-
g_autoptr(GError) error = nullptr;
221-
gboolean result = fl_renderer_make_current(self->renderer, &error);
222-
if (!result) {
223-
g_warning("%s", error->message);
224-
}
225-
return result;
220+
fl_renderer_make_current(self->renderer);
221+
return true;
226222
}
227223

228224
static bool fl_engine_gl_clear_current(void* user_data) {
229225
FlEngine* self = static_cast<FlEngine*>(user_data);
230-
g_autoptr(GError) error = nullptr;
231-
gboolean result = fl_renderer_clear_current(self->renderer, &error);
232-
if (!result) {
233-
g_warning("%s", error->message);
234-
}
235-
return result;
226+
fl_renderer_clear_current(self->renderer);
227+
return true;
236228
}
237229

238230
static uint32_t fl_engine_gl_get_fbo(void* user_data) {
@@ -248,12 +240,8 @@ static bool fl_engine_gl_present(void* user_data) {
248240

249241
static bool fl_engine_gl_make_resource_current(void* user_data) {
250242
FlEngine* self = static_cast<FlEngine*>(user_data);
251-
g_autoptr(GError) error = nullptr;
252-
gboolean result = fl_renderer_make_resource_current(self->renderer, &error);
253-
if (!result) {
254-
g_warning("%s", error->message);
255-
}
256-
return result;
243+
fl_renderer_make_resource_current(self->renderer);
244+
return true;
257245
}
258246

259247
// Called by the engine to retrieve an external texture.

shell/platform/linux/fl_gl_area.cc

Lines changed: 0 additions & 136 deletions
This file was deleted.

shell/platform/linux/fl_gl_area.h

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)