[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:
parent
f2e76e8356
commit
6d6607b8b3
|
@ -1124,7 +1124,8 @@
|
||||||
Long miny,
|
Long miny,
|
||||||
Long maxy )
|
Long maxy )
|
||||||
{
|
{
|
||||||
Long y1, y2, e, e2, e0;
|
Long y1, y2, e, e2, e0, dy;
|
||||||
|
Long dx, x2;
|
||||||
|
|
||||||
TPoint* start_arc;
|
TPoint* start_arc;
|
||||||
|
|
||||||
|
@ -1189,19 +1190,25 @@
|
||||||
ras.joint = FALSE;
|
ras.joint = FALSE;
|
||||||
|
|
||||||
y2 = arc[0].y;
|
y2 = arc[0].y;
|
||||||
|
x2 = arc[0].x;
|
||||||
|
|
||||||
if ( y2 > e )
|
if ( y2 > e )
|
||||||
{
|
{
|
||||||
y1 = arc[degree].y;
|
dy = y2 - arc[degree].y;
|
||||||
if ( y2 - y1 >= ras.precision_step )
|
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 );
|
splitter( arc );
|
||||||
arc += degree;
|
arc += degree;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*top++ = arc[degree].x + FMulDiv( arc[0].x - arc[degree].x,
|
*top++ = x2 - FMulDiv( y2 - e, dx, dy );
|
||||||
e - y1, y2 - y1 );
|
|
||||||
arc -= degree;
|
arc -= degree;
|
||||||
e += ras.precision;
|
e += ras.precision;
|
||||||
}
|
}
|
||||||
|
@ -1211,7 +1218,7 @@
|
||||||
if ( y2 == e )
|
if ( y2 == e )
|
||||||
{
|
{
|
||||||
ras.joint = TRUE;
|
ras.joint = TRUE;
|
||||||
*top++ = arc[0].x;
|
*top++ = x2;
|
||||||
|
|
||||||
e += ras.precision;
|
e += ras.precision;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue