mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
gdk: Add a request_hdr argument to begin_frame()
It's not used by anyone, it's just there. gdk_draw_context_begin_frame_full() has been added so renderers can make use of it.
This commit is contained in:
parent
bc7c0d05f8
commit
7ede468849
@ -34,6 +34,7 @@ gdk_broadway_cairo_context_dispose (GObject *object)
|
||||
|
||||
static void
|
||||
gdk_broadway_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
||||
gboolean request_hdr,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkBroadwayCairoContext *self = GDK_BROADWAY_CAIRO_CONTEXT (draw_context);
|
||||
|
@ -34,6 +34,7 @@ gdk_broadway_draw_context_dispose (GObject *object)
|
||||
|
||||
static void
|
||||
gdk_broadway_draw_context_begin_frame (GdkDrawContext *draw_context,
|
||||
gboolean request_hdr,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkBroadwayDrawContext *self = GDK_BROADWAY_DRAW_CONTEXT (draw_context);
|
||||
|
@ -307,11 +307,39 @@ void
|
||||
gdk_draw_context_begin_frame (GdkDrawContext *context,
|
||||
const cairo_region_t *region)
|
||||
{
|
||||
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAW_CONTEXT (context));
|
||||
g_return_if_fail (region != NULL);
|
||||
|
||||
gdk_draw_context_begin_frame_full (context, FALSE, region);
|
||||
}
|
||||
|
||||
/*
|
||||
* @request_hdr: %TRUE to request high dynamic range.
|
||||
*
|
||||
* If HDR is requested, GDK will see about providing a rendering target
|
||||
* that supports high dynamic range. Typically this means a target supporting
|
||||
* 16bit floating point pixels, but that is not guaranteed.
|
||||
*
|
||||
* This is only a request and if the GDK backend does not support HDR rendering
|
||||
* or does not consider it worthwhile, it may choose to not honor the request.
|
||||
* It may also choose to provide HDR even if it was not requested.
|
||||
* Typically the steps undertaken by a backend are:
|
||||
* 1. Check if HDR is supported by this drawing backend.
|
||||
* 2. Check if the compositor supports HDR.
|
||||
* 3. Check if the compositor prefers SDR. This is usually the case when the attached
|
||||
* monitors do not support HDR content or when the system is resource constrained.
|
||||
* In either of those cases, the context will usually choose to not honor the request.
|
||||
*
|
||||
* The rendering code must be able to deal with HDR and SDR content, no matter if HDR
|
||||
* was requested. The request is only a hint and GDK is free to choose.
|
||||
*/
|
||||
void
|
||||
gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
||||
gboolean request_hdr,
|
||||
const cairo_region_t *region)
|
||||
{
|
||||
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (priv->surface))
|
||||
return;
|
||||
|
||||
@ -336,7 +364,7 @@ gdk_draw_context_begin_frame (GdkDrawContext *context,
|
||||
priv->frame_region = cairo_region_copy (region);
|
||||
priv->surface->paint_context = g_object_ref (context);
|
||||
|
||||
GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, priv->frame_region);
|
||||
GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, request_hdr, priv->frame_region);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SYSPROF
|
||||
|
@ -41,6 +41,7 @@ struct _GdkDrawContextClass
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (* begin_frame) (GdkDrawContext *context,
|
||||
gboolean request_hdr,
|
||||
cairo_region_t *update_area);
|
||||
void (* end_frame) (GdkDrawContext *context,
|
||||
cairo_region_t *painted);
|
||||
@ -49,6 +50,9 @@ struct _GdkDrawContextClass
|
||||
|
||||
void gdk_draw_context_surface_resized (GdkDrawContext *context);
|
||||
|
||||
void gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
||||
gboolean request_hdr,
|
||||
const cairo_region_t *region);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK__DRAW_CONTEXT_PRIVATE__ */
|
||||
|
@ -629,6 +629,7 @@ gdk_gl_context_real_make_current (GdkGLContext *context,
|
||||
|
||||
static void
|
||||
gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
|
||||
gboolean request_hdr,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkGLContext *context = GDK_GL_CONTEXT (draw_context);
|
||||
|
@ -425,6 +425,7 @@ device_supports_incremental_present (VkPhysicalDevice device)
|
||||
|
||||
static void
|
||||
gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context,
|
||||
gboolean request_hdr,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkVulkanContext *context = GDK_VULKAN_CONTEXT (draw_context);
|
||||
|
@ -82,6 +82,7 @@ _gdk_macos_cairo_context_cairo_create (GdkCairoContext *cairo_context)
|
||||
|
||||
static void
|
||||
_gdk_macos_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
||||
gboolean request_hdr,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkMacosCairoContext *self = (GdkMacosCairoContext *)draw_context;
|
||||
|
@ -291,6 +291,7 @@ opaque_region_covers_surface (GdkMacosGLContext *self)
|
||||
|
||||
static void
|
||||
gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
|
||||
gboolean request_hdr,
|
||||
cairo_region_t *painted)
|
||||
{
|
||||
GdkMacosGLContext *self = (GdkMacosGLContext *)context;
|
||||
@ -344,7 +345,7 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
|
||||
[self->gl_context update];
|
||||
}
|
||||
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_macos_gl_context_parent_class)->begin_frame (context, painted);
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_macos_gl_context_parent_class)->begin_frame (context, request_hdr, painted);
|
||||
|
||||
if (!self->is_attached)
|
||||
{
|
||||
|
@ -144,6 +144,7 @@ gdk_wayland_cairo_context_create_surface (GdkWaylandCairoContext *self)
|
||||
|
||||
static void
|
||||
gdk_wayland_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
||||
gboolean request_hdr,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkWaylandCairoContext *self = GDK_WAYLAND_CAIRO_CONTEXT (draw_context);
|
||||
|
@ -47,11 +47,12 @@ G_DEFINE_TYPE (GdkWaylandGLContext, gdk_wayland_gl_context, GDK_TYPE_GL_CONTEXT)
|
||||
|
||||
static void
|
||||
gdk_wayland_gl_context_begin_frame (GdkDrawContext *draw_context,
|
||||
gboolean request_hdr,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
gdk_wayland_surface_ensure_wl_egl_window (gdk_draw_context_get_surface (draw_context));
|
||||
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->begin_frame (draw_context, region);
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->begin_frame (draw_context, request_hdr, region);
|
||||
|
||||
glDrawBuffers (1, (GLenum[1]) { GL_BACK });
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ create_cairo_surface_for_surface (GdkSurface *surface,
|
||||
|
||||
static void
|
||||
gdk_win32_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
||||
gboolean request_hdr,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkWin32CairoContext *self = GDK_WIN32_CAIRO_CONTEXT (draw_context);
|
||||
|
@ -471,16 +471,12 @@ gdk_win32_gl_context_egl_make_current (GdkGLContext *context,
|
||||
|
||||
static void
|
||||
gdk_win32_gl_context_egl_begin_frame (GdkDrawContext *draw_context,
|
||||
gboolean request_hdr,
|
||||
cairo_region_t *update_area)
|
||||
{
|
||||
GdkGLContext *context = GDK_GL_CONTEXT (draw_context);
|
||||
GdkSurface *surface;
|
||||
|
||||
surface = gdk_gl_context_get_surface (context);
|
||||
|
||||
gdk_win32_surface_handle_queued_move_resize (draw_context);
|
||||
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_egl_parent_class)->begin_frame (draw_context, update_area);
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_egl_parent_class)->begin_frame (draw_context, request_hdr, update_area);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -118,11 +118,12 @@ gdk_win32_gl_context_wgl_end_frame (GdkDrawContext *draw_context,
|
||||
|
||||
static void
|
||||
gdk_win32_gl_context_wgl_begin_frame (GdkDrawContext *draw_context,
|
||||
gboolean request_hdr,
|
||||
cairo_region_t *update_area)
|
||||
{
|
||||
gdk_win32_surface_handle_queued_move_resize (draw_context);
|
||||
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_wgl_parent_class)->begin_frame (draw_context, update_area);
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_wgl_parent_class)->begin_frame (draw_context, request_hdr, update_area);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -68,11 +68,12 @@ gdk_win32_vulkan_context_create_surface (GdkVulkanContext *context,
|
||||
|
||||
static void
|
||||
gdk_win32_vulkan_context_begin_frame (GdkDrawContext *draw_context,
|
||||
gboolean request_hdr,
|
||||
cairo_region_t *update_area)
|
||||
{
|
||||
gdk_win32_surface_handle_queued_move_resize (draw_context);
|
||||
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_win32_vulkan_context_parent_class)->begin_frame (draw_context, update_area);
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_win32_vulkan_context_parent_class)->begin_frame (draw_context, request_hdr, update_area);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -55,6 +55,7 @@ create_cairo_surface_for_surface (GdkSurface *surface)
|
||||
|
||||
static void
|
||||
gdk_x11_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
||||
gboolean request_hdr,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkX11CairoContext *self = GDK_X11_CAIRO_CONTEXT (draw_context);
|
||||
|
@ -61,9 +61,10 @@ gdk_x11_display_get_egl_display (GdkDisplay *display)
|
||||
|
||||
static void
|
||||
gdk_x11_gl_context_egl_begin_frame (GdkDrawContext *draw_context,
|
||||
gboolean request_hdr,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_x11_gl_context_egl_parent_class)->begin_frame (draw_context, region);
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_x11_gl_context_egl_parent_class)->begin_frame (draw_context, request_hdr, region);
|
||||
|
||||
glDrawBuffers (1, (GLenum[1]) { GL_BACK });
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user