gdk: Improve GDK_DEBUG=linear

Keep a linear and a non-linear rendering colorstate around. That way, we
don't "return self;" from cicp colorstates and then end up with a cicp
ccs.
This commit is contained in:
Benjamin Otte
2024-08-14 07:59:08 +02:00
parent f3c8c5a9c0
commit 3cd25516ab
2 changed files with 11 additions and 5 deletions

View File

@@ -350,7 +350,8 @@ GdkDefaultColorState gdk_default_color_states[] = {
.klass = &GDK_DEFAULT_COLOR_STATE_CLASS,
.ref_count = 0,
.depth = GDK_MEMORY_U8_SRGB,
.rendering_color_state = GDK_COLOR_STATE_SRGB_LINEAR,
.rendering_color_state = GDK_COLOR_STATE_SRGB,
.rendering_color_state_linear = GDK_COLOR_STATE_SRGB_LINEAR,
},
.name = "srgb",
.no_srgb = GDK_COLOR_STATE_SRGB_LINEAR,
@@ -367,6 +368,7 @@ GdkDefaultColorState gdk_default_color_states[] = {
.ref_count = 0,
.depth = GDK_MEMORY_U8,
.rendering_color_state = GDK_COLOR_STATE_SRGB_LINEAR,
.rendering_color_state_linear = GDK_COLOR_STATE_SRGB_LINEAR,
},
.name = "srgb-linear",
.no_srgb = NULL,
@@ -382,7 +384,8 @@ GdkDefaultColorState gdk_default_color_states[] = {
.klass = &GDK_DEFAULT_COLOR_STATE_CLASS,
.ref_count = 0,
.depth = GDK_MEMORY_FLOAT16,
.rendering_color_state = GDK_COLOR_STATE_REC2100_LINEAR,
.rendering_color_state = GDK_COLOR_STATE_REC2100_PQ,
.rendering_color_state_linear = GDK_COLOR_STATE_REC2100_LINEAR,
},
.name = "rec2100-pq",
.no_srgb = NULL,
@@ -399,6 +402,7 @@ GdkDefaultColorState gdk_default_color_states[] = {
.ref_count = 0,
.depth = GDK_MEMORY_FLOAT16,
.rendering_color_state = GDK_COLOR_STATE_REC2100_LINEAR,
.rendering_color_state_linear = GDK_COLOR_STATE_REC2100_LINEAR,
},
.name = "rec2100-linear",
.no_srgb = NULL,
@@ -693,7 +697,8 @@ gdk_color_state_new_for_cicp (const GdkCicp *cicp,
self->parent.ref_count = 1;
/* sRGB is special-cased by being a default colorstate */
self->parent.rendering_color_state = GDK_COLOR_STATE_REC2100_LINEAR;
self->parent.rendering_color_state = GDK_COLOR_STATE_REC2100_PQ;
self->parent.rendering_color_state_linear = GDK_COLOR_STATE_REC2100_LINEAR;
self->parent.depth = GDK_MEMORY_FLOAT16;

View File

@@ -26,6 +26,7 @@ struct _GdkColorState
GdkMemoryDepth depth;
GdkColorState *rendering_color_state;
GdkColorState *rendering_color_state_linear;
};
/* Note: self may be the source or the target colorstate */
@@ -84,9 +85,9 @@ gdk_color_state_get_rendering_color_state (GdkColorState *self)
self = GDK_COLOR_STATE_REC2100_PQ;
if (!GDK_DEBUG_CHECK (LINEAR))
return self;
return self->rendering_color_state;
return self->rendering_color_state;
return self->rendering_color_state_linear;
}
static inline GdkMemoryDepth