[raster] Improve profile accounting during sweeping.

* src/raster/ftraster.c (TProfile): Get rid of `countL`.
(Draw_Sweep): Use `start` for countdown to activation.
(Horizontal_Sweep_Drop, Vertical_Sweep_Drop): Rely on `height` and
`offset` to verify profile ends for the stub detection.
This commit is contained in:
Alexei Podtelezhnikov 2023-11-03 23:59:05 -04:00
parent 32081d8123
commit 9e86fb806d
1 changed files with 14 additions and 13 deletions

View File

@ -340,14 +340,13 @@
/* during drop-out control */ /* during drop-out control */
Int offset; /* bottom or currently scanned array index */ Int offset; /* bottom or currently scanned array index */
Int height; /* profile's height in scanlines */ Int height; /* profile's height in scanlines */
Int start; /* profile's starting scanline */ Int start; /* profile's starting scanline, also use */
/* as activation counter */
UShort flags; /* Bit 0-2: drop-out mode */ UShort flags; /* Bit 0-2: drop-out mode */
/* Bit 3: profile orientation (up/down) */ /* Bit 3: profile orientation (up/down) */
/* Bit 4: is top profile? */ /* Bit 4: is top profile? */
/* Bit 5: is bottom profile? */ /* Bit 5: is bottom profile? */
Int countL; /* number of lines to step before this */
/* profile becomes drawable */
FT_F26Dot6 X; /* current coordinate during sweep */ FT_F26Dot6 X; /* current coordinate during sweep */
Long x[1]; /* actually variable array of scanline */ Long x[1]; /* actually variable array of scanline */
/* intersections with `height` elements */ /* intersections with `height` elements */
@ -2176,6 +2175,8 @@
Long e1, e2, pxl; Long e1, e2, pxl;
Int c1, f1; Int c1, f1;
FT_UNUSED( y );
FT_TRACE7(( " y=%d x=[% .*f;% .*f]", FT_TRACE7(( " y=%d x=[% .*f;% .*f]",
y, y,
@ -2257,14 +2258,14 @@
/* upper stub test */ /* upper stub test */
if ( left->next == right && if ( left->next == right &&
left->height <= 0 && left->height == 1 &&
!( left->flags & Overshoot_Top && !( left->flags & Overshoot_Top &&
x2 - x1 >= ras.precision_half ) ) x2 - x1 >= ras.precision_half ) )
goto Exit; goto Exit;
/* lower stub test */ /* lower stub test */
if ( right->next == left && if ( right->next == left &&
left->start == y && left->offset == 0 &&
!( left->flags & Overshoot_Bottom && !( left->flags & Overshoot_Bottom &&
x2 - x1 >= ras.precision_half ) ) x2 - x1 >= ras.precision_half ) )
goto Exit; goto Exit;
@ -2475,14 +2476,14 @@
/* rightmost stub test */ /* rightmost stub test */
if ( left->next == right && if ( left->next == right &&
left->height <= 0 && left->height == 1 &&
!( left->flags & Overshoot_Top && !( left->flags & Overshoot_Top &&
x2 - x1 >= ras.precision_half ) ) x2 - x1 >= ras.precision_half ) )
goto Exit; goto Exit;
/* leftmost stub test */ /* leftmost stub test */
if ( right->next == left && if ( right->next == left &&
left->start == y && left->offset == 0 &&
!( left->flags & Overshoot_Bottom && !( left->flags & Overshoot_Bottom &&
x2 - x1 >= ras.precision_half ) ) x2 - x1 >= ras.precision_half ) )
goto Exit; goto Exit;
@ -2583,7 +2584,7 @@
P = waiting; P = waiting;
while ( P ) while ( P )
{ {
P->countL = P->start - min_Y; P->start -= min_Y;
P->X = P->x[P->offset]; P->X = P->x[P->offset];
P = P->link; P = P->link;
@ -2602,8 +2603,8 @@
while ( *Q ) while ( *Q )
{ {
P = *Q; P = *Q;
P->countL -= y_height; P->start -= y_height;
if ( P->countL == 0 ) if ( P->start == 0 )
{ {
*Q = P->link; /* remove */ *Q = P->link; /* remove */
@ -2654,7 +2655,7 @@
P_Right->X = x2; P_Right->X = x2;
/* mark profile for drop-out processing */ /* mark profile for drop-out processing */
P_Left->countL = 1; P_Left->start = -1;
dropouts++; dropouts++;
} }
} }
@ -2690,9 +2691,9 @@
while ( P_Left && P_Right ) while ( P_Left && P_Right )
{ {
if ( P_Left->countL ) if ( P_Left->start )
{ {
P_Left->countL = 0; P_Left->start = 0;
#if 0 #if 0
dropouts--; /* -- this is useful when debugging only */ dropouts--; /* -- this is useful when debugging only */
#endif #endif