diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c index cddcd4c5b4..daeab6fbae 100644 --- a/gdk/gdkglcontext.c +++ b/gdk/gdkglcontext.c @@ -617,27 +617,33 @@ gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context, { GdkGLContext *context = GDK_GL_CONTEXT (draw_context); G_GNUC_UNUSED GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context); - GdkSurface *surface; + GdkSurface *surface = gdk_draw_context_get_surface (draw_context); + GdkColorState *color_state; cairo_region_t *damage; double scale; int ww, wh; int i; - surface = gdk_draw_context_get_surface (draw_context); + color_state = gdk_surface_get_color_state (surface); scale = gdk_gl_context_get_scale (context); + depth = gdk_memory_depth_merge (depth, gdk_color_state_get_depth (color_state)); + + g_assert (depth != GDK_MEMORY_U8_SRGB || gdk_color_state_get_no_srgb_tf (color_state) != NULL); + #ifdef HAVE_EGL if (priv->egl_context) *out_depth = gdk_surface_ensure_egl_surface (surface, depth); else - *out_depth = gdk_color_state_get_depth (GDK_COLOR_STATE_SRGB); + *out_depth = GDK_MEMORY_U8; + if (*out_depth == GDK_MEMORY_U8_SRGB) - *out_color_state = GDK_COLOR_STATE_SRGB_LINEAR; + *out_color_state = gdk_color_state_get_no_srgb_tf (color_state); else - *out_color_state = GDK_COLOR_STATE_SRGB; + *out_color_state = color_state; #else - *out_color_state = GDK_COLOR_STATE_SRGB; - *out_depth = gdk_color_state_get_depth (GDK_COLOR_STATE_SRGB); + *out_color_state = gdk_color_state_get_srgb (); + *out_depth = GDK_MEMORY_U8; #endif damage = GDK_GL_CONTEXT_GET_CLASS (context)->get_damage (context); diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c index ec4c9da8eb..304ca5ca58 100644 --- a/gdk/gdkvulkancontext.c +++ b/gdk/gdkvulkancontext.c @@ -642,9 +642,16 @@ gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context, { GdkVulkanContext *context = GDK_VULKAN_CONTEXT (draw_context); GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context); + GdkSurface *surface = gdk_draw_context_get_surface (draw_context); + GdkColorState *color_state; VkResult acquire_result; guint i; + color_state = gdk_surface_get_color_state (surface); + depth = gdk_memory_depth_merge (depth, gdk_color_state_get_depth (color_state)); + + g_assert (depth != GDK_MEMORY_U8_SRGB || gdk_color_state_get_no_srgb_tf (color_state) != NULL); + if (depth != priv->current_depth && depth != GDK_MEMORY_NONE) { if (priv->formats[depth].vk_format.format != priv->formats[priv->current_depth].vk_format.format || @@ -695,9 +702,9 @@ gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context, cairo_region_union (region, priv->regions[priv->draw_index]); if (priv->current_depth == GDK_MEMORY_U8_SRGB) - *out_color_state = GDK_COLOR_STATE_SRGB_LINEAR; + *out_color_state = gdk_color_state_get_no_srgb_tf (color_state); else - *out_color_state = GDK_COLOR_STATE_SRGB; + *out_color_state = color_state; *out_depth = priv->current_depth; } diff --git a/gdk/wayland/gdkcairocontext-wayland.c b/gdk/wayland/gdkcairocontext-wayland.c index fe051bf666..f455a0428a 100644 --- a/gdk/wayland/gdkcairocontext-wayland.c +++ b/gdk/wayland/gdkcairocontext-wayland.c @@ -154,6 +154,7 @@ gdk_wayland_cairo_context_begin_frame (GdkDrawContext *draw_context, const cairo_region_t *surface_region; GSList *l; cairo_t *cr; + GdkSurface *surface = gdk_draw_context_get_surface (draw_context); if (self->cached_surface) self->paint_surface = g_steal_pointer (&self->cached_surface); @@ -176,8 +177,8 @@ gdk_wayland_cairo_context_begin_frame (GdkDrawContext *draw_context, cairo_fill (cr); cairo_destroy (cr); - *out_color_state = GDK_COLOR_STATE_SRGB; - *out_depth = gdk_color_state_get_depth (GDK_COLOR_STATE_SRGB); + *out_color_state = gdk_surface_get_color_state (surface); + *out_depth = GDK_MEMORY_U8; } static void