[gimp] app: fill the smudge accum buffer with GEGL
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: fill the smudge accum buffer with GEGL
- Date: Wed, 2 May 2012 16:09:19 +0000 (UTC)
commit 14b381756b72077026727b3db4e6ccbfe03d7140
Author: Michael Natterer <mitch gimp org>
Date: Mon Mar 19 21:09:35 2012 +0100
app: fill the smudge accum buffer with GEGL
app/paint/gimpsmudge.c | 29 +++++++++++++++++++++--------
1 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/app/paint/gimpsmudge.c b/app/paint/gimpsmudge.c
index b9b9253..3d3d947 100644
--- a/app/paint/gimpsmudge.c
+++ b/app/paint/gimpsmudge.c
@@ -28,6 +28,8 @@
#include "paint-funcs/paint-funcs.h"
+#include "gegl/gimp-gegl-utils.h"
+
#include "core/gimp.h"
#include "core/gimpbrush.h"
#include "core/gimpdrawable.h"
@@ -200,22 +202,33 @@ gimp_smudge_start (GimpPaintCore *paint_core,
smudge->accum_size != area->width ||
smudge->accum_size != area->height)
{
- guchar fill[4];
-
- gimp_pickable_get_pixel_at (GIMP_PICKABLE (drawable),
+ GeglBuffer *buffer;
+ GeglRectangle rect = { 0, 0, smudge->accum_size, smudge->accum_size };
+ GimpRGB pixel;
+ GeglColor *color;
+
+ buffer = gegl_buffer_linear_new_from_data (smudge->accum_data,
+ gimp_drawable_get_format (drawable),
+ &rect,
+ smudge->accum_size * bytes,
+ NULL, NULL);
+
+ gimp_pickable_get_color_at (GIMP_PICKABLE (drawable),
CLAMP ((gint) coords->x,
0,
gimp_item_get_width (GIMP_ITEM (drawable)) - 1),
CLAMP ((gint) coords->y,
0,
gimp_item_get_height (GIMP_ITEM (drawable)) - 1),
- fill);
+ &pixel);
+
+ color = gegl_color_new (NULL);
+ gimp_gegl_color_set_rgba (color, &pixel);
- pixel_region_init_data (&srcPR, smudge->accum_data,
- bytes, bytes * smudge->accum_size,
- 0, 0, smudge->accum_size, smudge->accum_size);
+ gegl_buffer_set_color (buffer, &rect, color);
+ g_object_unref (color);
- color_region (&srcPR, fill);
+ g_object_unref (buffer);
}
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]