color_state: Make U8_SRGB the depth for COLOR_STATE_SRGB

This will only be used with linear compositing, so we force U8 when
we're not compositing linear.
This commit is contained in:
Benjamin Otte 2024-06-28 17:53:20 +02:00
parent a7ceb8ce66
commit 127b92e3db
2 changed files with 4 additions and 1 deletions

View File

@ -162,7 +162,7 @@ GdkDefaultColorState gdk_default_color_states[] = {
.parent = {
.klass = &GDK_DEFAULT_COLOR_STATE_CLASS,
.ref_count = 0,
.depth = GDK_MEMORY_U8,
.depth = GDK_MEMORY_U8_SRGB,
.rendering_color_state = GDK_COLOR_STATE_SRGB_LINEAR,
},
.name = "srgb",

View File

@ -67,6 +67,9 @@ gdk_color_state_get_rendering_color_state (GdkColorState *self)
static inline GdkMemoryDepth
gdk_color_state_get_depth (GdkColorState *self)
{
if (!GDK_DEBUG_CHECK (LINEAR) && self->depth == GDK_MEMORY_U8_SRGB)
return GDK_MEMORY_U8;
return self->depth;
}