Commit d1795ac2 authored by Michael Natterer's avatar Michael Natterer 😴

Bug 700193 - undoing paint tools doesn't update last_coords properly

paint_core->start_coords is in fact the last stroke's endpoint and
only used for storing it in GimpPaintCoreUndo, so the last endpoint
can be resotred for straight-line painting after an undo. Make the
code actually doing that.
parent 37372555
......@@ -67,8 +67,7 @@ gimp_paint_core_stroke (GimpPaintCore *core,
{
gint i;
core->start_coords = strokes[0];
core->last_coords = strokes[0];
core->last_coords = strokes[0];
gimp_paint_core_paint (core, drawable, paint_options,
GIMP_PAINT_STATE_INIT, 0);
......@@ -179,9 +178,8 @@ gimp_paint_core_stroke_boundary (GimpPaintCore *core,
initialized = TRUE;
core->cur_coords = coords[0];
core->start_coords = coords[0];
core->last_coords = coords[0];
core->cur_coords = coords[0];
core->last_coords = coords[0];
gimp_paint_core_paint (core, drawable, paint_options,
GIMP_PAINT_STATE_INIT, 0);
......@@ -283,9 +281,8 @@ gimp_paint_core_stroke_vectors (GimpPaintCore *core,
{
initialized = TRUE;
core->cur_coords = g_array_index (coords, GimpCoords, 0);
core->start_coords = g_array_index (coords, GimpCoords, 0);
core->last_coords = g_array_index (coords, GimpCoords, 0);
core->cur_coords = g_array_index (coords, GimpCoords, 0);
core->last_coords = g_array_index (coords, GimpCoords, 0);
gimp_paint_core_paint (core, drawable, paint_options,
GIMP_PAINT_STATE_INIT, 0);
......
......@@ -353,6 +353,9 @@ gimp_paint_core_start (GimpPaintCore *core,
sizeof (GimpCoords),
STROKE_BUFFER_INIT_SIZE);
/* remember the last stroke's endpoint for later undo */
core->start_coords = core->last_coords;
core->cur_coords = *coords;
if (! GIMP_PAINT_CORE_GET_CLASS (core)->start (core, drawable,
......@@ -677,7 +680,6 @@ gimp_paint_core_get_current_coords (GimpPaintCore *core,
g_return_if_fail (coords != NULL);
*coords = core->cur_coords;
}
void
......
......@@ -40,7 +40,7 @@ struct _GimpPaintCore
gchar *undo_desc; /* undo description */
GimpCoords start_coords; /* starting coords (for undo only) */
GimpCoords start_coords; /* the last stroke's endpoint for undo */
GimpCoords cur_coords; /* current coords */
GimpCoords last_coords; /* last coords */
......
......@@ -306,13 +306,16 @@ gimp_paint_tool_button_press (GimpTool *tool,
if ((display != tool->display) || ! paint_tool->draw_line)
{
/* if this is a new image, reinit the core vals */
/* if this is a new display, resest the "last stroke's endpoint"
* because there is none
*/
if (display != tool->display)
core->start_coords = core->cur_coords;
core->start_coords = core->cur_coords;
core->last_coords = core->cur_coords;
core->last_coords = core->cur_coords;
core->distance = 0.0;
core->pixel_dist = 0.0;
core->distance = 0.0;
core->pixel_dist = 0.0;
}
else if (paint_tool->draw_line)
{
......@@ -321,8 +324,6 @@ gimp_paint_tool_button_press (GimpTool *tool,
/* If shift is down and this is not the first paint
* stroke, then draw a line from the last coords to the pointer
*/
core->start_coords = core->last_coords;
gimp_paint_core_round_line (core, paint_options, constrain);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment