From 127b92e3db8e331822a0e54e5b420e731e308489 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 28 Jun 2024 17:53:20 +0200 Subject: [PATCH] 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. --- gdk/gdkcolorstate.c | 2 +- gdk/gdkcolorstateprivate.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gdk/gdkcolorstate.c b/gdk/gdkcolorstate.c index d055133fe9..155b2b70fa 100644 --- a/gdk/gdkcolorstate.c +++ b/gdk/gdkcolorstate.c @@ -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", diff --git a/gdk/gdkcolorstateprivate.h b/gdk/gdkcolorstateprivate.h index c7c5fb8056..ae0a0cbade 100644 --- a/gdk/gdkcolorstateprivate.h +++ b/gdk/gdkcolorstateprivate.h @@ -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; }