app: fix broken symmetry on offset layers

Painting with symmetry enabled on layers with offset was broken. Fixed
it.
This commit is contained in:
Shubham 2023-06-30 01:55:29 +05:30 committed by Jehan
parent 8f09092ed3
commit 8463544502
7 changed files with 30 additions and 24 deletions

View File

@ -154,6 +154,7 @@ gimp_convolve_motion (GimpPaintCore *paint_core,
coords = *(gimp_symmetry_get_origin (sym));
coords.x -= off_x;
coords.y -= off_y;
gimp_symmetry_set_origin (sym, drawable, &coords);
opacity = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_OPACITY,
@ -171,8 +172,6 @@ gimp_convolve_motion (GimpPaintCore *paint_core,
for (i = 0; i < n_strokes; i++)
{
coords = *(gimp_symmetry_get_coords (sym, i));
coords.x -= off_x;
coords.y -= off_y;
gimp_brush_core_eval_transform_symmetry (brush_core, sym, i);

View File

@ -140,6 +140,7 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
coords = *(gimp_symmetry_get_origin (sym));
coords.x -= off_x;
coords.y -= off_y;
gimp_symmetry_set_origin (sym, drawable, &coords);
opacity = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_OPACITY,
@ -162,8 +163,6 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
for (i = 0; i < n_strokes; i++)
{
coords = *(gimp_symmetry_get_coords (sym, i));
coords.x -= off_x;
coords.y -= off_y;
gimp_brush_core_eval_transform_symmetry (brush_core, sym, i);

View File

@ -330,6 +330,11 @@ gimp_ink_motion (GimpPaintCore *paint_core,
gint i;
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
coords = *(gimp_symmetry_get_origin (sym));
coords.x -= off_x;
coords.y -= off_y;
gimp_symmetry_set_origin (sym, drawable, &coords);
n_strokes = gimp_symmetry_get_size (sym);
if (ink->last_blobs &&
@ -352,8 +357,6 @@ gimp_ink_motion (GimpPaintCore *paint_core,
GimpMatrix3 transform;
coords = *(gimp_symmetry_get_coords (sym, i));
coords.x -= off_x;
coords.y -= off_y;
gimp_symmetry_get_matrix (sym, i, &transform);
@ -385,8 +388,6 @@ gimp_ink_motion (GimpPaintCore *paint_core,
GimpMatrix3 transform;
coords = *(gimp_symmetry_get_coords (sym, i));
coords.x -= off_x;
coords.y -= off_y;
gimp_symmetry_get_matrix (sym, i, &transform);
@ -423,8 +424,6 @@ gimp_ink_motion (GimpPaintCore *paint_core,
GimpBlob *blob_to_render = g_list_nth_data (blobs_to_render, i);
coords = *(gimp_symmetry_get_coords (sym, i));
coords.x -= off_x;
coords.y -= off_y;
ink->cur_blob = blob_to_render;
paint_buffer = gimp_paint_core_get_paint_buffer (paint_core, drawable,

View File

@ -255,6 +255,7 @@ gimp_mybrush_core_motion (GimpPaintCore *paint_core,
{
GimpMybrushCore *mybrush = GIMP_MYBRUSH_CORE (paint_core);
MyPaintRectangle rect;
GimpCoords coords;
GList *iter;
gdouble dt = 0.0;
gint off_x, off_y;
@ -264,6 +265,11 @@ gimp_mybrush_core_motion (GimpPaintCore *paint_core,
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
n_strokes = gimp_symmetry_get_size (sym);
coords = *(gimp_symmetry_get_origin (sym));
coords.x -= off_x;
coords.y -= off_y;
gimp_symmetry_set_origin (sym, drawable, &coords);
/* The number of strokes may change during a motion, depending on
* the type of symmetry. When that happens, reset the brushes.
*/
@ -281,13 +287,14 @@ gimp_mybrush_core_motion (GimpPaintCore *paint_core,
iter;
iter = g_list_next (iter), i++)
{
MyPaintBrush *brush = iter->data;
GimpCoords coords = *(gimp_symmetry_get_coords (sym, i));
MyPaintBrush *brush = iter->data;
coords = *(gimp_symmetry_get_coords (sym, i));
mypaint_brush_stroke_to (brush,
(MyPaintSurface *) mybrush->private->surface,
coords.x - off_x,
coords.y - off_y,
coords.x,
coords.y,
0.0f,
coords.xtilt,
coords.ytilt,
@ -318,8 +325,8 @@ gimp_mybrush_core_motion (GimpPaintCore *paint_core,
mypaint_brush_stroke_to (brush,
(MyPaintSurface *) mybrush->private->surface,
coords.x - off_x,
coords.y - off_y,
coords.x,
coords.y,
pressure,
coords.xtilt,
coords.ytilt,

View File

@ -247,6 +247,7 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
coords = *(gimp_symmetry_get_origin (sym));
coords.x -= off_x;
coords.y -= off_y;
gimp_symmetry_set_origin (sym, drawable, &coords);
/* Some settings are based on the original stroke. */
opacity *= gimp_dynamics_get_linear_value (dynamics,
@ -296,8 +297,6 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
&paint_color);
coords = *(gimp_symmetry_get_coords (sym, i));
coords.x -= off_x;
coords.y -= off_y;
if (GIMP_BRUSH_CORE_GET_CLASS (brush_core)->handles_transforming_brush)
gimp_brush_core_eval_transform_symmetry (brush_core, sym, i);

View File

@ -401,6 +401,8 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
coords = *(gimp_symmetry_get_origin (sym));
coords.x -= off_x;
coords.y -= off_y;
gimp_symmetry_set_origin (sym, drawable, &coords);
opacity = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_OPACITY,
&coords,
@ -464,8 +466,6 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
for (i = 0; i < n_strokes; i++)
{
coords = *(gimp_symmetry_get_coords (sym, i));
coords.x -= off_x;
coords.y -= off_y;
gimp_brush_core_eval_transform_symmetry (brush_core, sym, i);

View File

@ -337,6 +337,13 @@ gimp_source_core_motion (GimpSourceCore *source_core,
origin = *(gimp_symmetry_get_origin (sym));
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
coords = origin;
coords.x -= off_x;
coords.y -= off_y;
gimp_symmetry_set_origin (sym, drawable, &coords);
/* Some settings are based on the original stroke. */
opacity = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_OPACITY,
@ -346,8 +353,6 @@ gimp_source_core_motion (GimpSourceCore *source_core,
if (opacity == 0.0)
return;
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
base_src_offset_x = source_core->offset_x;
base_src_offset_y = source_core->offset_y;
@ -398,8 +403,6 @@ gimp_source_core_motion (GimpSourceCore *source_core,
for (i = 0; i < n_strokes; i++)
{
coords = *(gimp_symmetry_get_coords (sym, i));
coords.x -= off_x;
coords.y -= off_y;
gimp_brush_core_eval_transform_symmetry (brush_core, sym, i);