Bug 735513 - Fuzzy select (magic wand) freeze w/select transparent areas

gimp_pickable_contiguous_region_by_seed(): don't call
find_contiguous_region() with start coords outside the buffer, or it
will run into an infinite loop.
This commit is contained in:
Michael Natterer 2014-08-27 21:12:46 +02:00
parent f38d3a1672
commit b6eb88dbf9
1 changed files with 21 additions and 15 deletions

View File

@ -90,12 +90,13 @@ gimp_pickable_contiguous_region_by_seed (GimpPickable *pickable,
gint x,
gint y)
{
GeglBuffer *src_buffer;
GeglBuffer *mask_buffer;
const Babl *format;
gint n_components;
gboolean has_alpha;
gfloat start_col[MAX_CHANNELS];
GeglBuffer *src_buffer;
GeglBuffer *mask_buffer;
const Babl *format;
GeglRectangle extent;
gint n_components;
gboolean has_alpha;
gfloat start_col[MAX_CHANNELS];
g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), NULL);
@ -125,18 +126,23 @@ gimp_pickable_contiguous_region_by_seed (GimpPickable *pickable,
select_transparent = FALSE;
}
mask_buffer = gegl_buffer_new (gegl_buffer_get_extent (src_buffer),
babl_format ("Y float"));
extent = *gegl_buffer_get_extent (src_buffer);
GIMP_TIMER_START();
mask_buffer = gegl_buffer_new (&extent, babl_format ("Y float"));
find_contiguous_region (src_buffer, mask_buffer,
format, n_components, has_alpha,
select_transparent, select_criterion,
antialias, threshold,
x, y, start_col);
if (x >= extent.x && x < (extent.x + extent.width) &&
y >= extent.y && y < (extent.y + extent.height))
{
GIMP_TIMER_START();
GIMP_TIMER_END("foo")
find_contiguous_region (src_buffer, mask_buffer,
format, n_components, has_alpha,
select_transparent, select_criterion,
antialias, threshold,
x, y, start_col);
GIMP_TIMER_END("foo");
}
return mask_buffer;
}