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.
This commit is contained in:
Michael Natterer 2013-07-15 00:41:43 +02:00
parent 37372555e5
commit d1795ac204
4 changed files with 17 additions and 17 deletions

View File

@ -67,7 +67,6 @@ gimp_paint_core_stroke (GimpPaintCore *core,
{
gint i;
core->start_coords = strokes[0];
core->last_coords = strokes[0];
gimp_paint_core_paint (core, drawable, paint_options,
@ -180,7 +179,6 @@ gimp_paint_core_stroke_boundary (GimpPaintCore *core,
initialized = TRUE;
core->cur_coords = coords[0];
core->start_coords = coords[0];
core->last_coords = coords[0];
gimp_paint_core_paint (core, drawable, paint_options,
@ -284,7 +282,6 @@ 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);
gimp_paint_core_paint (core, drawable, paint_options,

View File

@ -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

View File

@ -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 */

View File

@ -306,9 +306,12 @@ 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->last_coords = core->cur_coords;
core->distance = 0.0;
@ -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);
}