[raster] Simplify sweeping entry and exit.
* src/raster/ftraster.c (Draw_Sweep): Use y-turns to set the range, correctly set the initial position, directly loop through y_turns, and remove a 5-gray remnant at exit.
This commit is contained in:
parent
55d0287cfc
commit
4e2d1f040c
|
@ -2604,67 +2604,46 @@
|
||||||
static Bool
|
static Bool
|
||||||
Draw_Sweep( RAS_ARG )
|
Draw_Sweep( RAS_ARG )
|
||||||
{
|
{
|
||||||
Int min_Y, max_Y, top, bottom, dropouts;
|
Int min_Y, max_Y, dropouts;
|
||||||
Int y, y_change, y_height;
|
Int y, y_change, y_height;
|
||||||
|
|
||||||
PProfile P, Q, P_Left, P_Right;
|
PProfile P, Q, P_Left, P_Right;
|
||||||
|
|
||||||
Long x1, x2, xs, e1, e2;
|
Long x1, x2, xs, e1, e2;
|
||||||
|
|
||||||
TProfileList waiting = NULL;
|
TProfileList waiting = ras.fProfile;
|
||||||
TProfileList draw_left = NULL;
|
TProfileList draw_left = NULL;
|
||||||
TProfileList draw_right = NULL;
|
TProfileList draw_right = NULL;
|
||||||
|
|
||||||
|
|
||||||
/* first, compute min and max Y */
|
/* use y_turns to set the drawing range */
|
||||||
|
|
||||||
P = ras.fProfile;
|
min_Y = (Int)ras.maxBuff[0];
|
||||||
max_Y = (Int)TRUNC( ras.minY );
|
max_Y = (Int)ras.sizeBuff[-1] - 1;
|
||||||
min_Y = (Int)TRUNC( ras.maxY );
|
|
||||||
|
|
||||||
while ( P )
|
|
||||||
{
|
|
||||||
Q = P->link;
|
|
||||||
|
|
||||||
bottom = P->start;
|
|
||||||
top = P->start + P->height - 1;
|
|
||||||
|
|
||||||
if ( min_Y > bottom )
|
|
||||||
min_Y = bottom;
|
|
||||||
if ( max_Y < top )
|
|
||||||
max_Y = top;
|
|
||||||
|
|
||||||
P->X = 0;
|
|
||||||
InsNew( &waiting, P );
|
|
||||||
|
|
||||||
P = Q;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* now initialize the sweep */
|
/* now initialize the sweep */
|
||||||
|
|
||||||
ras.Proc_Sweep_Init( RAS_VARS min_Y, max_Y );
|
ras.Proc_Sweep_Init( RAS_VARS min_Y, max_Y );
|
||||||
|
|
||||||
/* then compute the distance of each profile from min_Y */
|
/* set the activation countdowns and the initial positions */
|
||||||
|
|
||||||
P = waiting;
|
P = waiting;
|
||||||
|
|
||||||
while ( P )
|
while ( P )
|
||||||
{
|
{
|
||||||
P->countL = P->start - min_Y;
|
P->countL = P->start - min_Y;
|
||||||
|
P->X = P->x[P->offset];
|
||||||
|
|
||||||
P = P->link;
|
P = P->link;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* let's go */
|
/* let's go, iterating through y_turns */
|
||||||
|
|
||||||
y = min_Y;
|
y = min_Y;
|
||||||
y_height = 0;
|
y_height = 0;
|
||||||
|
|
||||||
if ( ras.sizeBuff[-ras.numTurns] == min_Y )
|
while ( ++ras.maxBuff < ras.sizeBuff )
|
||||||
ras.numTurns--;
|
|
||||||
|
|
||||||
while ( ras.numTurns > 0 )
|
|
||||||
{
|
{
|
||||||
/* check waiting list for new activations */
|
/* check waiting list for new profile activations */
|
||||||
|
|
||||||
P = waiting;
|
P = waiting;
|
||||||
|
|
||||||
|
@ -2690,7 +2669,7 @@
|
||||||
Sort( &draw_left );
|
Sort( &draw_left );
|
||||||
Sort( &draw_right );
|
Sort( &draw_right );
|
||||||
|
|
||||||
y_change = (Int)ras.sizeBuff[-ras.numTurns--];
|
y_change = (Int)*ras.maxBuff;
|
||||||
y_height = y_change - y;
|
y_height = y_change - y;
|
||||||
|
|
||||||
while ( y < y_change )
|
while ( y < y_change )
|
||||||
|
@ -2768,7 +2747,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now finalize the profiles that need it */
|
/* remove exhausted profiles */
|
||||||
|
|
||||||
P = draw_left;
|
P = draw_left;
|
||||||
while ( P )
|
while ( P )
|
||||||
|
@ -2789,13 +2768,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for gray-scaling, flush the bitmap scanline cache */
|
|
||||||
while ( y <= max_Y )
|
|
||||||
{
|
|
||||||
ras.Proc_Sweep_Step( RAS_VAR );
|
|
||||||
y++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
|
||||||
Scan_DropOuts:
|
Scan_DropOuts:
|
||||||
|
|
Loading…
Reference in New Issue