[gtk/matthiasc/color-profile-rebased: 1/22] gdk: Add GDK_DEBUG=srgb




commit a6d4da83adc9ba865197675f1724dc1a833b9d3a
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             | 3 ++-
 gdk/gdkdebugprivate.h | 1 +
 gdk/gdksurface.c      | 4 ++++
 3 files changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/gdk/gdk.c b/gdk/gdk.c
index e6a1ebb51e..6cc4d00088 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -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", TRUE },
   { "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", TRUE },
 };
 
 
diff --git a/gdk/gdkdebugprivate.h b/gdk/gdkdebugprivate.h
index 94cc26aa6e..0582be17ba 100644
--- a/gdk/gdkdebugprivate.h
+++ b/gdk/gdkdebugprivate.h
@@ -51,6 +51,7 @@ typedef enum {
   GDK_DEBUG_VULKAN_VALIDATE = 1 << 23,
   GDK_DEBUG_DEFAULT_SETTINGS= 1 << 24,
   GDK_DEBUG_HIGH_DEPTH      = 1 << 25,
+  GDK_DEBUG_SRGB            = 1 << 26,
 } GdkDebugFlags;
 
 extern guint _gdk_debug_flags;
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 694ac010aa..489d6da888 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -2073,6 +2073,10 @@ void
 gdk_surface_set_color_space (GdkSurface    *self,
                              GdkColorSpace *color_space)
 {
+  /* This way we support unsetting, too */
+  if (G_UNLIKELY (gdk_display_get_debug_flags (display) & GDK_DEBUG_SRGB)
+    color_space = gdk_color_space_get_srgb ();
+
   if (gdk_color_space_equal (self->color_space, color_space))
     return;
 


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