mirror of https://github.com/GNOME/gimp.git
app: Fix direction in path stroking
This commit is contained in:
parent
e23e99e2ab
commit
7609e3d887
|
@ -376,38 +376,37 @@ gimp_paint_core_stroke_emulate_dynamics (GimpCoords *coords,
|
|||
}
|
||||
}
|
||||
|
||||
if (length > 0)
|
||||
if (length > 1)
|
||||
{
|
||||
gint i;
|
||||
gdouble delta_x;
|
||||
gdouble delta_y;
|
||||
|
||||
/* Fill in direction */
|
||||
for (i = 2; i < length; i++)
|
||||
for (i = 1; i < length; i++)
|
||||
{
|
||||
gdouble delta_x = coords[i - 1].x - coords[i].x;
|
||||
gdouble delta_y = coords[i - 1].y - coords[i].y;
|
||||
delta_x = coords[i - 1].x - coords[i].x;
|
||||
delta_y = coords[i - 1].y - coords[i].y;
|
||||
|
||||
if (delta_x == 0)
|
||||
if ((delta_x == 0) && (delta_y == 0))
|
||||
{
|
||||
coords[i].direction = coords[i - 1].direction;
|
||||
}
|
||||
else
|
||||
{
|
||||
coords[i].direction = 1.0 - atan (delta_y / delta_x) / (2 * G_PI);
|
||||
if (delta_x > 0.0)
|
||||
coords[i].direction = coords[i].direction + 0.5;
|
||||
coords[i].direction = atan (delta_y / delta_x) / (2 * G_PI);
|
||||
|
||||
if (coords[i].direction < 0)
|
||||
coords[i].direction += 1.0;
|
||||
|
||||
coords[i].direction = 1.0 - coords[i].direction;
|
||||
}
|
||||
|
||||
/* This should avoid confusing the interpolator on sharp
|
||||
* turns where the angle warps
|
||||
*/
|
||||
if (fabs (coords[i].direction - coords[i - 1].direction) > 0.5)
|
||||
coords[i].direction = coords[i].direction + 1.0;
|
||||
}
|
||||
|
||||
if (length > 2)
|
||||
if (length > 1)
|
||||
{
|
||||
coords[0].direction = coords[2].direction;
|
||||
coords[1].direction = coords[2].direction;
|
||||
coords[0].direction = coords[1].direction;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue