From 3c8a10e92507131fc7bf43559b5110bdc818caab Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Sat, 6 Aug 2005 15:09:31 +0000 Subject: [PATCH] app/base/siox.c moved rectangle intersection into 2005-08-06 Sven Neumann * app/base/siox.c * app/core/gimpdrawable-foreground-extract.c: moved rectangle intersection into gimp_drawable_foreground_extract(). --- ChangeLog | 6 ++++++ app/base/siox.c | 16 ---------------- app/core/gimpdrawable-foreground-extract.c | 16 ++++++++++++++++ app/tools/gimpforegroundselecttool.c | 11 ++++++----- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index e3a5a74611..5817d3b9dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-08-06 Sven Neumann + + * app/base/siox.c + * app/core/gimpdrawable-foreground-extract.c: moved rectangle + intersection into gimp_drawable_foreground_extract(). + 2005-08-06 Sven Neumann * app/core/gimpscanconvert.[ch]: added gimp_scan_convert_compose(), diff --git a/app/base/siox.c b/app/base/siox.c index b0ab473db5..0add95e949 100644 --- a/app/base/siox.c +++ b/app/base/siox.c @@ -44,8 +44,6 @@ #include "paint-funcs/paint-funcs.h" -#include "core/gimp-utils.h" /* FIXME (gimp_rectangle_intersect) */ - #include "cpercep.h" #include "pixel-region.h" #include "siox.h" @@ -809,7 +807,6 @@ siox_foreground_extract (TileManager *pixels, PixelRegion srcPR; PixelRegion mapPR; gpointer pr; - gboolean intersect; gint bpp; gint row, col; const gfloat clustersize = get_clustersize (limits); @@ -830,19 +827,6 @@ siox_foreground_extract (TileManager *pixels, g_return_if_fail (y + height <= tile_manager_height (mask)); g_return_if_fail (progress_data == NULL || progress_callback != NULL); - intersect = gimp_rectangle_intersect (offset_x, offset_y, - tile_manager_width (pixels), - tile_manager_height (pixels), - x, y, width, height, - &x, &y, &width, &height); - - /* FIXME: - * Should clear the mask outside the rectangle that we are working on. - */ - - if (! intersect) - return; - cpercep_init (); siox_progress_update (progress_callback, progress_data, 0.0); diff --git a/app/core/gimpdrawable-foreground-extract.c b/app/core/gimpdrawable-foreground-extract.c index cc43c59da8..4bdedc1d53 100644 --- a/app/core/gimpdrawable-foreground-extract.c +++ b/app/core/gimpdrawable-foreground-extract.c @@ -32,6 +32,7 @@ #include "gimpimage.h" #include "gimpimage-colormap.h" #include "gimpprogress.h" +#include "gimp-utils.h" #include "gimp-intl.h" @@ -65,6 +66,7 @@ gimp_drawable_foreground_extract_rect (GimpDrawable *drawable, { GimpImage *gimage; const guchar *colormap = NULL; + gboolean intersect; gint offset_x; gint offset_y; @@ -83,6 +85,20 @@ gimp_drawable_foreground_extract_rect (GimpDrawable *drawable, gimp_item_offsets (GIMP_ITEM (drawable), &offset_x, &offset_y); + intersect = gimp_rectangle_intersect (offset_x, offset_y, + gimp_item_width (GIMP_ITEM (drawable)), + gimp_item_height (GIMP_ITEM (drawable)), + x, y, width, height, + &x, &y, &width, &height); + + + /* FIXME: + * Clear the mask outside the rectangle that we are working on? + */ + + if (! intersect) + return; + if (progress) gimp_progress_start (progress, _("Foreground Extraction..."), FALSE); diff --git a/app/tools/gimpforegroundselecttool.c b/app/tools/gimpforegroundselecttool.c index e6ef8f4d61..98af523f06 100644 --- a/app/tools/gimpforegroundselecttool.c +++ b/app/tools/gimpforegroundselecttool.c @@ -524,10 +524,6 @@ gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel, 0, 0, 127); gimp_scan_convert_free (scan_convert); - /* apply foreground and background markers */ - for (list = fg_select->strokes; list; list = list->next) - gimp_foreground_select_tool_stroke (mask, list->data); - /* restrict working area to double the size of the bounding box */ gimp_channel_bounds (mask, &x, &y, &x2, &y2); width = x2 - x; @@ -538,6 +534,10 @@ gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel, width = MIN (width * 2, gimp_item_width (GIMP_ITEM (mask)) - x); height = MIN (height * 2, gimp_item_height (GIMP_ITEM (mask)) - y); + /* apply foreground and background markers */ + for (list = fg_select->strokes; list; list = list->next) + gimp_foreground_select_tool_stroke (mask, list->data); + gimp_drawable_foreground_extract_rect (drawable, GIMP_FOREGROUND_EXTRACT_SIOX, GIMP_DRAWABLE (mask), @@ -674,7 +674,8 @@ gimp_foreground_select_tool_push_stroke (GimpForegroundSelectTool *fg_select, stroke = g_new (FgSelectStroke, 1); stroke->background = options->background; - stroke->width = options->stroke_width / SCALEFACTOR_Y (shell); + stroke->width = ROUND ((gdouble) options->stroke_width / + SCALEFACTOR_Y (shell)); stroke->num_points = fg_select->stroke->len; stroke->points = (GimpVector2 *) g_array_free (fg_select->stroke, FALSE);