[gimp/alxsa-image-simulation-intent-bpc] Add additional fields to TransformCache



commit 9e5ff61124ff6d90a37735e442109f1690e14098
Author: Alx Sa <cmyk student gmail com>
Date:   Thu Aug 11 18:35:02 2022 +0000

    Add additional fields to TransformCache

 app/display/gimpdisplayshell-handlers.c |  2 -
 libgimpwidgets/gimpwidgetsutils.c       | 69 ++++++++++++++++++---------------
 libgimpwidgets/gimpwidgetsutils.h       |  4 +-
 3 files changed, 40 insertions(+), 35 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-handlers.c b/app/display/gimpdisplayshell-handlers.c
index 51c0d2c1db..7936afbb07 100644
--- a/app/display/gimpdisplayshell-handlers.c
+++ b/app/display/gimpdisplayshell-handlers.c
@@ -963,7 +963,6 @@ gimp_display_shell_simulation_intent_changed_handler (GimpColorManaged *image,
                                                       GimpDisplayShell *shell)
 {
   gimp_display_shell_profile_update (shell);
-  gimp_color_managed_simulation_intent_changed (GIMP_COLOR_MANAGED (shell));
 }
 
 static void
@@ -971,7 +970,6 @@ gimp_display_shell_simulation_bpc_changed_handler (GimpColorManaged *image,
                                                    GimpDisplayShell *shell)
 {
   gimp_display_shell_profile_update (shell);
-  gimp_color_managed_simulation_bpc_changed (GIMP_COLOR_MANAGED (shell));
 }
 
 static void
diff --git a/libgimpwidgets/gimpwidgetsutils.c b/libgimpwidgets/gimpwidgetsutils.c
index d8028db5f1..af147ff171 100644
--- a/libgimpwidgets/gimpwidgetsutils.c
+++ b/libgimpwidgets/gimpwidgetsutils.c
@@ -772,12 +772,14 @@ struct _TransformCache
 {
   GimpColorTransform *transform;
 
-  GimpColorConfig    *config;
-  GimpColorProfile   *src_profile;
-  const Babl         *src_format;
-  GimpColorProfile   *dest_profile;
-  const Babl         *dest_format;
-  GimpColorProfile   *proof_profile;
+  GimpColorConfig         *config;
+  GimpColorProfile        *src_profile;
+  const Babl              *src_format;
+  GimpColorProfile        *dest_profile;
+  const Babl              *dest_format;
+  GimpColorProfile        *proof_profile;
+  GimpColorRenderingIntent proof_intent;
+  gboolean                 proof_bpc;
 
   gulong              notify_id;
 };
@@ -795,12 +797,14 @@ profiles_equal (GimpColorProfile *profile1,
 }
 
 static TransformCache *
-transform_cache_get (GimpColorConfig  *config,
-                     GimpColorProfile *src_profile,
-                     const Babl       *src_format,
-                     GimpColorProfile *dest_profile,
-                     const Babl       *dest_format,
-                     GimpColorProfile *proof_profile)
+transform_cache_get (GimpColorConfig         *config,
+                     GimpColorProfile        *src_profile,
+                     const Babl              *src_format,
+                     GimpColorProfile        *dest_profile,
+                     const Babl              *dest_format,
+                     GimpColorProfile        *proof_profile,
+                     GimpColorRenderingIntent proof_intent,
+                     gboolean                 proof_bpc)
 {
   GList *list;
 
@@ -808,12 +812,14 @@ transform_cache_get (GimpColorConfig  *config,
     {
       TransformCache *cache = list->data;
 
-      if (config      == cache->config                        &&
-          src_format  == cache->src_format                    &&
-          dest_format == cache->dest_format                   &&
-          profiles_equal (src_profile,   cache->src_profile)  &&
-          profiles_equal (dest_profile,  cache->dest_profile) &&
-          profiles_equal (proof_profile, cache->proof_profile))
+      if (config       == cache->config                        &&
+          src_format   == cache->src_format                    &&
+          dest_format  == cache->dest_format                   &&
+          profiles_equal (src_profile,   cache->src_profile)   &&
+          profiles_equal (dest_profile,  cache->dest_profile)  &&
+          profiles_equal (proof_profile, cache->proof_profile) &&
+          proof_intent == cache->proof_intent                  &&
+          proof_bpc    == cache->proof_bpc)
         {
           if (debug_cache)
             g_printerr ("found cache %p\n", cache);
@@ -851,14 +857,11 @@ transform_cache_config_notify (GObject          *config,
 
 /**
  * gimp_widget_get_color_transform:
- * @widget:            a #GtkWidget
- * @config:            a #GimpColorConfig
- * @src_profile:       a #GimpColorProfile
- * @src_format:        Babl format for the transform's source pixels
- * @dest_format:       Babl format for the transform's destination
- * @softproof_profile: a #GimpColorProfile
- * @simulation_intent: a #GimpColorRenderingIntent
- * @simulation_bpc:    Boolean to enable Black Point Compensation
+ * @widget:      a #GtkWidget
+ * @config:      a #GimpColorConfig
+ * @src_profile: a #GimpColorProfile
+ * @src_format:  Babl format for the transform's source pixels
+ * @dest_format: Babl format for the transforms's destination pixels
  *
  * This function returns the #GimpColorTransform that transforms pixels
  * from @src_profile to the profile of the #GdkMonitor the @widget is
@@ -875,8 +878,8 @@ gimp_widget_get_color_transform (GtkWidget               *widget,
                                  const Babl              *src_format,
                                  const Babl              *dest_format,
                                  GimpColorProfile        *softproof_profile,
-                                 GimpColorRenderingIntent simulation_intent,
-                                 gboolean                 simulation_bpc)
+                                 GimpColorRenderingIntent proof_intent,
+                                 gboolean                 proof_bpc)
 {
   static gboolean     initialized   = FALSE;
   GimpColorProfile   *proof_profile = NULL;
@@ -919,7 +922,9 @@ gimp_widget_get_color_transform (GtkWidget               *widget,
                                src_format,
                                dest_profile,
                                dest_format,
-                               proof_profile);
+                               proof_profile,
+                               proof_intent,
+                               proof_bpc);
 
   if (cache)
     {
@@ -953,6 +958,8 @@ gimp_widget_get_color_transform (GtkWidget               *widget,
   cache->dest_profile  = dest_profile;
   cache->dest_format   = dest_format;
   cache->proof_profile = proof_profile;
+  cache->proof_intent  = proof_intent;
+  cache->proof_bpc     = proof_bpc;
 
   cache->notify_id =
     g_signal_connect (cache->config, "notify",
@@ -965,7 +972,7 @@ gimp_widget_get_color_transform (GtkWidget               *widget,
     {
       GimpColorTransformFlags flags = 0;
 
-      if (simulation_bpc)
+      if (proof_bpc)
         flags |= GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION;
 
       if (! gimp_color_config_get_simulation_optimize (config))
@@ -995,7 +1002,7 @@ gimp_widget_get_color_transform (GtkWidget               *widget,
                                            cache->dest_profile,
                                            cache->dest_format,
                                            cache->proof_profile,
-                                           simulation_intent,
+                                           cache->proof_intent,
                                            gimp_color_config_get_display_intent (config),
                                            flags);
     }
diff --git a/libgimpwidgets/gimpwidgetsutils.h b/libgimpwidgets/gimpwidgetsutils.h
index 58a5da1513..738df10b96 100644
--- a/libgimpwidgets/gimpwidgetsutils.h
+++ b/libgimpwidgets/gimpwidgetsutils.h
@@ -62,8 +62,8 @@ GimpColorTransform * gimp_widget_get_color_transform (GtkWidget         *widget,
                                                       const Babl        *src_format,
                                                       const Babl        *dest_format,
                                                       GimpColorProfile  *softproof_profile,
-                                                      GimpColorRenderingIntent simulation_intent,
-                                                      gboolean           simulation_bpc);
+                                                      GimpColorRenderingIntent proof_intent,
+                                                      gboolean           proof_bpc);
 
 
 G_END_DECLS


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