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




commit 5226c27d780150a8a36e90f052b14aac2c9e9333
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 3b086aa03e..31c5f2ff27 100644
--- a/gdk/win32/gdkdisplay-win32.c
+++ b/gdk/win32/gdkdisplay-win32.c
@@ -1147,6 +1147,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 368b99d6a4..351ae37491 100644
--- a/gdk/win32/gdkglcontext-win32.c
+++ b/gdk/win32/gdkglcontext-win32.c
@@ -552,37 +552,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,
@@ -1254,20 +1223,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 7e86a96725..85c0053a14 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -5148,3 +5148,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]