[gtk/wip/otte/gleanup: 62/69] GDK-Win32: Move some functions out of gdkglcontext-win32.c




commit 65c6af31e11446a53962219845848a9d5773b2f3
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Jul 14 12:19:52 2021 +0800

    GDK-Win32: Move some functions out of gdkglcontext-win32.c
    
    We want these to be out of the way as we split between WGL and EGL/ANGLE
    GL contexts, so that they don't get in the way.

 gdk/win32/gdkdisplay-win32.c   | 28 ++++++++++++++++++++++++
 gdk/win32/gdkglcontext-win32.c | 48 ------------------------------------------
 gdk/win32/gdksurface-win32.c   | 17 +++++++++++++++
 3 files changed, 45 insertions(+), 48 deletions(-)
---
diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c
index fe2a4ff480..88b6eb5d6e 100644
--- a/gdk/win32/gdkdisplay-win32.c
+++ b/gdk/win32/gdkdisplay-win32.c
@@ -1140,6 +1140,34 @@ gdk_win32_display_get_setting (GdkDisplay  *display,
   return _gdk_win32_get_setting (name, value);
 }
 
+/**
+ * gdk_win32_display_get_egl_display:
+ * @display: (type GdkWin32Display): a Win32 display
+ *
+ * Retrieves the EGL display connection object for the given GDK display.
+ *
+ * Returns: (nullable): the EGL display
+ */
+gpointer
+gdk_win32_display_get_egl_display (GdkDisplay *display)
+{
+  GdkWin32Display *display_win32;
+
+  g_return_val_if_fail (GDK_IS_WIN32_DISPLAY (display), NULL);
+
+#ifdef GDK_WIN32_ENABLE_EGL
+  display_win32 = GDK_WIN32_DISPLAY (display);
+
+  if (display_win32->have_wgl)
+    return NULL;
+
+  return display_win32->egl_disp;
+#else
+  /* no EGL support */
+  return NULL;
+#endif
+}
+
 static void
 gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
 {
diff --git a/gdk/win32/gdkglcontext-win32.c b/gdk/win32/gdkglcontext-win32.c
index 44010df3a3..2107933a6c 100644
--- a/gdk/win32/gdkglcontext-win32.c
+++ b/gdk/win32/gdkglcontext-win32.c
@@ -548,37 +548,6 @@ _gdk_win32_display_init_gl (GdkDisplay *display)
   return TRUE;
 }
 
-/**
- * gdk_win32_display_get_egl_display:
- * @display: (type GdkWin32Display): a Win32 display
- *
- * Retrieves the EGL display connection object for the given GDK display.
- *
- * Returns: (nullable): the EGL display
- */
-gpointer
-gdk_win32_display_get_egl_display (GdkDisplay *display)
-{
-  GdkWin32Display *display_win32;
-
-  g_return_val_if_fail (GDK_IS_WIN32_DISPLAY (display), NULL);
-
-#ifdef GDK_WIN32_ENABLE_EGL
-  if (!_gdk_win32_display_init_gl (display))
-    return NULL;
-
-  display_win32 = GDK_WIN32_DISPLAY (display);
-
-  if (display_win32->have_wgl)
-    return NULL;
-
-  return display_win32->egl_disp;
-#else
-  /* no EGL support */
-  return NULL;
-#endif
-}
-
 /* Setup the legacy context after creating it */
 static gboolean
 _ensure_legacy_gl_context (HDC           hdc,
@@ -1236,20 +1205,3 @@ gdk_win32_display_get_wgl_version (GdkDisplay *display,
 
   return TRUE;
 }
-
-void
-_gdk_win32_surface_invalidate_egl_framebuffer (GdkSurface *surface)
-{
-/* If we are using ANGLE, we need to force redraw of the whole Window and its child windows
- *  as we need to re-acquire the EGL surfaces that we rendered to upload to Cairo explicitly,
- *  using gdk_window_invalidate_rect (), when we maximize or restore or use aerosnap
- */
-#ifdef GDK_WIN32_ENABLE_EGL
-  if (surface->gl_paint_context != NULL && gdk_gl_context_get_use_es (surface->gl_paint_context))
-    {
-      GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
-
-      impl->egl_force_redraw_all = TRUE;
-    }
-#endif
-}
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index 48194888a9..f224e919a3 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -5151,3 +5151,20 @@ gdk_win32_surface_handle_queued_move_resize (GdkDrawContext *draw_context)
 
   return queued_window_rect;
 }
+
+void
+_gdk_win32_surface_invalidate_egl_framebuffer (GdkSurface *surface)
+{
+/* If we are using ANGLE, we need to force redraw of the whole Window and its child windows
+ *  as we need to re-acquire the EGL surfaces that we rendered to upload to Cairo explicitly,
+ *  using gdk_window_invalidate_rect (), when we maximize or restore or use aerosnap
+ */
+#ifdef GDK_WIN32_ENABLE_EGL
+  if (surface->gl_paint_context != NULL && gdk_gl_context_get_use_es (surface->gl_paint_context))
+    {
+      GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
+
+      impl->egl_force_redraw_all = TRUE;
+    }
+#endif
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]