[gimp/gimp-2-10] app: apply "linear" setting when repeating curves and levels



commit 78983e4b59d5e4f48f3742fa862cae3340177c40
Author: Ell <ell_se yahoo com>
Date:   Mon Apr 13 01:51:40 2020 +0300

    app: apply "linear" setting when repeating curves and levels
    
    In gimp_operation_config_sync_node(), when the operation has a
    property of the config object's type, don't skip the other
    properties.  This makes sure to set the "linear" property of
    GimpOperation{Curves,Levels} according to the config object.  We'd
    previously done it manually in GimpFilterTool, but the setting was
    not applied when repeating the filter.
    
    (cherry picked from commit 0096e563f6413a9fdc914cf9b04c27421b0b3ff1)

 app/operations/gimp-operation-config.c | 24 ++++++++----------------
 app/tools/gimpcurvestool.c             |  8 --------
 app/tools/gimplevelstool.c             |  8 --------
 3 files changed, 8 insertions(+), 32 deletions(-)
---
diff --git a/app/operations/gimp-operation-config.c b/app/operations/gimp-operation-config.c
index 13cbcf503f..492cefd29b 100644
--- a/app/operations/gimp-operation-config.c
+++ b/app/operations/gimp-operation-config.c
@@ -502,29 +502,21 @@ gimp_operation_config_sync_node (GObject  *config,
 
   for (i = 0; i < n_pspecs; i++)
     {
-      GParamSpec *pspec = pspecs[i];
+      GParamSpec *gegl_pspec = pspecs[i];
+      GParamSpec *gimp_pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (config),
+                                                             gegl_pspec->name);
 
       /*  if the operation has an object property of the config's
-       *  type, set it and done
+       *  type, use the config object directly
        */
-      if (G_IS_PARAM_SPEC_OBJECT (pspec) &&
-          pspec->value_type == G_TYPE_FROM_INSTANCE (config))
+      if (G_IS_PARAM_SPEC_OBJECT (gegl_pspec) &&
+          gegl_pspec->value_type == G_TYPE_FROM_INSTANCE (config))
         {
           gegl_node_set (node,
-                         pspec->name, config,
+                         gegl_pspec->name, config,
                          NULL);
-          g_free (pspecs);
-          return;
         }
-    }
-
-  for (i = 0; i < n_pspecs; i++)
-    {
-      GParamSpec *gegl_pspec = pspecs[i];
-      GParamSpec *gimp_pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (config),
-                                                             gegl_pspec->name);
-
-      if (gimp_pspec)
+      else if (gimp_pspec)
         {
           GValue value = G_VALUE_INIT;
 
diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c
index 6ba9ff659d..18d211f433 100644
--- a/app/tools/gimpcurvestool.c
+++ b/app/tools/gimpcurvestool.c
@@ -211,10 +211,6 @@ gimp_curves_tool_initialize (GimpTool     *tool,
 
   config = GIMP_CURVES_CONFIG (filter_tool->config);
 
-  gegl_node_set (filter_tool->operation,
-                 "linear", config->linear,
-                 NULL);
-
   histogram = gimp_histogram_new (config->linear);
   g_object_unref (gimp_drawable_calculate_histogram_async (
     drawable, histogram, FALSE));
@@ -750,10 +746,6 @@ gimp_curves_tool_config_notify (GimpFilterTool   *filter_tool,
     {
       GimpHistogram *histogram;
 
-      gegl_node_set (filter_tool->operation,
-                     "linear", curves_config->linear,
-                     NULL);
-
       histogram = gimp_histogram_new (curves_config->linear);
       g_object_unref (gimp_drawable_calculate_histogram_async (
         GIMP_TOOL (filter_tool)->drawable, histogram, FALSE));
diff --git a/app/tools/gimplevelstool.c b/app/tools/gimplevelstool.c
index 4f9e8e1562..4e97f713c3 100644
--- a/app/tools/gimplevelstool.c
+++ b/app/tools/gimplevelstool.c
@@ -201,10 +201,6 @@ gimp_levels_tool_initialize (GimpTool     *tool,
 
   config = GIMP_LEVELS_CONFIG (filter_tool->config);
 
-  gegl_node_set (filter_tool->operation,
-                 "linear", config->linear,
-                 NULL);
-
   g_clear_object (&l_tool->histogram);
   g_clear_object (&l_tool->histogram_async);
   l_tool->histogram = gimp_histogram_new (config->linear);
@@ -691,10 +687,6 @@ gimp_levels_tool_config_notify (GimpFilterTool   *filter_tool,
 
   if (! strcmp (pspec->name, "linear"))
     {
-      gegl_node_set (filter_tool->operation,
-                     "linear", levels_config->linear,
-                     NULL);
-
       g_clear_object (&levels_tool->histogram);
       g_clear_object (&levels_tool->histogram_async);
       levels_tool->histogram = gimp_histogram_new (levels_config->linear);


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