[gimp] Bug 781621 - PDB shapeburst gradient is slower than the blend tool.



commit 5751bb114e33121229bf22a2278faad8a9deeb8a
Author: Jehan <jehan girinstud io>
Date:   Wed Mar 14 15:27:15 2018 +0100

    Bug 781621 - PDB shapeburst gradient is slower than the blend tool.
    
    PDB function gimp_edit_blend() was based on "gimp:shapeburst" operation
    whereas the rest of GIMP (in particular, the Blend tool) used
    "gegl:distance-transform" which is much faster.
    Setting the operation to "manhattan" metric ensures that it still
    renders the same way as in 2.8 while being a lot faster.
    
    There was still a problem regarding as how it renders differently from
    the Blend tool, but it turns out that the Blend tool is the one
    rendering differently from how it used to in 2.8. We should discuss
    adding the "metric" property in the tool options.

 app/core/gimpdrawable-blend.c            |   20 +-
 app/operations/Makefile.am               |    2 -
 app/operations/gimp-operations.c         |    2 -
 app/operations/gimpoperationshapeburst.c |  326 ------------------------------
 app/operations/gimpoperationshapeburst.h |   55 -----
 5 files changed, 10 insertions(+), 395 deletions(-)
---
diff --git a/app/core/gimpdrawable-blend.c b/app/core/gimpdrawable-blend.c
index d86535c..bed2c25 100644
--- a/app/core/gimpdrawable-blend.c
+++ b/app/core/gimpdrawable-blend.c
@@ -200,16 +200,16 @@ gimp_drawable_blend_shapeburst_distmap (GimpDrawable        *drawable,
         }
     }
 
-  if (legacy_shapeburst)
-    shapeburst = gegl_node_new_child (NULL,
-                                      "operation", "gimp:shapeburst",
-                                      "normalize", TRUE,
-                                      NULL);
-  else
-    shapeburst = gegl_node_new_child (NULL,
-                                      "operation", "gegl:distance-transform",
-                                      "normalize", TRUE,
-                                      NULL);
+  shapeburst = gegl_node_new_child (NULL,
+                                    "operation", "gegl:distance-transform",
+                                    "normalize", TRUE,
+                                    /* Legacy blend used "manhattan"
+                                     * metric to compute distance, vs.
+                                     * "euclidean". API needs to stay
+                                     * compatible.
+                                     */
+                                    "metric",    legacy_shapeburst ? 1 : 0,
+                                    NULL);
 
   if (progress)
     gimp_gegl_progress_connect (shapeburst, progress,
diff --git a/app/operations/Makefile.am b/app/operations/Makefile.am
index 643ecf9..7fe28c1 100644
--- a/app/operations/Makefile.am
+++ b/app/operations/Makefile.am
@@ -70,8 +70,6 @@ libappoperations_a_sources = \
        gimpoperationsemiflatten.h              \
        gimpoperationsetalpha.c                 \
        gimpoperationsetalpha.h                 \
-       gimpoperationshapeburst.c               \
-       gimpoperationshapeburst.h               \
        gimpoperationshrink.c                   \
        gimpoperationshrink.h                   \
        gimpoperationthresholdalpha.c           \
diff --git a/app/operations/gimp-operations.c b/app/operations/gimp-operations.c
index e0e702d..4c651f4 100644
--- a/app/operations/gimp-operations.c
+++ b/app/operations/gimp-operations.c
@@ -45,7 +45,6 @@
 #include "gimpoperationscalarmultiply.h"
 #include "gimpoperationsemiflatten.h"
 #include "gimpoperationsetalpha.h"
-#include "gimpoperationshapeburst.h"
 #include "gimpoperationshrink.h"
 #include "gimpoperationthresholdalpha.h"
 
@@ -139,7 +138,6 @@ gimp_operations_init (Gimp *gimp)
   g_type_class_ref (GIMP_TYPE_OPERATION_SCALAR_MULTIPLY);
   g_type_class_ref (GIMP_TYPE_OPERATION_SEMI_FLATTEN);
   g_type_class_ref (GIMP_TYPE_OPERATION_SET_ALPHA);
-  g_type_class_ref (GIMP_TYPE_OPERATION_SHAPEBURST);
   g_type_class_ref (GIMP_TYPE_OPERATION_SHRINK);
   g_type_class_ref (GIMP_TYPE_OPERATION_THRESHOLD_ALPHA);
 


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