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.
This commit is contained in:
Chun-wei Fan 2021-07-14 12:19:52 +08:00 committed by Benjamin Otte
parent 6b8bc83420
commit 65c6af31e1
3 changed files with 45 additions and 48 deletions

View File

@ -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)
{

View File

@ -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
}

View File

@ -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
}