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




commit 0f69b0d27699189afd82d05a48099280f64f22a7
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 cd8c0bdcc8..940d30573c 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -128,6 +128,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
   { "vulkan-disable",  GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
   { "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
   { "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE },
+  { "srgb",            GDK_DEBUG_SRGB, "Force sRRGB rendering and turn off color profiles" },
 };
 
 
diff --git a/gdk/gdkdebug.h b/gdk/gdkdebug.h
index 82332e6fb5..efb33a23ce 100644
--- a/gdk/gdkdebug.h
+++ b/gdk/gdkdebug.h
@@ -50,6 +50,7 @@ typedef enum {
   GDK_DEBUG_VULKAN_DISABLE  = 1 << 21,
   GDK_DEBUG_VULKAN_VALIDATE = 1 << 22,
   GDK_DEBUG_DEFAULT_SETTINGS= 1 << 23,
+  GDK_DEBUG_SRGB            = 1 << 24,
 } GdkDebugFlags;
 
 extern guint _gdk_debug_flags;
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 1bd3a4ba49..b35105eb27 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -1999,6 +1999,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]