app: more GEGL in gimp_smudge_motion()
This commit is contained in:
@ -209,7 +209,6 @@ gimp_smudge_start (GimpPaintCore *paint_core,
|
|||||||
GimpRGB pixel;
|
GimpRGB pixel;
|
||||||
GeglColor *color;
|
GeglColor *color;
|
||||||
|
|
||||||
|
|
||||||
gimp_pickable_get_color_at (GIMP_PICKABLE (drawable),
|
gimp_pickable_get_color_at (GIMP_PICKABLE (drawable),
|
||||||
CLAMP ((gint) coords->x,
|
CLAMP ((gint) coords->x,
|
||||||
0,
|
0,
|
||||||
@ -254,8 +253,11 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
|
|||||||
GimpDynamicsOutput *rate_output;
|
GimpDynamicsOutput *rate_output;
|
||||||
GimpDynamicsOutput *hardness_output;
|
GimpDynamicsOutput *hardness_output;
|
||||||
GimpImage *image;
|
GimpImage *image;
|
||||||
TempBuf *area;
|
GeglBuffer *paint_buffer;
|
||||||
PixelRegion srcPR, destPR, tempPR;
|
gint paint_buffer_x;
|
||||||
|
gint paint_buffer_y;
|
||||||
|
GeglBuffer *accum_buffer;
|
||||||
|
PixelRegion srcPR, tempPR;
|
||||||
gdouble fade_point;
|
gdouble fade_point;
|
||||||
gdouble opacity;
|
gdouble opacity;
|
||||||
gdouble rate;
|
gdouble rate;
|
||||||
@ -281,9 +283,11 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
|
|||||||
if (opacity == 0.0)
|
if (opacity == 0.0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options,
|
paint_buffer = gimp_paint_core_get_paint_buffer (paint_core, drawable,
|
||||||
coords);
|
paint_options, coords,
|
||||||
if (! area)
|
&paint_buffer_x,
|
||||||
|
&paint_buffer_y);
|
||||||
|
if (! paint_buffer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Get the unclipped acumulator coordinates */
|
/* Get the unclipped acumulator coordinates */
|
||||||
@ -291,7 +295,10 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
|
|||||||
|
|
||||||
/* srcPR will be the pixels under the current painthit from the drawable */
|
/* srcPR will be the pixels under the current painthit from the drawable */
|
||||||
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
|
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
|
||||||
area->x, area->y, area->width, area->height, FALSE);
|
paint_buffer_x,
|
||||||
|
paint_buffer_y,
|
||||||
|
gegl_buffer_get_width (paint_buffer),
|
||||||
|
gegl_buffer_get_height (paint_buffer), FALSE);
|
||||||
|
|
||||||
/* Enable dynamic rate */
|
/* Enable dynamic rate */
|
||||||
rate_output = gimp_dynamics_get_output (dynamics,
|
rate_output = gimp_dynamics_get_output (dynamics,
|
||||||
@ -306,14 +313,10 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
|
|||||||
|
|
||||||
/* The tempPR will be the built up buffer (for smudge) */
|
/* The tempPR will be the built up buffer (for smudge) */
|
||||||
pixel_region_init_temp_buf (&tempPR, smudge->accum_temp,
|
pixel_region_init_temp_buf (&tempPR, smudge->accum_temp,
|
||||||
area->x - x,
|
paint_buffer_x - x,
|
||||||
area->y - y,
|
paint_buffer_y - y,
|
||||||
area->width,
|
gegl_buffer_get_width (paint_buffer),
|
||||||
area->height);
|
gegl_buffer_get_height (paint_buffer));
|
||||||
|
|
||||||
/* The dest will be the paint area we got above (= paint_area) */
|
|
||||||
pixel_region_init_temp_buf (&destPR, area,
|
|
||||||
0, 0, area->width, area->height);
|
|
||||||
|
|
||||||
/* Smudge uses the buffer Accum.
|
/* Smudge uses the buffer Accum.
|
||||||
* For each successive painthit Accum is built like this
|
* For each successive painthit Accum is built like this
|
||||||
@ -325,17 +328,19 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
|
|||||||
|
|
||||||
blend_region (&srcPR, &tempPR, &tempPR, ROUND (rate * 255.0));
|
blend_region (&srcPR, &tempPR, &tempPR, ROUND (rate * 255.0));
|
||||||
|
|
||||||
/* re-init the tempPR */
|
accum_buffer =
|
||||||
pixel_region_init_temp_buf (&tempPR, smudge->accum_temp,
|
gimp_temp_buf_create_buffer (smudge->accum_temp,
|
||||||
area->x - x,
|
gimp_drawable_get_format (drawable));
|
||||||
area->y - y,
|
|
||||||
area->width,
|
|
||||||
area->height);
|
|
||||||
|
|
||||||
if (! gimp_drawable_has_alpha (drawable))
|
gegl_buffer_copy (accum_buffer,
|
||||||
add_alpha_region (&tempPR, &destPR);
|
GIMP_GEGL_RECT (paint_buffer_x - x,
|
||||||
else
|
paint_buffer_y - y,
|
||||||
copy_region (&tempPR, &destPR);
|
gegl_buffer_get_width (paint_buffer),
|
||||||
|
gegl_buffer_get_height (paint_buffer)),
|
||||||
|
paint_buffer,
|
||||||
|
GIMP_GEGL_RECT (0, 0, 0, 0));
|
||||||
|
|
||||||
|
g_object_unref (accum_buffer);
|
||||||
|
|
||||||
hardness_output = gimp_dynamics_get_output (dynamics,
|
hardness_output = gimp_dynamics_get_output (dynamics,
|
||||||
GIMP_DYNAMICS_OUTPUT_HARDNESS);
|
GIMP_DYNAMICS_OUTPUT_HARDNESS);
|
||||||
|
Reference in New Issue
Block a user