paint_core_interpolate now takes care of setting core->last_coords. Don't

* app/paint/gimppaintcore.c: paint_core_interpolate now takes care
	of setting core->last_coords.  Don't reset core->distance in
	paint_core_start (fixes problem with shift-click brush strokes).
	Improved brush placement for stroked selections in
	paint_core_interpolate.
	* app/paint/gimppaintcore-stroke.c: dont need to set
	core->last_coords anymore.
	* app/tools/gimppainttool.c: dont need to set core->last_coords
	anymore.  Set core->distance in gimp_paint_tool_button_press.
This commit is contained in:
jaycox
2003-08-21 10:44:11 +00:00
parent 5ab05db882
commit 012288a54d
5 changed files with 37 additions and 17 deletions

View File

@ -1,3 +1,15 @@
2003-08-21 Jay Cox <jaycox@gimp.org>
* app/paint/gimppaintcore.c: paint_core_interpolate now takes care
of setting core->last_coords. Don't reset core->distance in
paint_core_start (fixes problem with shift-click brush strokes).
Improved brush placement for stroked selections in
paint_core_interpolate.
* app/paint/gimppaintcore-stroke.c: dont need to set
core->last_coords anymore.
* app/tools/gimppainttool.c: dont need to set core->last_coords
anymore. Set core->distance in gimp_paint_tool_button_press.
2003-08-21 Sven Neumann <sven@gimp.org>
* m4macros/gimp-2.0.m4: set the default minimum version to 1.3.18.

View File

@ -64,9 +64,7 @@ gimp_paint_core_stroke (GimpPaintCore *core,
core->cur_coords = strokes[i];
gimp_paint_core_interpolate (core, drawable, paint_options);
core->last_coords = core->cur_coords;
}
}
gimp_paint_core_paint (core, drawable, paint_options, FINISH_PAINT);
@ -153,8 +151,6 @@ gimp_paint_core_stroke_vectors (GimpPaintCore *core,
core->cur_coords = g_array_index (coords, GimpCoords, i);
gimp_paint_core_interpolate (core, drawable, paint_options);
core->last_coords = core->cur_coords;
}
if (closed)
@ -162,8 +158,6 @@ gimp_paint_core_stroke_vectors (GimpPaintCore *core,
core->cur_coords = g_array_index (coords, GimpCoords, 0);
gimp_paint_core_interpolate (core, drawable, paint_options);
core->last_coords = core->cur_coords;
}
g_array_free (coords, TRUE);

View File

@ -444,8 +444,6 @@ gimp_paint_core_start (GimpPaintCore *core,
core->x1 = core->x2 = core->cur_coords.x;
core->y1 = core->y2 = core->cur_coords.y;
core->distance = 0.0;
core->pixel_dist = 0.0;
core->last_paint.x = -1e6;
core->last_paint.y = -1e6;
@ -711,10 +709,21 @@ gimp_paint_core_interpolate (GimpPaintCore *core,
* make thin lines (say, with a 1x1 brush) prettier while leaving
* lines with larger brush spacing as they used to look in 1.2.x.
*/
dt = core->spacing / dist;
n = (gint) (initial / core->spacing + 1.0 + EPSILON);
t0 = (n * core->spacing - initial) / dist;
num_points = 1 + (gint) floor ((1 + EPSILON - t0) / dt);
/* if we arnt going to paint anything this time and the brush
* has only moved on one axis return without updating the brush
* position, distance etc. so that we can more accurately space
* brush strokes when curves are supplied to us in single pixel
* chunks.
*/
if (num_points == 0 && (delta.x == 0 || delta.y == 0))
return;
}
else if (fabs (st_factor) < EPSILON)
{
@ -843,6 +852,9 @@ gimp_paint_core_interpolate (GimpPaintCore *core,
core->distance = total;
core->pixel_dist = pixel_initial + pixel_dist;
core->last_coords = core->cur_coords;
}

View File

@ -347,6 +347,11 @@ gimp_paint_tool_button_press (GimpTool *tool,
core->start_coords = core->cur_coords;
core->last_coords = core->cur_coords;
core->distance = 0.0;
core->pixel_dist = 0.0;
}
else if (paint_tool->draw_line)
{
@ -381,8 +386,6 @@ gimp_paint_tool_button_press (GimpTool *tool,
if (paint_tool->draw_line)
{
gimp_paint_core_interpolate (core, drawable, paint_options);
core->last_coords = core->cur_coords;
}
else
{
@ -473,8 +476,6 @@ gimp_paint_tool_motion (GimpTool *tool,
if (core->flags & CORE_TRACES_ON_WINDOW)
gimp_paint_core_paint (core, drawable, paint_options, POSTTRACE_PAINT);
core->last_coords = core->cur_coords;
}
static void

View File

@ -347,6 +347,11 @@ gimp_paint_tool_button_press (GimpTool *tool,
core->start_coords = core->cur_coords;
core->last_coords = core->cur_coords;
core->distance = 0.0;
core->pixel_dist = 0.0;
}
else if (paint_tool->draw_line)
{
@ -381,8 +386,6 @@ gimp_paint_tool_button_press (GimpTool *tool,
if (paint_tool->draw_line)
{
gimp_paint_core_interpolate (core, drawable, paint_options);
core->last_coords = core->cur_coords;
}
else
{
@ -473,8 +476,6 @@ gimp_paint_tool_motion (GimpTool *tool,
if (core->flags & CORE_TRACES_ON_WINDOW)
gimp_paint_core_paint (core, drawable, paint_options, POSTTRACE_PAINT);
core->last_coords = core->cur_coords;
}
static void