[gimp] app: don't prepare input color transform for source filters



commit 0ccb5e6bf9267283399c5e562916499c46fc24ba
Author: Ell <ell_se yahoo com>
Date:   Thu May 4 11:33:58 2017 -0400

    app: don't prepare input color transform for source filters
    
    ... which don't have an input pad.  It CRITICALs.

 app/core/gimpdrawablefilter.c |   43 +++++++++++++++++++++++++---------------
 1 files changed, 27 insertions(+), 16 deletions(-)
---
diff --git a/app/core/gimpdrawablefilter.c b/app/core/gimpdrawablefilter.c
index d887ed8..ca62996 100644
--- a/app/core/gimpdrawablefilter.c
+++ b/app/core/gimpdrawablefilter.c
@@ -660,6 +660,7 @@ gimp_drawable_filter_sync_transform (GimpDrawableFilter *filter)
 
   if (filter->color_managed)
     {
+      gboolean          has_input;
       const Babl       *drawable_format;
       const Babl       *input_format;
       const Babl       *output_format;
@@ -668,12 +669,16 @@ gimp_drawable_filter_sync_transform (GimpDrawableFilter *filter)
       GimpColorProfile *output_profile;
       guint32           dummy;
 
+      has_input = gegl_node_has_pad (filter->operation, "input");
+
       drawable_format = gimp_drawable_get_format (filter->drawable);
-      input_format    = gimp_gegl_node_get_format (filter->operation, "input");
+      if (has_input)
+        input_format  = gimp_gegl_node_get_format (filter->operation, "input");
       output_format   = gimp_gegl_node_get_format (filter->operation, "output");
 
       g_printerr ("drawable format:      %s\n", babl_get_name (drawable_format));
-      g_printerr ("filter input format:  %s\n", babl_get_name (input_format));
+      if (has_input)
+        g_printerr ("filter input format:  %s\n", babl_get_name (input_format));
       g_printerr ("filter output format: %s\n", babl_get_name (output_format));
 
       /*  convert the drawable format to float, so we get a precise
@@ -689,34 +694,40 @@ gimp_drawable_filter_sync_transform (GimpDrawableFilter *filter)
        *  built-in color profiles for (see the get_color_profile()
        *  calls below)
        */
-      input_format  = gimp_color_profile_get_format (input_format,  &dummy);
-      output_format = gimp_color_profile_get_format (output_format, &dummy);
+      if (has_input)
+        input_format = gimp_color_profile_get_format (input_format,  &dummy);
+      output_format  = gimp_color_profile_get_format (output_format, &dummy);
 
       g_printerr ("profile transform drawable format: %s\n",
                   babl_get_name (drawable_format));
-      g_printerr ("profile transform input format:    %s\n",
-                  babl_get_name (input_format));
+      if (has_input)
+        g_printerr ("profile transform input format:    %s\n",
+                    babl_get_name (input_format));
       g_printerr ("profile transform output format:   %s\n",
                   babl_get_name (output_format));
 
       drawable_profile = gimp_color_managed_get_color_profile (managed);
-      input_profile    = gimp_babl_format_get_color_profile (input_format);
+      if (has_input)
+        input_profile  = gimp_babl_format_get_color_profile (input_format);
       output_profile   = gimp_babl_format_get_color_profile (output_format);
 
-      if (! gimp_color_transform_can_gegl_copy (drawable_profile,
-                                                input_profile) ||
+      if ((has_input && ! gimp_color_transform_can_gegl_copy (drawable_profile,
+                                                              input_profile)) ||
           ! gimp_color_transform_can_gegl_copy (output_profile,
                                                 drawable_profile))
         {
           g_printerr ("using gimp:profile-transform\n");
 
-          gegl_node_set (filter->transform_before,
-                         "operation",    "gimp:profile-transform",
-                         "src-profile",  drawable_profile,
-                         "src-format",   drawable_format,
-                         "dest-profile", input_profile,
-                         "dest-format",  input_format,
-                         NULL);
+          if (has_input)
+            {
+              gegl_node_set (filter->transform_before,
+                             "operation",    "gimp:profile-transform",
+                             "src-profile",  drawable_profile,
+                             "src-format",   drawable_format,
+                             "dest-profile", input_profile,
+                             "dest-format",  input_format,
+                             NULL);
+            }
 
           gegl_node_set (filter->transform_after,
                          "operation",    "gimp:profile-transform",


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