[gimp/goat-invasion: 326/418] app: fix GIMP_TIMER_END() to take an arbitrary string



commit aeac860c8a70844646b69c9a84cab33e16b5090f
Author: Michael Natterer <mitch gimp org>
Date:   Fri Mar 30 13:03:51 2012 +0200

    app: fix GIMP_TIMER_END() to take an arbitrary string
    
    not a string constant that only works in the C preprocessor, and add a
    timer to gimp_apply_operation().

 app/core/gimp-apply-operation.c |    9 +++++++++
 app/core/gimp-utils.h           |    4 ++--
 app/core/gimpdrawable.c         |   10 +---------
 3 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/app/core/gimp-apply-operation.c b/app/core/gimp-apply-operation.c
index 7b29499..57f0574 100644
--- a/app/core/gimp-apply-operation.c
+++ b/app/core/gimp-apply-operation.c
@@ -28,6 +28,7 @@
 
 #include "gegl/gimp-gegl-utils.h"
 
+#include "gimp-utils.h"
 #include "gimp-apply-operation.h"
 #include "gimpprogress.h"
 
@@ -92,10 +93,18 @@ gimp_apply_operation (GeglBuffer          *src_buffer,
         }
     }
 
+#ifdef GIMP_UNSTABLE
+  GIMP_TIMER_START ();
+#endif
+
   while (gegl_processor_work (processor, &value))
     if (progress)
       gimp_progress_set_value (progress, value);
 
+#ifdef GIMP_UNSTABLE
+  GIMP_TIMER_END (undo_desc ? undo_desc : "operation");
+#endif
+
   g_object_unref (processor);
 
   g_object_unref (gegl);
diff --git a/app/core/gimp-utils.h b/app/core/gimp-utils.h
index c0567d1..a07f656 100644
--- a/app/core/gimp-utils.h
+++ b/app/core/gimp-utils.h
@@ -23,8 +23,8 @@
   { GTimer *_timer = g_timer_new ();
 
 #define GIMP_TIMER_END(message) \
-  g_printerr ("%s: " message " took %0.2f seconds\n", \
-              G_STRFUNC, g_timer_elapsed (_timer, NULL)); \
+  g_printerr ("%s: %s took %0.2f seconds\n", \
+              G_STRFUNC, message, g_timer_elapsed (_timer, NULL)); \
   g_timer_destroy (_timer); }
 
 
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 034c83f..9ae5014 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -30,7 +30,7 @@
 
 #include "gegl/gimp-gegl-utils.h"
 
-#include "gimp-utils.h" /* temp for GIMP_TIMER */
+#include "gimp-utils.h"
 #include "gimpchannel.h"
 #include "gimpcontext.h"
 #include "gimpdrawable-combine.h"
@@ -434,10 +434,6 @@ gimp_drawable_scale (GimpItem              *item,
                                                      new_width, new_height),
                                      gimp_drawable_get_format (drawable));
 
-#ifdef GIMP_UNSTABLE
-  GIMP_TIMER_START ();
-#endif
-
   scale = g_object_new (GEGL_TYPE_NODE,
                         "operation", "gegl:scale",
                         NULL);
@@ -458,10 +454,6 @@ gimp_drawable_scale (GimpItem              *item,
                                            scale, new_buffer);
   g_object_unref (scale);
 
-#ifdef GIMP_UNSTABLE
-  GIMP_TIMER_END ("scaling");
-#endif
-
   gimp_drawable_set_buffer_full (drawable, gimp_item_is_attached (item), NULL,
                                  new_buffer,
                                  new_offset_x, new_offset_y);



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