[raster] Modify the split condition.

While curving close to a pixel center, vertical and horizontal pass
might split the curve differently and cause a rare dropout.  This
makes the split condition invariant of the sweep direction and more
robust.

* src/raster/ftraster.c (Bezier_Up): Modify the split condition.
This commit is contained in:
Alexei Podtelezhnikov (Алексей Подтележников) 2023-11-02 22:09:18 -04:00 committed by Alexei Podtelezhnikov
parent f2e76e8356
commit 6d6607b8b3
1 changed files with 13 additions and 6 deletions

View File

@ -1124,7 +1124,8 @@
Long miny,
Long maxy )
{
Long y1, y2, e, e2, e0;
Long y1, y2, e, e2, e0, dy;
Long dx, x2;
TPoint* start_arc;
@ -1189,19 +1190,25 @@
ras.joint = FALSE;
y2 = arc[0].y;
x2 = arc[0].x;
if ( y2 > e )
{
y1 = arc[degree].y;
if ( y2 - y1 >= ras.precision_step )
dy = y2 - arc[degree].y;
dx = x2 - arc[degree].x;
/* split condition should be invariant of direction */
if ( dy > ras.precision_step ||
dx > ras.precision_step ||
-dx > ras.precision_step )
{
splitter( arc );
arc += degree;
}
else
{
*top++ = arc[degree].x + FMulDiv( arc[0].x - arc[degree].x,
e - y1, y2 - y1 );
*top++ = x2 - FMulDiv( y2 - e, dx, dy );
arc -= degree;
e += ras.precision;
}
@ -1211,7 +1218,7 @@
if ( y2 == e )
{
ras.joint = TRUE;
*top++ = arc[0].x;
*top++ = x2;
e += ras.precision;
}