Smudge problem on offset layers (fixes #8999)

This commit is contained in:
programmer-ceds 2023-01-03 17:23:32 +00:00 committed by Jehan
parent 8a066f0430
commit 0c89be5f06
1 changed files with 17 additions and 9 deletions

View File

@ -213,7 +213,7 @@ gimp_smudge_start (GimpPaintCore *paint_core,
GimpPickable *dest_pickable; GimpPickable *dest_pickable;
GeglBuffer *pickable_buffer; GeglBuffer *pickable_buffer;
GeglBuffer *paint_buffer; GeglBuffer *paint_buffer;
GimpCoords *coords; GimpCoords coords;
gint dest_pickable_off_x; gint dest_pickable_off_x;
gint dest_pickable_off_y; gint dest_pickable_off_y;
gint paint_buffer_x; gint paint_buffer_x;
@ -222,12 +222,18 @@ gimp_smudge_start (GimpPaintCore *paint_core,
gint n_strokes; gint n_strokes;
gint i; gint i;
gint x, y; gint x, y;
gint off_x, off_y;
coords = *(gimp_symmetry_get_origin (sym));
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
coords.x -= off_x;
coords.y -= off_y;
coords = gimp_symmetry_get_origin (sym);
gimp_brush_core_eval_transform_dynamics (brush_core, gimp_brush_core_eval_transform_dynamics (brush_core,
gimp_item_get_image (GIMP_ITEM (drawable)), gimp_item_get_image (GIMP_ITEM (drawable)),
paint_options, paint_options,
coords); &coords);
if (options->sample_merged) if (options->sample_merged)
{ {
@ -252,9 +258,11 @@ gimp_smudge_start (GimpPaintCore *paint_core,
{ {
GeglBuffer *accum_buffer; GeglBuffer *accum_buffer;
coords = gimp_symmetry_get_coords (sym, i); coords = *(gimp_symmetry_get_coords (sym, i));
coords.x -= off_x;
coords.y -= off_y;
gimp_smudge_accumulator_size (paint_options, coords, &accum_size); gimp_smudge_accumulator_size (paint_options, &coords, &accum_size);
/* Allocate the accumulation buffer */ /* Allocate the accumulation buffer */
accum_buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0, accum_buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0,
@ -270,14 +278,14 @@ gimp_smudge_start (GimpPaintCore *paint_core,
paint_buffer = gimp_paint_core_get_paint_buffer (paint_core, drawable, paint_buffer = gimp_paint_core_get_paint_buffer (paint_core, drawable,
paint_options, paint_options,
GIMP_LAYER_MODE_NORMAL, GIMP_LAYER_MODE_NORMAL,
coords, &coords,
&paint_buffer_x, &paint_buffer_x,
&paint_buffer_y, &paint_buffer_y,
NULL, NULL); NULL, NULL);
if (! paint_buffer) if (! paint_buffer)
continue; continue;
gimp_smudge_accumulator_coords (paint_core, coords, 0, &x, &y); gimp_smudge_accumulator_coords (paint_core, &coords, 0, &x, &y);
/* If clipped, prefill the smudge buffer with the color at the /* If clipped, prefill the smudge buffer with the color at the
* brush position. * brush position.
@ -292,10 +300,10 @@ gimp_smudge_start (GimpPaintCore *paint_core,
gint pick_x; gint pick_x;
gint pick_y; gint pick_y;
pick_x = CLAMP ((gint) coords->x + dest_pickable_off_x, pick_x = CLAMP ((gint) coords.x + dest_pickable_off_x,
0, 0,
gegl_buffer_get_width (pickable_buffer) - 1); gegl_buffer_get_width (pickable_buffer) - 1);
pick_y = CLAMP ((gint) coords->y + dest_pickable_off_y, pick_y = CLAMP ((gint) coords.y + dest_pickable_off_y,
0, 0,
gegl_buffer_get_height (pickable_buffer) - 1); gegl_buffer_get_height (pickable_buffer) - 1);