[gimp] app: don't use a GeglProcessor when we don't need a progress



commit dfeb16d9eec3b1e66616b8130f9c6afbf5870176
Author: Michael Natterer <mitch gimp org>
Date:   Sat Mar 2 18:30:22 2013 +0100

    app: don't use a GeglProcessor when we don't need a progress
    
    Instead, use gegl_node_blit() directly which is more than ten times
    faster in gimp_gegl_apply_operation(). Patch from Massimo Valentini.

 app/gegl/gimp-gegl-apply-operation.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-apply-operation.c b/app/gegl/gimp-gegl-apply-operation.c
index 9fafb17..cd443a9 100644
--- a/app/gegl/gimp-gegl-apply-operation.c
+++ b/app/gegl/gimp-gegl-apply-operation.c
@@ -45,7 +45,6 @@ gimp_gegl_apply_operation (GeglBuffer          *src_buffer,
   GeglNode      *gegl;
   GeglNode      *src_node;
   GeglNode      *dest_node;
-  GeglProcessor *processor;
   GeglRectangle  rect = { 0, };
   gdouble        value;
   gboolean       progress_active = FALSE;
@@ -80,10 +79,12 @@ gimp_gegl_apply_operation (GeglBuffer          *src_buffer,
 
   gegl_node_link_many (src_node, operation, dest_node, NULL);
 
-  processor = gegl_node_new_processor (dest_node, &rect);
-
   if (progress)
     {
+      GeglProcessor *processor;
+
+      processor = gegl_node_new_processor (dest_node, &rect);
+
       progress_active = gimp_progress_is_active (progress);
 
       if (progress_active)
@@ -95,13 +96,17 @@ gimp_gegl_apply_operation (GeglBuffer          *src_buffer,
         {
           gimp_progress_start (progress, undo_desc, FALSE);
         }
-    }
 
-  while (gegl_processor_work (processor, &value))
-    if (progress)
-      gimp_progress_set_value (progress, value);
+      while (gegl_processor_work (processor, &value))
+        gimp_progress_set_value (progress, value);
 
-  g_object_unref (processor);
+      g_object_unref (processor);
+    }
+  else
+    {
+      gegl_node_blit (dest_node, 1.0, &rect,
+                      NULL, NULL, 0, GEGL_BLIT_DEFAULT);
+    }
 
   g_object_unref (gegl);
 


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