[raster] Get rid of the fresh flag.
* src/raster/ftraster.c (black_TWorker): Remove the fresh flag. (New_Profile): Set the starting scanline here based on the current coordinate and initialize the joint crossing if necessary. (Line_Up, Bezier_Up): Do not deal with fresh and joint starts at all. (Line_Down, Bezier_Down): Simplify. (Conic_To, Cubic_To): Update the current coordinate after each subsection.
This commit is contained in:
parent
d5e8686dd8
commit
e9359e29be
|
@ -455,17 +455,14 @@
|
||||||
|
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
|
|
||||||
Int numTurns; /* number of Y-turns in outline */
|
|
||||||
|
|
||||||
Byte dropOutControl; /* current drop_out control method */
|
Byte dropOutControl; /* current drop_out control method */
|
||||||
|
|
||||||
Long lastX, lastY;
|
Long lastX, lastY;
|
||||||
Long minY, maxY;
|
Long minY, maxY;
|
||||||
|
|
||||||
UShort num_Profs; /* current number of profiles */
|
UShort num_Profs; /* current number of profiles */
|
||||||
|
Int numTurns; /* number of Y-turns in outline */
|
||||||
|
|
||||||
Bool fresh; /* signals a fresh new profile which */
|
|
||||||
/* `start' field must be completed */
|
|
||||||
PProfile cProfile; /* current profile */
|
PProfile cProfile; /* current profile */
|
||||||
PProfile fProfile; /* head of linked list of profiles */
|
PProfile fProfile; /* head of linked list of profiles */
|
||||||
PProfile gProfile; /* contour's first profile in case */
|
PProfile gProfile; /* contour's first profile in case */
|
||||||
|
@ -640,6 +637,9 @@
|
||||||
New_Profile( RAS_ARGS TStates aState,
|
New_Profile( RAS_ARGS TStates aState,
|
||||||
Bool overshoot )
|
Bool overshoot )
|
||||||
{
|
{
|
||||||
|
Long e;
|
||||||
|
|
||||||
|
|
||||||
if ( !ras.cProfile || ras.cProfile->height )
|
if ( !ras.cProfile || ras.cProfile->height )
|
||||||
{
|
{
|
||||||
ras.cProfile = (PProfile)ras.top;
|
ras.cProfile = (PProfile)ras.top;
|
||||||
|
@ -664,13 +664,14 @@
|
||||||
if ( overshoot )
|
if ( overshoot )
|
||||||
ras.cProfile->flags |= Overshoot_Bottom;
|
ras.cProfile->flags |= Overshoot_Bottom;
|
||||||
|
|
||||||
FT_TRACE7(( " new ascending profile = %p\n", (void *)ras.cProfile ));
|
e = CEILING( ras.lastY );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Descending_State:
|
case Descending_State:
|
||||||
if ( overshoot )
|
if ( overshoot )
|
||||||
ras.cProfile->flags |= Overshoot_Top;
|
ras.cProfile->flags |= Overshoot_Top;
|
||||||
FT_TRACE7(( " new descending profile = %p\n", (void *)ras.cProfile ));
|
|
||||||
|
e = FLOOR( ras.lastY );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -679,8 +680,20 @@
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( e > ras.maxY )
|
||||||
|
e = ras.maxY;
|
||||||
|
if ( e < ras.minY )
|
||||||
|
e = ras.minY;
|
||||||
|
ras.cProfile->start = (Int)TRUNC( e );
|
||||||
|
|
||||||
|
FT_TRACE7(( " new %s profile = %p, start = %d\n",
|
||||||
|
aState == Ascending_State ? "ascending" : "descending",
|
||||||
|
(void *)ras.cProfile, ras.cProfile->start ));
|
||||||
|
|
||||||
|
if ( ras.lastY == e )
|
||||||
|
*ras.top++ = ras.lastX;
|
||||||
|
|
||||||
ras.state = aState;
|
ras.state = aState;
|
||||||
ras.fresh = TRUE;
|
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -927,29 +940,23 @@
|
||||||
Long Ix, Rx, Ax;
|
Long Ix, Rx, Ax;
|
||||||
Int size;
|
Int size;
|
||||||
|
|
||||||
PLong top;
|
PLong top;
|
||||||
|
|
||||||
|
|
||||||
top = ras.top;
|
|
||||||
|
|
||||||
if ( y2 == y1 || y2 < miny || y1 > maxy )
|
if ( y2 == y1 || y2 < miny || y1 > maxy )
|
||||||
goto Fin;
|
return SUCCESS;
|
||||||
|
|
||||||
e2 = y2 > maxy ? maxy : FLOOR( y2 );
|
e2 = y2 > maxy ? maxy : FLOOR( y2 );
|
||||||
e = y1 < miny ? miny : CEILING( y1 );
|
e = y1 < miny ? miny : CEILING( y1 );
|
||||||
|
|
||||||
if ( e2 < e ) /* between scanlines */
|
if ( y1 == e )
|
||||||
goto Fin;
|
e += ras.precision;
|
||||||
|
|
||||||
if ( ras.fresh )
|
if ( e2 < e ) /* nothing to do */
|
||||||
{
|
return SUCCESS;
|
||||||
ras.cProfile->start = (Int)TRUNC( e );
|
|
||||||
ras.fresh = FALSE;
|
|
||||||
}
|
|
||||||
else if ( y1 == e )
|
|
||||||
top--;
|
|
||||||
|
|
||||||
size = (Int)TRUNC( e2 - e ) + 1;
|
size = (Int)TRUNC( e2 - e ) + 1;
|
||||||
|
top = ras.top;
|
||||||
|
|
||||||
if ( top + size >= ras.maxBuff )
|
if ( top + size >= ras.maxBuff )
|
||||||
{
|
{
|
||||||
|
@ -1045,17 +1052,7 @@
|
||||||
Long miny,
|
Long miny,
|
||||||
Long maxy )
|
Long maxy )
|
||||||
{
|
{
|
||||||
Bool result, fresh;
|
return Line_Up( RAS_VARS x1, -y1, x2, -y2, -maxy, -miny );
|
||||||
|
|
||||||
|
|
||||||
fresh = ras.fresh;
|
|
||||||
|
|
||||||
result = Line_Up( RAS_VARS x1, -y1, x2, -y2, -maxy, -miny );
|
|
||||||
|
|
||||||
if ( fresh && !ras.fresh )
|
|
||||||
ras.cProfile->start = -ras.cProfile->start;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1098,35 +1095,25 @@
|
||||||
Long y1, y2, e, e2, dy;
|
Long y1, y2, e, e2, dy;
|
||||||
Long dx, x2;
|
Long dx, x2;
|
||||||
|
|
||||||
PLong top;
|
PLong top;
|
||||||
|
|
||||||
|
|
||||||
y1 = arc[degree].y;
|
y1 = arc[degree].y;
|
||||||
y2 = arc[0].y;
|
y2 = arc[0].y;
|
||||||
top = ras.top;
|
|
||||||
|
|
||||||
if ( y2 < miny || y1 > maxy )
|
if ( y2 < miny || y1 > maxy )
|
||||||
goto Fin;
|
return SUCCESS;
|
||||||
|
|
||||||
e2 = y2 > maxy ? maxy : FLOOR( y2 );
|
e2 = y2 > maxy ? maxy : FLOOR( y2 );
|
||||||
e = y1 < miny ? miny : CEILING( y1 );
|
e = y1 < miny ? miny : CEILING( y1 );
|
||||||
|
|
||||||
if ( e2 < e ) /* between scanlines */
|
|
||||||
goto Fin;
|
|
||||||
|
|
||||||
if ( ras.fresh )
|
|
||||||
{
|
|
||||||
ras.cProfile->start = (Int)TRUNC( e );
|
|
||||||
ras.fresh = FALSE;
|
|
||||||
}
|
|
||||||
else if ( y1 == e )
|
|
||||||
top--;
|
|
||||||
|
|
||||||
if ( y1 == e )
|
if ( y1 == e )
|
||||||
{
|
e += ras.precision;
|
||||||
*top++ = arc[degree].x;
|
|
||||||
e += ras.precision;
|
if ( e2 < e ) /* nothing to do */
|
||||||
}
|
return SUCCESS;
|
||||||
|
|
||||||
|
top = ras.top;
|
||||||
|
|
||||||
if ( ( top + TRUNC( e2 - e ) + 1 ) >= ras.maxBuff )
|
if ( ( top + TRUNC( e2 - e ) + 1 ) >= ras.maxBuff )
|
||||||
{
|
{
|
||||||
|
@ -1134,7 +1121,7 @@
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( e <= e2 )
|
do
|
||||||
{
|
{
|
||||||
y2 = arc[0].y;
|
y2 = arc[0].y;
|
||||||
x2 = arc[0].x;
|
x2 = arc[0].x;
|
||||||
|
@ -1169,9 +1156,9 @@
|
||||||
arc -= degree;
|
arc -= degree;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
while ( e <= e2 );
|
||||||
|
|
||||||
Fin:
|
ras.top = top;
|
||||||
ras.top = top;
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1208,7 +1195,7 @@
|
||||||
Long miny,
|
Long miny,
|
||||||
Long maxy )
|
Long maxy )
|
||||||
{
|
{
|
||||||
Bool result, fresh;
|
Bool result;
|
||||||
|
|
||||||
|
|
||||||
arc[0].y = -arc[0].y;
|
arc[0].y = -arc[0].y;
|
||||||
|
@ -1217,13 +1204,8 @@
|
||||||
if ( degree > 2 )
|
if ( degree > 2 )
|
||||||
arc[3].y = -arc[3].y;
|
arc[3].y = -arc[3].y;
|
||||||
|
|
||||||
fresh = ras.fresh;
|
|
||||||
|
|
||||||
result = Bezier_Up( RAS_VARS degree, arc, splitter, -maxy, -miny );
|
result = Bezier_Up( RAS_VARS degree, arc, splitter, -maxy, -miny );
|
||||||
|
|
||||||
if ( fresh && !ras.fresh )
|
|
||||||
ras.cProfile->start = -ras.cProfile->start;
|
|
||||||
|
|
||||||
arc[0].y = -arc[0].y;
|
arc[0].y = -arc[0].y;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1437,13 +1419,13 @@
|
||||||
ras.minY, ras.maxY ) )
|
ras.minY, ras.maxY ) )
|
||||||
goto Fail;
|
goto Fail;
|
||||||
arc -= 2;
|
arc -= 2;
|
||||||
|
|
||||||
|
ras.lastX = x3;
|
||||||
|
ras.lastY = y3;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while ( arc >= arcs );
|
} while ( arc >= arcs );
|
||||||
|
|
||||||
ras.lastX = x3;
|
|
||||||
ras.lastY = y3;
|
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
|
||||||
Fail:
|
Fail:
|
||||||
|
@ -1584,13 +1566,13 @@
|
||||||
ras.minY, ras.maxY ) )
|
ras.minY, ras.maxY ) )
|
||||||
goto Fail;
|
goto Fail;
|
||||||
arc -= 3;
|
arc -= 3;
|
||||||
|
|
||||||
|
ras.lastX = x4;
|
||||||
|
ras.lastY = y4;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while ( arc >= arcs );
|
} while ( arc >= arcs );
|
||||||
|
|
||||||
ras.lastX = x4;
|
|
||||||
ras.lastY = y4;
|
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
|
||||||
Fail:
|
Fail:
|
||||||
|
|
Loading…
Reference in New Issue