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 x,
gint y) gint y)
{ {
GeglBuffer *src_buffer; GeglBuffer *src_buffer;
GeglBuffer *mask_buffer; GeglBuffer *mask_buffer;
const Babl *format; const Babl *format;
gint n_components; GeglRectangle extent;
gboolean has_alpha; gint n_components;
gfloat start_col[MAX_CHANNELS]; gboolean has_alpha;
gfloat start_col[MAX_CHANNELS];
g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), NULL); 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; select_transparent = FALSE;
} }
mask_buffer = gegl_buffer_new (gegl_buffer_get_extent (src_buffer), extent = *gegl_buffer_get_extent (src_buffer);
babl_format ("Y float"));
GIMP_TIMER_START(); mask_buffer = gegl_buffer_new (&extent, babl_format ("Y float"));
find_contiguous_region (src_buffer, mask_buffer, if (x >= extent.x && x < (extent.x + extent.width) &&
format, n_components, has_alpha, y >= extent.y && y < (extent.y + extent.height))
select_transparent, select_criterion, {
antialias, threshold, GIMP_TIMER_START();
x, y, start_col);
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; return mask_buffer;
} }