[gtk/wip/otte/color-profiles: 82/82] gdk: Add GDK_DEBUG=srgb




commit 17521e26f8bd335d4a233ee87bb5c9450d0c4c6a
Author: Benjamin Otte <otte redhat com>
Date:   Fri Oct 1 06:57:17 2021 +0200

    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.

 gdk/gdk.c        | 1 +
 gdk/gdkdebug.h   | 1 +
 gdk/gdksurface.c | 4 ++++
 3 files changed, 6 insertions(+)
---
diff --git a/gdk/gdk.c b/gdk/gdk.c
index b050c5916b..a5fe8450b8 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -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 },
   { "hdr",             GDK_DEBUG_HDR, "Use HDR rendering if possible", TRUE },
+  { "srgb",            GDK_DEBUG_SRGB, "Force sRRGB rendering and turn off color profiles" },
 };
 
 
diff --git a/gdk/gdkdebug.h b/gdk/gdkdebug.h
index 52460a7a82..0545a35ce6 100644
--- a/gdk/gdkdebug.h
+++ b/gdk/gdkdebug.h
@@ -51,6 +51,7 @@ typedef enum {
   GDK_DEBUG_VULKAN_VALIDATE = 1 << 22,
   GDK_DEBUG_DEFAULT_SETTINGS= 1 << 23,
   GDK_DEBUG_HDR             = 1 << 24,
+  GDK_DEBUG_SRGB            = 1 << 25,
 } GdkDebugFlags;
 
 extern guint _gdk_debug_flags;
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 70df77f6ea..e9c5981d83 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -2081,6 +2081,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;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]