Commit 6ed75230 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

use GimpCoords structs for cur_coords, last_coords and start_coords and

2001-11-13  Michael Natterer  <mitch@gimp.org>

	* app/tools/gimppainttool.[ch]: use GimpCoords structs for
	cur_coords, last_coords and start_coords and the undo struct
	instead of storing separate gdouble values.

	* app/undo.c
	* app/tools/gimpairbrushtool.c
	* app/tools/gimpclonetool.c
	* app/tools/gimpconvolvetool.c
	* app/tools/gimpdodgeburntool.c
	* app/tools/gimperasertool.c
	* app/tools/gimppaintbrushtool.c
	* app/tools/gimppenciltool.c
	* app/tools/gimpsmudgetool.c: changed accordingly.
parent 95bc70d9
2001-11-13 Michael Natterer <mitch@gimp.org>
* app/tools/gimppainttool.[ch]: use GimpCoords structs for
cur_coords, last_coords and start_coords and the undo struct
instead of storing separate gdouble values.
* app/undo.c
* app/tools/gimpairbrushtool.c
* app/tools/gimpclonetool.c
* app/tools/gimpconvolvetool.c
* app/tools/gimpdodgeburntool.c
* app/tools/gimperasertool.c
* app/tools/gimppaintbrushtool.c
* app/tools/gimppenciltool.c
* app/tools/gimpsmudgetool.c: changed accordingly.
2001-11-13 Michael Natterer <mitch@gimp.org>
* app/base/temp-buf.c: allow passing NULL to temp_buf_resize() again.
......
......@@ -1411,7 +1411,7 @@ undo_pop_paint (GimpImage *gimage,
GimpTool *active_tool;
GimpPaintTool *pt;
PaintUndo *pu;
gdouble tmp;
GimpCoords tmp_coords;
active_tool = tool_manager_get_active (gimage->gimp);
......@@ -1427,25 +1427,9 @@ undo_pop_paint (GimpImage *gimage,
return TRUE;
/* swap the paint core information */
tmp = pt->lastx;
pt->lastx = pu->lastx;
pu->lastx = tmp;
tmp = pt->lasty;
pt->lasty = pu->lasty;
pu->lasty = tmp;
tmp = pt->lastpressure;
pt->lastpressure = pu->lastpressure;
pu->lastpressure = tmp;
tmp = pt->lastxtilt;
pt->lastxtilt = pu->lastxtilt;
pu->lastxtilt = tmp;
tmp = pt->lastytilt;
pt->lastytilt = pu->lastytilt;
pu->lastytilt = tmp;
tmp_coords = pt->last_coords;
pt->last_coords = pu->last_coords;
pu->last_coords = tmp_coords;
return TRUE;
}
......
......@@ -278,7 +278,7 @@ gimp_airbrush_tool_paint (GimpPaintTool *paint_tool,
airbrush_timeout.drawable = drawable;
timeout = (pressure_options->rate ?
(10000 / (rate * 2.0 * paint_tool->curpressure)) :
(10000 / (rate * 2.0 * paint_tool->cur_coords.pressure)) :
(10000 / rate));
timer = gtk_timeout_add (timeout, airbrush_time_out, NULL);
......@@ -335,7 +335,7 @@ airbrush_time_out (gpointer client_data)
if (pressure_options->rate)
{
/* set a new timer */
timer = gtk_timeout_add ((10000 / (rate * 2.0 * airbrush_timeout.paint_tool->curpressure)),
timer = gtk_timeout_add ((10000 / (rate * 2.0 * airbrush_timeout.paint_tool->cur_coords.pressure)),
airbrush_time_out, NULL);
return FALSE;
}
......@@ -369,7 +369,7 @@ gimp_airbrush_tool_motion (GimpPaintTool *paint_tool,
context = gimp_get_current_context (gimage->gimp);
if (pressure_options->size)
scale = paint_tool->curpressure;
scale = paint_tool->cur_coords.pressure;
else
scale = 1.0;
......@@ -382,7 +382,7 @@ gimp_airbrush_tool_motion (GimpPaintTool *paint_tool,
GimpRGB color;
gimp_gradient_get_color_at (gimp_context_get_gradient (context),
paint_tool->curpressure, &color);
paint_tool->cur_coords.pressure, &color);
gimp_rgba_get_uchar (&color,
&col[RED_PIX],
......@@ -412,7 +412,7 @@ gimp_airbrush_tool_motion (GimpPaintTool *paint_tool,
}
if (pressure_options->pressure)
pressure = pressure * 2.0 * paint_tool->curpressure;
pressure = pressure * 2.0 * paint_tool->cur_coords.pressure;
/* paste the newly painted area to the image */
gimp_paint_tool_paste_canvas (paint_tool, drawable,
......@@ -463,20 +463,20 @@ airbrush_non_gui (GimpDrawable *drawable,
non_gui_pressure = pressure;
non_gui_incremental = AIRBRUSH_DEFAULT_INCREMENTAL;
paint_tool->startx = paint_tool->lastx = stroke_array[0];
paint_tool->starty = paint_tool->lasty = stroke_array[1];
paint_tool->start_coords.x = paint_tool->last_coords.x = stroke_array[0];
paint_tool->start_coords.y = paint_tool->last_coords.y = stroke_array[1];
gimp_airbrush_tool_paint (paint_tool, drawable, MOTION_PAINT);
for (i = 1; i < num_strokes; i++)
{
paint_tool->curx = stroke_array[i * 2 + 0];
paint_tool->cury = stroke_array[i * 2 + 1];
paint_tool->cur_coords.x = stroke_array[i * 2 + 0];
paint_tool->cur_coords.y = stroke_array[i * 2 + 1];
gimp_paint_tool_interpolate (paint_tool, drawable);
paint_tool->lastx = paint_tool->curx;
paint_tool->lasty = paint_tool->cury;
paint_tool->last_coords.x = paint_tool->cur_coords.x;
paint_tool->last_coords.y = paint_tool->cur_coords.y;
}
gimp_paint_tool_finish (paint_tool, drawable);
......
......@@ -299,10 +299,10 @@ gimp_clone_tool_paint (GimpPaintTool *paint_tool,
break;
case MOTION_PAINT:
x1 = paint_tool->curx;
y1 = paint_tool->cury;
x2 = paint_tool->lastx;
y2 = paint_tool->lasty;
x1 = paint_tool->cur_coords.x;
y1 = paint_tool->cur_coords.y;
x2 = paint_tool->last_coords.x;
y2 = paint_tool->last_coords.y;
/* If the control key is down, move the src target and return */
if (paint_tool->state & GDK_CONTROL_MASK)
......@@ -344,8 +344,8 @@ gimp_clone_tool_paint (GimpPaintTool *paint_tool,
{
the_src_gdisp = gdisp;
clone_set_src_drawable(drawable);
src_x = paint_tool->curx;
src_y = paint_tool->cury;
src_x = paint_tool->cur_coords.x;
src_y = paint_tool->cur_coords.y;
first = TRUE;
}
else if (clone_options->aligned == ALIGN_NO)
......@@ -508,7 +508,7 @@ gimp_clone_tool_motion (GimpPaintTool *paint_tool,
context = gimp_get_current_context (gimage->gimp);
if (pressure_options->size)
scale = paint_tool->curpressure;
scale = paint_tool->cur_coords.pressure;
else
scale = 1.0;
......@@ -626,7 +626,7 @@ gimp_clone_tool_motion (GimpPaintTool *paint_tool,
opacity = 255.0 * gimp_context_get_opacity (context);
if (pressure_options->opacity)
opacity = opacity * 2.0 * paint_tool->curpressure;
opacity = opacity * 2.0 * paint_tool->cur_coords.pressure;
/* paste the newly painted canvas to the gimage which is being worked on */
gimp_paint_tool_paste_canvas (paint_tool, drawable,
......@@ -774,20 +774,20 @@ gimp_clone_tool_non_gui (GimpDrawable *drawable,
non_gui_paint_core.startx = non_gui_paint_core.lastx = stroke_array[0];
non_gui_paint_core.starty = non_gui_paint_core.lasty = stroke_array[1];
non_gui_offset_x = (int) (src_x - non_gui_paint_core.startx);
non_gui_offset_y = (int) (src_y - non_gui_paint_core.starty);
non_gui_offset_x = (int) (src_x - non_gui_paint_core.start_coords.x);
non_gui_offset_y = (int) (src_y - non_gui_paint_core.start_coords.y);
clone_non_gui_paint_func (&non_gui_paint_core, drawable, 0);
for (i = 1; i < num_strokes; i++)
{
non_gui_paint_core.curx = stroke_array[i * 2 + 0];
non_gui_paint_core.cury = stroke_array[i * 2 + 1];
non_gui_paint_core.cur_coords.x = stroke_array[i * 2 + 0];
non_gui_paint_core.cur_coords.y = stroke_array[i * 2 + 1];
paint_core_interpolate (&non_gui_paint_core, drawable);
non_gui_paint_core.lastx = non_gui_paint_core.curx;
non_gui_paint_core.lasty = non_gui_paint_core.cury;
non_gui_paint_core.last_coords.x = non_gui_paint_core.cur_coords.x;
non_gui_paint_core.last_coords.y = non_gui_paint_core.cur_coords.y;
}
/* Finish the painting */
......
......@@ -342,7 +342,7 @@ gimp_convolve_tool_motion (GimpPaintTool *paint_tool,
return;
if (pressure_options->size)
scale = paint_tool->curpressure;
scale = paint_tool->cur_coords.pressure;
else
scale = 1.0;
......@@ -366,19 +366,19 @@ gimp_convolve_tool_motion (GimpPaintTool *paint_tool,
destPR.data = temp_buf_data (area);
if (pressure_options->rate)
rate = rate * 2.0 * paint_tool->curpressure;
rate = rate * 2.0 * paint_tool->cur_coords.pressure;
calculate_matrix (type, rate);
/* Image region near edges? If so, paint area will be clipped */
/* with respect to brush mask + 1 pixel border (# 19285) */
if ((marginx = (gint) paint_tool->curx - paint_tool->brush->mask->width / 2 - 1) != area->x)
if ((marginx = (gint) paint_tool->cur_coords.x - paint_tool->brush->mask->width / 2 - 1) != area->x)
area_hclip = CONVOLVE_NCLIP;
else if ((marginx = area->width - paint_tool->brush->mask->width - 2) != 0)
area_hclip = CONVOLVE_PCLIP;
if ((marginy = (gint) paint_tool->cury - paint_tool->brush->mask->height / 2 - 1) != area->y)
if ((marginy = (gint) paint_tool->cur_coords.y - paint_tool->brush->mask->height / 2 - 1) != area->y)
area_vclip = CONVOLVE_NCLIP;
else if ((marginy = area->height - paint_tool->brush->mask->height - 2) != 0)
area_vclip = CONVOLVE_PCLIP;
......@@ -453,8 +453,10 @@ gimp_convolve_tool_motion (GimpPaintTool *paint_tool,
fillcolor = gimp_drawable_get_color_at
(drawable,
CLAMP ((gint) paint_tool->curx, 0, gimp_drawable_width (drawable) - 1),
CLAMP ((gint) paint_tool->cury, 0, gimp_drawable_height (drawable) - 1));
CLAMP ((gint) paint_tool->cur_coords.x,
0, gimp_drawable_width (drawable) - 1),
CLAMP ((gint) paint_tool->cur_coords.y,
0, gimp_drawable_height (drawable) - 1));
marginx *= (marginx < 0) ? -1 : 0;
marginy *= (marginy < 0) ? -1 : 0;
......@@ -657,13 +659,13 @@ convolve_non_gui (GimpDrawable *drawable,
for (i = 1; i < num_strokes; i++)
{
non_gui_paint_core.curx = stroke_array[i * 2 + 0];
non_gui_paint_core.cury = stroke_array[i * 2 + 1];
non_gui_paint_core.cur_coords.x = stroke_array[i * 2 + 0];
non_gui_paint_core.cur_coords.y = stroke_array[i * 2 + 1];
paint_core_interpolate (&non_gui_paint_core, drawable);
non_gui_paint_core.lastx = non_gui_paint_core.curx;
non_gui_paint_core.lasty = non_gui_paint_core.cury;
non_gui_paint_core.last_coords.x = non_gui_paint_core.cur_coords.x;
non_gui_paint_core.last_coords.y = non_gui_paint_core.cur_coords.y;
}
paint_core_finish (&non_gui_paint_core, drawable, -1);
......
......@@ -377,7 +377,7 @@ gimp_dodgeburn_tool_motion (GimpPaintTool *paint_tool,
return;
if (pressure_options->size)
scale = paint_tool->curpressure;
scale = paint_tool->cur_coords.pressure;
else
scale = 1.0;
......@@ -442,7 +442,7 @@ gimp_dodgeburn_tool_motion (GimpPaintTool *paint_tool,
255 * gimp_context_get_opacity (gimp_get_current_context (gimage->gimp));
if (pressure_options->opacity)
opacity = opacity * 2.0 * paint_tool->curpressure;
opacity = opacity * 2.0 * paint_tool->cur_coords.pressure;
/* Replace the newly dodgedburned area (canvas_buf) to the gimage*/
gimp_paint_tool_replace_canvas (paint_tool, drawable,
......@@ -582,20 +582,20 @@ gimp_dodgeburn_tool_non_gui (GimpDrawable *drawable,
non_gui_lut,
drawable);
paint_tool->startx = paint_tool->lastx = stroke_array[0];
paint_tool->starty = paint_tool->lasty = stroke_array[1];
paint_tool->start_coords.x = paint_tool->last_coords.x = stroke_array[0];
paint_tool->start_coords.y = paint_tool->last_coords.y = stroke_array[1];
gimp_dodgeburn_tool_paint (paint_tool, drawable, MOTION_PAINT);
for (i = 1; i < num_strokes; i++)
{
paint_tool->curx = stroke_array[i * 2 + 0];
paint_tool->cury = stroke_array[i * 2 + 1];
paint_tool->cur_coords.x = stroke_array[i * 2 + 0];
paint_tool->cur_coords.y = stroke_array[i * 2 + 1];
gimp_paint_tool_interpolate (paint_tool, drawable);
paint_tool->lastx = paint_tool->curx;
paint_tool->lasty = paint_tool->cury;
paint_tool->last_coords.x = paint_tool->cur_coords.x;
paint_tool->last_coords.y = paint_tool->cur_coords.y;
}
gimp_paint_tool_finish (paint_tool, drawable);
......
......@@ -291,7 +291,7 @@ gimp_eraser_tool_motion (GimpPaintTool *paint_tool,
context = gimp_get_current_context (gimage->gimp);
if (pressure_options->size)
scale = paint_tool->curpressure;
scale = paint_tool->cur_coords.pressure;
else
scale = 1.0;
......@@ -311,7 +311,7 @@ gimp_eraser_tool_motion (GimpPaintTool *paint_tool,
opacity = 255 * gimp_context_get_opacity (context);
if (pressure_options->opacity)
opacity = opacity * 2.0 * paint_tool->curpressure;
opacity = opacity * 2.0 * paint_tool->cur_coords.pressure;
/* paste the newly painted canvas to the gimage which is being
* worked on */
......@@ -400,7 +400,7 @@ gimp_eraser_tool_motion (GimpPaintTool *paint_tool,
opacity = 255 * gimp_context_get_opacity (context);
if (pressure_options->opacity)
opacity = opacity * 2.0 * paint_tool->curpressure;
opacity = opacity * 2.0 * paint_tool->cur_coords.pressure;
/* paste the newly painted canvas to the gimage which is
* being worked on */
......@@ -470,20 +470,20 @@ eraser_non_gui (GimpDrawable *drawable,
non_gui_anti_erase = anti_erase;
non_gui_color_erase = color_erase;
paint_tool->startx = paint_tool->lastx = stroke_array[0];
paint_tool->starty = paint_tool->lasty = stroke_array[1];
paint_tool->start_coords.x = paint_tool->last_coords.x = stroke_array[0];
paint_tool->start_coords.y = paint_tool->last_coords.y = stroke_array[1];
gimp_paint_tool_paint (paint_tool, drawable, MOTION_PAINT);
for (i = 1; i < num_strokes; i++)
{
paint_tool->curx = stroke_array[i * 2 + 0];
paint_tool->cury = stroke_array[i * 2 + 1];
paint_tool->cur_coords.x = stroke_array[i * 2 + 0];
paint_tool->cur_coords.y = stroke_array[i * 2 + 1];
gimp_paint_tool_interpolate (paint_tool, drawable);
paint_tool->lastx = paint_tool->curx;
paint_tool->lasty = paint_tool->cury;
paint_tool->last_coords.x = paint_tool->cur_coords.x;
paint_tool->last_coords.y = paint_tool->cur_coords.y;
}
gimp_paint_tool_finish (paint_tool, drawable);
......
......@@ -273,7 +273,7 @@ gimp_paintbrush_tool_motion (GimpPaintTool *paint_tool,
context = gimp_get_current_context (gimage->gimp);
if (pressure_options->size)
scale = paint_tool->curpressure;
scale = paint_tool->cur_coords.pressure;
else
scale = 1.0;
......@@ -307,7 +307,7 @@ gimp_paintbrush_tool_motion (GimpPaintTool *paint_tool,
if (pressure_options->color)
gimp_gradient_get_color_at (gradient,
paint_tool->curpressure,
paint_tool->cur_coords.pressure,
&color);
else
gimp_paint_tool_get_color_from_gradient (paint_tool,
......@@ -351,7 +351,7 @@ gimp_paintbrush_tool_motion (GimpPaintTool *paint_tool,
opacity = (gdouble) temp_blend;
if (pressure_options->opacity)
opacity = opacity * 2.0 * paint_tool->curpressure;
opacity = opacity * 2.0 * paint_tool->cur_coords.pressure;
gimp_paint_tool_paste_canvas (paint_tool, drawable,
MIN (opacity, 255),
......@@ -389,20 +389,20 @@ gimp_paintbrush_tool_non_gui_default (GimpDrawable *drawable,
stroke_array[0],
stroke_array[1]))
{
paint_tool->startx = paint_tool->lastx = stroke_array[0];
paint_tool->starty = paint_tool->lasty = stroke_array[1];
paint_tool->start_coords.x = paint_tool->last_coords.x = stroke_array[0];
paint_tool->start_coords.y = paint_tool->last_coords.y = stroke_array[1];
gimp_paint_tool_paint (paint_tool, drawable, MOTION_PAINT);
for (i = 1; i < num_strokes; i++)
{
paint_tool->curx = stroke_array[i * 2 + 0];
paint_tool->cury = stroke_array[i * 2 + 1];
paint_tool->cur_coords.x = stroke_array[i * 2 + 0];
paint_tool->cur_coords.y = stroke_array[i * 2 + 1];
gimp_paint_tool_interpolate (paint_tool, drawable);
paint_tool->lastx = paint_tool->curx;
paint_tool->lasty = paint_tool->cury;
paint_tool->last_coords.x = paint_tool->cur_coords.x;
paint_tool->last_coords.y = paint_tool->cur_coords.y;
}
gimp_paint_tool_finish (paint_tool, drawable);
......@@ -441,20 +441,20 @@ gimp_paintbrush_tool_non_gui (GimpDrawable *drawable,
non_gui_gradient_options.gradient_type = LOOP_TRIANGLE;
non_gui_incremental = method;
paint_tool->startx = paint_tool->lastx = stroke_array[0];
paint_tool->starty = paint_tool->lasty = stroke_array[1];
paint_tool->start_coords.x = paint_tool->last_coords.x = stroke_array[0];
paint_tool->start_coords.y = paint_tool->last_coords.y = stroke_array[1];
gimp_paint_tool_paint (paint_tool, drawable, MOTION_PAINT);
for (i = 1; i < num_strokes; i++)
{
paint_tool->curx = stroke_array[i * 2 + 0];
paint_tool->cury = stroke_array[i * 2 + 1];
paint_tool->cur_coords.x = stroke_array[i * 2 + 0];
paint_tool->cur_coords.y = stroke_array[i * 2 + 1];
gimp_paint_tool_interpolate (paint_tool, drawable);
paint_tool->lastx = paint_tool->curx;
paint_tool->lasty = paint_tool->cury;
paint_tool->last_coords.x = paint_tool->cur_coords.x;
paint_tool->last_coords.y = paint_tool->cur_coords.y;
}
gimp_paint_tool_finish (paint_tool, drawable);
......
......@@ -347,10 +347,18 @@ gimp_paint_tool_button_press (GimpTool *tool,
draw_line = FALSE;
paint_tool->curpressure = coords->pressure;
paint_tool->curxtilt = coords->xtilt;
paint_tool->curytilt = coords->ytilt;
paint_tool->state = state;
{
gdouble save_x, save_y;
save_x = paint_tool->cur_coords.x;
save_y = paint_tool->cur_coords.y;
paint_tool->cur_coords = *coords;
paint_tool->state = state;
paint_tool->cur_coords.x = save_x;
paint_tool->cur_coords.y = save_y;
}
if (gdisp != tool->gdisp || paint_tool->context_id < 1)
{
......@@ -363,11 +371,11 @@ gimp_paint_tool_button_press (GimpTool *tool,
if ((gdisp != tool->gdisp) || ! (state & GDK_SHIFT_MASK))
{
/* initialize some values */
paint_tool->startx = paint_tool->lastx = paint_tool->curx = x;
paint_tool->starty = paint_tool->lasty = paint_tool->cury = y;
paint_tool->startpressure = paint_tool->lastpressure = paint_tool->curpressure;
paint_tool->startytilt = paint_tool->lastytilt = paint_tool->curytilt;
paint_tool->startxtilt = paint_tool->lastxtilt = paint_tool->curxtilt;
paint_tool->cur_coords.x = x;
paint_tool->cur_coords.y = y;
paint_tool->start_coords = paint_tool->cur_coords;
paint_tool->last_coords = paint_tool->cur_coords;
}
/* If shift is down and this is not the first paint
......@@ -376,11 +384,8 @@ gimp_paint_tool_button_press (GimpTool *tool,
else if (state & GDK_SHIFT_MASK)
{
draw_line = TRUE;
paint_tool->startx = paint_tool->lastx;
paint_tool->starty = paint_tool->lasty;
paint_tool->startpressure = paint_tool->lastpressure;
paint_tool->startxtilt = paint_tool->lastxtilt;
paint_tool->startytilt = paint_tool->lastytilt;
paint_tool->start_coords =paint_tool->last_coords;
/* Restrict to multiples of 15 degrees if ctrl is pressed */
if (state & GDK_CONTROL_MASK)
......@@ -389,8 +394,8 @@ gimp_paint_tool_button_press (GimpTool *tool,
gint cosinus[7] = { 256, 247, 222, 181, 128, 66, 0 };
gint dx, dy, i, radius, frac;
dx = paint_tool->curx - paint_tool->lastx;
dy = paint_tool->cury - paint_tool->lasty;
dx = paint_tool->cur_coords.x - paint_tool->last_coords.x;
dy = paint_tool->cur_coords.y - paint_tool->last_coords.y;
if (dy)
{
......@@ -404,8 +409,9 @@ gimp_paint_tool_button_press (GimpTool *tool,
dx = dx > 0 ? (cosinus[6-i] * radius) >> 8 : - ((cosinus[6-i] * radius) >> 8);
dy = dy > 0 ? (cosinus[i] * radius) >> 8 : - ((cosinus[i] * radius) >> 8);
}
paint_tool->curx = paint_tool->lastx + dx;
paint_tool->cury = paint_tool->lasty + dy;
paint_tool->cur_coords.x = paint_tool->last_coords.x + dx;
paint_tool->cur_coords.y = paint_tool->last_coords.y + dy;
}
}
......@@ -459,11 +465,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
gimp_paint_tool_interpolate (paint_tool, drawable);
paint_tool->lastx = paint_tool->curx;
paint_tool->lasty = paint_tool->cury;
paint_tool->lastpressure = paint_tool->curpressure;
paint_tool->lastxtilt = paint_tool->curxtilt;
paint_tool->lastytilt = paint_tool->curytilt;
paint_tool->last_coords = paint_tool->cur_coords;
}
else
{
......@@ -472,8 +474,8 @@ gimp_paint_tool_button_press (GimpTool *tool,
* pixmap brush pipes don't, as they don't know which
* pixmap to select.)
*/
if (paint_tool->lastx != paint_tool->curx
|| paint_tool->lasty != paint_tool->cury
if (paint_tool->last_coords.x != paint_tool->cur_coords.x ||
paint_tool->last_coords.y != paint_tool->cur_coords.y
#ifdef __GNUC__
#warning FIXME: GIMP_BRUSH_GET_CLASS (paint_tool->brush)->want_null_motion
#endif
......@@ -560,43 +562,41 @@ gimp_paint_tool_motion (GimpTool *tool,
gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage),
&off_x, &off_y);
paint_tool->curx = coords->x - off_x;
paint_tool->cury = coords->y - off_y;
paint_tool->cur_coords = *coords;
paint_tool->state = state;
paint_tool->cur_coords.x -= off_x;
paint_tool->cur_coords.y -= off_y;
if (paint_tool->pick_state)
{
gimp_paint_tool_sample_color (gimp_image_active_drawable (gdisp->gimage),
paint_tool->curx,
paint_tool->cury,
paint_tool->cur_coords.x,
paint_tool->cur_coords.y,
state);
return;
}
paint_tool->curpressure = coords->pressure;
paint_tool->curxtilt = coords->xtilt;
paint_tool->curytilt = coords->ytilt;
paint_tool->state = state;
gimp_paint_tool_interpolate (paint_tool,
gimp_image_active_drawable (gdisp->gimage));
if (paint_tool->flags & TOOL_TRACES_ON_WINDOW)
gimp_paint_tool_paint (paint_tool,
gimp_image_active_drawable (gdisp->gimage),
PRETRACE_PAINT);
{
gimp_paint_tool_paint (paint_tool,
gimp_image_active_drawable (gdisp->gimage),
PRETRACE_PAINT);
}
gimp_display_flush_now (gdisp);
if (paint_tool->flags & TOOL_TRACES_ON_WINDOW)
gimp_paint_tool_paint (paint_tool,
gimp_image_active_drawable (gdisp->gimage),
POSTTRACE_PAINT);
paint_tool->lastx = paint_tool->curx;
paint_tool->lasty = paint_tool->cury;
paint_tool->lastpressure = paint_tool->curpressure;
paint_tool->lastxtilt = paint_tool->curxtilt;
paint_tool->lastytilt = paint_tool->curytilt;
{
gimp_paint_tool_paint (paint_tool,
gimp_image_active_drawable (gdisp->gimage),
POSTTRACE_PAINT);
}
paint_tool->last_coords = paint_tool->cur_coords;
}
......@@ -661,17 +661,21 @@ gimp_paint_tool_cursor_update (GimpTool *tool,
if ((layer = gimp_image_get_active_layer (gdisp->gimage)))
{