gdk: Add GDK_DEBUG=srgb

Disables gdk_surface_set_color_profile() for backends and forces
sRGB.

This does not change any GSK renderers, it just turns off any backends
trying to hand us color profiles.
This commit is contained in:
Benjamin Otte
2021-10-01 06:57:17 +02:00
committed by Matthias Clasen
parent 41527b50ab
commit 06db24b4e1
3 changed files with 7 additions and 1 deletions

View File

@@ -19,7 +19,7 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
@@ -130,6 +130,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE },
{ "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible", TRUE },
{ "srgb", GDK_DEBUG_SRGB, "Force sRRGB rendering and turn off color profiles" },
};

View File

@@ -51,6 +51,7 @@ typedef enum {
GDK_DEBUG_VULKAN_VALIDATE = 1 << 22,
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 23,
GDK_DEBUG_HIGH_DEPTH = 1 << 24,
GDK_DEBUG_SRGB = 1 << 25,
} GdkDebugFlags;
extern guint _gdk_debug_flags;

View File

@@ -2088,6 +2088,10 @@ void
gdk_surface_set_color_profile (GdkSurface *self,
GdkColorProfile *color_profile)
{
/* This way we support unsetting, too */
if (GDK_DISPLAY_DEBUG_CHECK (self->display, SRGB))
color_profile = gdk_color_profile_get_srgb();
if (gdk_color_profile_equal (self->color_profile, color_profile))
return;