[gtk/matthiasc/color-profile-rebased: 27/47] gdk: Add GDK_DEBUG=srgb




commit 8da443cffbc19e3d3da2a7985ced490ba85f5fa7
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/gdkdebug.h   | 1 +
 gdk/gdksurface.c | 4 ++++
 3 files changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/gdk/gdk.c b/gdk/gdk.c
index d40c5ee4df..5bfc66e510 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" },
   { "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" },
 };
 
 
diff --git a/gdk/gdkdebug.h b/gdk/gdkdebug.h
index acd2259440..21a4064762 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_HIGH_DEPTH      = 1 << 24,
+  GDK_DEBUG_SRGB            = 1 << 25,
 } GdkDebugFlags;
 
 extern guint _gdk_debug_flags;
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 587070ae10..a7b6cb5e4a 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 (GDK_DISPLAY_DEBUG_CHECK (self->display, 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]