diff --git a/ChangeLog b/ChangeLog index 6a47043434..6ae0c7f813 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2002-12-01 Sven Neumann + + * app/core/core-types.h: prefix PIXELS and POINTS with GIMP + instead of SIZE so we don't break the libgimp API without a good + reason. + + * app/pdb/text_tool_cmds.c + * tools/pdbgen/enums.pl: regenerated. + + * libgimp/gimpmisc.[ch]: removed gimp_timer functions since the + GTimer API is simple enough and doesn't need to be wrapped. + + * plug-ins/common/newsprint.c + * plug-ins/common/unsharp.c: use GTimer. + 2002-12-01 Michael Natterer * libgimpwidgets/gimpdatafiles.c: s/S_ISLINK/S_ISNLK/ (was never @@ -15,7 +30,7 @@ * app/core/core-types.h : renamed PIXELS and POINTS to SIZE_* to avoid clashes with system headers * app/pdb/text_tool_cmds.c : updated ... - * tools/pdbgen/enums.py : ... by renaming here too. + * tools/pdbgen/enums.pl : ... by renaming here too. * app/widgets/gimphistogrambox.c : for memcpy() * app/widgets/gimppropwidgets.c : for strlen() diff --git a/app/core/core-types.h b/app/core/core-types.h index e85778b59f..a7fc7dbf7c 100644 --- a/app/core/core-types.h +++ b/app/core/core-types.h @@ -54,8 +54,8 @@ typedef enum /*< pdb-skip >*/ typedef enum { - SIZE_PIXELS, - SIZE_POINTS + GIMP_PIXELS, + GIMP_POINTS } SizeType; typedef enum /*< pdb-skip >*/ /*< skip >*/ diff --git a/app/pdb/text_tool_cmds.c b/app/pdb/text_tool_cmds.c index 8d997e0cce..18d6dd7a78 100644 --- a/app/pdb/text_tool_cmds.c +++ b/app/pdb/text_tool_cmds.c @@ -111,7 +111,7 @@ text_fontname_invoker (Gimp *gimp, success = FALSE; size_type = args[8].value.pdb_int; - if (size_type < SIZE_PIXELS || size_type > SIZE_POINTS) + if (size_type < GIMP_PIXELS || size_type > GIMP_POINTS) success = FALSE; fontname = (gchar *) args[9].value.pdb_pointer; @@ -183,7 +183,7 @@ static ProcArg text_fontname_inargs[] = { GIMP_PDB_INT32, "size_type", - "The units of specified size: SIZE_PIXELS (0) or SIZE_POINTS (1)" + "The units of specified size: GIMP_PIXELS (0) or GIMP_POINTS (1)" }, { GIMP_PDB_STRING, @@ -242,7 +242,7 @@ text_get_extents_fontname_invoker (Gimp *gimp, success = FALSE; size_type = args[2].value.pdb_int; - if (size_type < SIZE_PIXELS || size_type > SIZE_POINTS) + if (size_type < GIMP_PIXELS || size_type > GIMP_POINTS) success = FALSE; fontname = (gchar *) args[3].value.pdb_pointer; @@ -288,7 +288,7 @@ static ProcArg text_get_extents_fontname_inargs[] = { GIMP_PDB_INT32, "size_type", - "The units of specified size: SIZE_PIXELS (0) or SIZE_POINTS (1)" + "The units of specified size: GIMP_PIXELS (0) or GIMP_POINTS (1)" }, { GIMP_PDB_STRING, @@ -450,7 +450,7 @@ static ProcArg text_inargs[] = { GIMP_PDB_INT32, "size_type", - "The units of specified size: SIZE_PIXELS (0) or SIZE_POINTS (1)" + "The units of specified size: GIMP_PIXELS (0) or GIMP_POINTS (1)" }, { GIMP_PDB_STRING, @@ -603,7 +603,7 @@ static ProcArg text_get_extents_inargs[] = { GIMP_PDB_INT32, "size_type", - "The units of specified size: SIZE_PIXELS (0) or SIZE_POINTS (1)" + "The units of specified size: GIMP_PIXELS (0) or GIMP_POINTS (1)" }, { GIMP_PDB_STRING, diff --git a/libgimp/gimpmisc.c b/libgimp/gimpmisc.c index cc051e02db..1e18053b5d 100644 --- a/libgimp/gimpmisc.c +++ b/libgimp/gimpmisc.c @@ -247,31 +247,6 @@ gimp_get_bg_guchar (GimpDrawable *drawable, } } -GTimer* _timer = NULL; - -void -gimp_timer_start(void) -{ - g_return_if_fail (!_timer); - - _timer = g_timer_new (); -} - -void -gimp_timer_stop(void) -{ - double elapsed; - - g_return_if_fail (_timer != NULL); - - g_timer_stop (_timer); - elapsed = g_timer_elapsed (_timer, NULL); - g_timer_destroy (_timer); - _timer = NULL; - - g_print ("%ld seconds\n", elapsed); -} - static void gimp_rgn_render_row (guchar *src, guchar *dest, diff --git a/libgimp/gimpmisc.h b/libgimp/gimpmisc.h index c575e94cf0..67149753d5 100644 --- a/libgimp/gimpmisc.h +++ b/libgimp/gimpmisc.h @@ -69,9 +69,6 @@ void gimp_get_bg_guchar (GimpDrawable *drawable, gboolean transparent, guchar *bg); -void gimp_timer_start(void); -void gimp_timer_stop(void); - typedef void (*GimpRgnFunc1)(guchar *src, gint bpp, gpointer); typedef void (*GimpRgnFunc2)(guchar *src, guchar *dest, gint bpp, gpointer); diff --git a/libgimp/gimppixelfetcher.c b/libgimp/gimppixelfetcher.c index cc051e02db..1e18053b5d 100644 --- a/libgimp/gimppixelfetcher.c +++ b/libgimp/gimppixelfetcher.c @@ -247,31 +247,6 @@ gimp_get_bg_guchar (GimpDrawable *drawable, } } -GTimer* _timer = NULL; - -void -gimp_timer_start(void) -{ - g_return_if_fail (!_timer); - - _timer = g_timer_new (); -} - -void -gimp_timer_stop(void) -{ - double elapsed; - - g_return_if_fail (_timer != NULL); - - g_timer_stop (_timer); - elapsed = g_timer_elapsed (_timer, NULL); - g_timer_destroy (_timer); - _timer = NULL; - - g_print ("%ld seconds\n", elapsed); -} - static void gimp_rgn_render_row (guchar *src, guchar *dest, diff --git a/libgimp/gimppixelfetcher.h b/libgimp/gimppixelfetcher.h index c575e94cf0..67149753d5 100644 --- a/libgimp/gimppixelfetcher.h +++ b/libgimp/gimppixelfetcher.h @@ -69,9 +69,6 @@ void gimp_get_bg_guchar (GimpDrawable *drawable, gboolean transparent, guchar *bg); -void gimp_timer_start(void); -void gimp_timer_stop(void); - typedef void (*GimpRgnFunc1)(guchar *src, gint bpp, gpointer); typedef void (*GimpRgnFunc2)(guchar *src, guchar *dest, gint bpp, gpointer); diff --git a/libgimp/gimpregioniterator.c b/libgimp/gimpregioniterator.c index cc051e02db..1e18053b5d 100644 --- a/libgimp/gimpregioniterator.c +++ b/libgimp/gimpregioniterator.c @@ -247,31 +247,6 @@ gimp_get_bg_guchar (GimpDrawable *drawable, } } -GTimer* _timer = NULL; - -void -gimp_timer_start(void) -{ - g_return_if_fail (!_timer); - - _timer = g_timer_new (); -} - -void -gimp_timer_stop(void) -{ - double elapsed; - - g_return_if_fail (_timer != NULL); - - g_timer_stop (_timer); - elapsed = g_timer_elapsed (_timer, NULL); - g_timer_destroy (_timer); - _timer = NULL; - - g_print ("%ld seconds\n", elapsed); -} - static void gimp_rgn_render_row (guchar *src, guchar *dest, diff --git a/libgimp/gimpregioniterator.h b/libgimp/gimpregioniterator.h index c575e94cf0..67149753d5 100644 --- a/libgimp/gimpregioniterator.h +++ b/libgimp/gimpregioniterator.h @@ -69,9 +69,6 @@ void gimp_get_bg_guchar (GimpDrawable *drawable, gboolean transparent, guchar *bg); -void gimp_timer_start(void); -void gimp_timer_stop(void); - typedef void (*GimpRgnFunc1)(guchar *src, gint bpp, gpointer); typedef void (*GimpRgnFunc2)(guchar *src, guchar *dest, gint bpp, gpointer); diff --git a/plug-ins/common/newsprint.c b/plug-ins/common/newsprint.c index 099c09a4f0..b99be3b1f9 100644 --- a/plug-ins/common/newsprint.c +++ b/plug-ins/common/newsprint.c @@ -1776,6 +1776,10 @@ newsprint (GimpDrawable *drawable) gpointer pr; gint w002; +#ifdef TIMINGS + GTimer *timer = g_timer_new (); +#endif + width = pvals.cell_width; if (width < 0) @@ -1874,10 +1878,6 @@ do { \ progress = 0; max_progress = (x2 - x1) * (y2 - y1); -#ifdef TIMINGS - gimp_timer_start(); -#endif - for (y = y1; y < y2; y += tile_width - (y % tile_width)) { for (x = x1; x < x2; x += tile_width - (x % tile_width)) @@ -2035,7 +2035,8 @@ do { \ } #ifdef TIMINGS - gimp_timer_stop(); + g_printerr ("%f seconds\n", g_timer_elapsed (timer)); + g_timer_destroy (timer); #endif /* We don't free the threshold matrices, since we're about to diff --git a/plug-ins/common/unsharp.c b/plug-ins/common/unsharp.c index 615924ace7..61fe1db026 100644 --- a/plug-ins/common/unsharp.c +++ b/plug-ins/common/unsharp.c @@ -171,7 +171,7 @@ run (gchar *name, GimpPDBStatusType status = GIMP_PDB_SUCCESS; #ifdef TIMER - timerstart(); + GTimer *timer = g_timer_new (); #endif run_mode = param[0].data.d_int32; @@ -237,8 +237,10 @@ run (gchar *name, gimp_drawable_detach(drawable); values[0].data.d_status = status; } + #ifdef TIMER - timerstop (); + g_printerr ("%f seconds\n", g_timer_elapsed (timer)); + g_timer_destroy (timer); #endif } diff --git a/tools/pdbgen/enums.pl b/tools/pdbgen/enums.pl index 0abb8028df..65c4161c74 100644 --- a/tools/pdbgen/enums.pl +++ b/tools/pdbgen/enums.pl @@ -362,9 +362,9 @@ package Gimp::CodeGen::enums; SizeType => { contig => 1, header => 'core/core-types.h', - symbols => [ qw(SIZE_PIXELS SIZE_POINTS) ], - mapping => { SIZE_PIXELS => '0', - SIZE_POINTS => '1' } + symbols => [ qw(GIMP_PIXELS GIMP_POINTS) ], + mapping => { GIMP_PIXELS => '0', + GIMP_POINTS => '1' } }, GimpCloneType => { contig => 1,