From a779b9b302348f8ab0c52122cb72ac751e73103f Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Wed, 26 Apr 2006 14:18:10 +0000 Subject: [PATCH] added newlines. 2006-04-26 Sven Neumann * app/base/siox.c (depth_first_search): added newlines. * app/core/gimpimage-contiguous-region.c: added const qualifiers. --- ChangeLog | 6 ++++ app/base/siox.c | 43 +++++++++++++------------- app/core/gimpimage-contiguous-region.c | 26 ++++++++-------- 3 files changed, 41 insertions(+), 34 deletions(-) diff --git a/ChangeLog b/ChangeLog index 39aa91da04..688d7b0ca7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-04-26 Sven Neumann + + * app/base/siox.c (depth_first_search): added newlines. + + * app/core/gimpimage-contiguous-region.c: added const qualifiers. + 2006-04-26 Sven Neumann * plug-ins/common/unsharp.c: use gimp_progress_set_text() instead diff --git a/app/base/siox.c b/app/base/siox.c index b99c696e80..515f05f35c 100644 --- a/app/base/siox.c +++ b/app/base/siox.c @@ -511,10 +511,10 @@ struct blob }; /* This method checks out the neighbourhood of the pixel at position - * (x,y) in the TileManager mask, it adds the sourrounding - * pixels to the queue to allow further processing it uses maskVal to - * determine if the sourounding pixels have already been visited x,y - * are passed from above. + * (x,y) in the TileManager mask, it adds the surrounding pixels to + * the queue to allow further processing it uses maskVal to determine + * if the surrounding pixels have already been visited x,y are passed + * from above. */ static void depth_first_search (TileManager *mask, @@ -525,15 +525,15 @@ depth_first_search (TileManager *mask, struct blob *b, guchar mark) { - gint oldx = -1; - gint xx = b->seedx; - gint yy = b->seedy; - guchar val; - + gint xx = b->seedx; + gint yy = b->seedy; + gint oldx = -1; GSList *stack = NULL; while (TRUE) { + guchar val; + if (oldx == xx) { if (stack == NULL) @@ -544,9 +544,11 @@ depth_first_search (TileManager *mask, yy = GPOINTER_TO_INT (stack->data); stack = g_slist_delete_link (stack, stack); } + oldx = xx; read_pixel_data_1 (mask, xx, yy, &val); + if (val && (val != mark)) { if (mark == FIND_BLOB_VISITED) @@ -559,22 +561,21 @@ depth_first_search (TileManager *mask, write_pixel_data_1 (mask, xx, yy, &mark); if (yy > y) - stack = - g_slist_prepend (g_slist_prepend - (stack, GINT_TO_POINTER (yy - 1)), - GINT_TO_POINTER (xx)); + stack = g_slist_prepend (g_slist_prepend + (stack, GINT_TO_POINTER (yy - 1)), + GINT_TO_POINTER (xx)); + if (yy + 1 < yheight) - stack = - g_slist_prepend (g_slist_prepend - (stack, GINT_TO_POINTER (yy + 1)), - GINT_TO_POINTER (xx)); + stack = g_slist_prepend (g_slist_prepend + (stack, GINT_TO_POINTER (yy + 1)), + GINT_TO_POINTER (xx)); + if (xx + 1 < xwidth) { if (xx > x) - stack = - g_slist_prepend (g_slist_prepend (stack, - GINT_TO_POINTER (yy)), - GINT_TO_POINTER (xx - 1)); + stack = g_slist_prepend (g_slist_prepend (stack, + GINT_TO_POINTER (yy)), + GINT_TO_POINTER (xx - 1)); ++xx; } else if (xx > x) diff --git a/app/core/gimpimage-contiguous-region.c b/app/core/gimpimage-contiguous-region.c index 591804eabe..653196f311 100644 --- a/app/core/gimpimage-contiguous-region.c +++ b/app/core/gimpimage-contiguous-region.c @@ -56,8 +56,8 @@ static void contiguous_region_by_color (ContinuousRegionData *cont, PixelRegion *imagePR, PixelRegion *maskPR); -static gint pixel_difference (guchar *col1, - guchar *col2, +static gint pixel_difference (const guchar *col1, + const guchar *col2, gboolean antialias, gint threshold, gint bytes, @@ -72,7 +72,7 @@ static void ref_tiles (TileManager *src, guchar **s, guchar **m); static gint find_contiguous_segment (GimpImage *image, - guchar *col, + const guchar *col, PixelRegion *src, PixelRegion *mask, gint width, @@ -95,7 +95,7 @@ static void find_contiguous_region_helper (GimpImage *image, gint threshold, gint x, gint y, - guchar *col); + const guchar *col); /* public functions */ @@ -317,13 +317,13 @@ contiguous_region_by_color (ContinuousRegionData *cont, } static gint -pixel_difference (guchar *col1, - guchar *col2, - gboolean antialias, - gint threshold, - gint bytes, - gboolean has_alpha, - gboolean select_transparent) +pixel_difference (const guchar *col1, + const guchar *col2, + gboolean antialias, + gint threshold, + gint bytes, + gboolean has_alpha, + gboolean select_transparent) { gint max = 0; @@ -395,7 +395,7 @@ ref_tiles (TileManager *src, static int find_contiguous_segment (GimpImage *image, - guchar *col, + const guchar *col, PixelRegion *src, PixelRegion *mask, gint width, @@ -523,7 +523,7 @@ find_contiguous_region_helper (GimpImage *image, gint threshold, gint x, gint y, - guchar *col) + const guchar *col) { gint start, end; gint new_start, new_end;