Commit e839ae09 authored by Michael Henning's avatar Michael Henning

app: speed up gimp_image_contiguous_region_by_seed using a temporary GeglBuffer

This is identical to c204b0ac, except
it avoids setting the buffer type of the drawable using a buffer copy.
(that issue is explained in d53deda6)
parent 35cc6447
......@@ -135,11 +135,10 @@ gimp_image_contiguous_region_by_seed (GimpImage *image,
select_transparent = FALSE;
}
mask = gimp_channel_new_mask (image,
gegl_buffer_get_width (src_buffer),
gegl_buffer_get_height (src_buffer));
mask_buffer = gegl_buffer_new (gegl_buffer_get_extent (src_buffer),
babl_format ("Y float"));
mask_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (mask));
gegl_buffer_clear (mask_buffer, NULL);
find_contiguous_region_helper (src_buffer, mask_buffer,
format, n_components, has_alpha,
......@@ -147,6 +146,16 @@ gimp_image_contiguous_region_by_seed (GimpImage *image,
antialias, threshold,
x, y, start_col);
/* wrap mask_buffer in a drawable and return it */
mask = gimp_channel_new_mask (image,
gegl_buffer_get_width (mask_buffer),
gegl_buffer_get_height (mask_buffer));
gegl_buffer_copy (mask_buffer, NULL,
gimp_drawable_get_buffer (GIMP_DRAWABLE (mask)), NULL);
g_object_unref (mask_buffer);
return mask;
}
......
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