Commit 3c8a10e9 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/base/siox.c moved rectangle intersection into

2005-08-06  Sven Neumann  <sven@gimp.org>

	* app/base/siox.c
	* app/core/gimpdrawable-foreground-extract.c: moved rectangle
	intersection into gimp_drawable_foreground_extract().
parent 68f09c7c
2005-08-06 Sven Neumann <sven@gimp.org>
* app/base/siox.c
* app/core/gimpdrawable-foreground-extract.c: moved rectangle
intersection into gimp_drawable_foreground_extract().
2005-08-06 Sven Neumann <sven@gimp.org>
* app/core/gimpscanconvert.[ch]: added gimp_scan_convert_compose(),
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment