[gimp] app: speed up gimp_image_contiguous_region_by_seed using a temporary GeglBuffer
- From: Michael Henning <mhenning src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: speed up gimp_image_contiguous_region_by_seed using a temporary GeglBuffer
- Date: Mon, 8 Apr 2013 19:06:42 +0000 (UTC)
commit e839ae09559890c0d11bea4033303a0f3b850de1
Author: Michael Henning <drawoc darkrefraction com>
Date: Mon Apr 8 15:02:23 2013 -0400
app: speed up gimp_image_contiguous_region_by_seed using a temporary GeglBuffer
This is identical to c204b0ac413539ee763483970a64eb437a43de3f, except
it avoids setting the buffer type of the drawable using a buffer copy.
(that issue is explained in d53deda61bf60535a8505b7f6e6e37d28f405925)
app/core/gimpimage-contiguous-region.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/app/core/gimpimage-contiguous-region.c b/app/core/gimpimage-contiguous-region.c
index 9b94dff..b00b0fe 100644
--- a/app/core/gimpimage-contiguous-region.c
+++ b/app/core/gimpimage-contiguous-region.c
@@ -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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]