Preparation for fixing scan conversion rules 4 and 6.

* src/raster/ftraster.c (TFlow): Replace enumeration with...
(Flow_Up): This macro.
(TProfile): Replace `flow' member with `flags' bit field.
Update all affected code.
This commit is contained in:
Werner Lemberg 2009-06-05 10:37:15 +02:00
parent cbdba61511
commit 90c699af0c
2 changed files with 37 additions and 40 deletions

View File

@ -1,3 +1,12 @@
2009-06-04 Werner Lemberg <wl@gnu.org>
Preparation for fixing scan conversion rules 4 and 6.
* src/raster/ftraster.c (TFlow): Replace enumeration with...
(Flow_Up): This macro.
(TProfile): Replace `flow' member with `flags' bit field.
Update all affected code.
2009-05-29 James Cloos <cloos@jhcloos.com> 2009-05-29 James Cloos <cloos@jhcloos.com>
Enable autohinting for glyphs rotated by multiples of 90°. Enable autohinting for glyphs rotated by multiples of 90°.

View File

@ -305,13 +305,7 @@
} TPoint; } TPoint;
typedef enum TFlow_ #define Flow_Up 0x1
{
Flow_None = 0,
Flow_Up = 1,
Flow_Down = -1
} TFlow;
/* States of each line, arc, and profile */ /* States of each line, arc, and profile */
@ -331,9 +325,9 @@
struct TProfile_ struct TProfile_
{ {
FT_F26Dot6 X; /* current coordinate during sweep */ FT_F26Dot6 X; /* current coordinate during sweep */
PProfile link; /* link to next profile - various purpose */ PProfile link; /* link to next profile (various purposes) */
PLong offset; /* start of profile's data in render pool */ PLong offset; /* start of profile's data in render pool */
int flow; /* Profile orientation: Asc/Descending */ unsigned flags; /* Bit 0: profile orientation: up/down */
long height; /* profile's height in scanlines */ long height; /* profile's height in scanlines */
long start; /* profile's starting scanline */ long start; /* profile's starting scanline */
@ -454,7 +448,7 @@
UShort num_Profs; /* current number of profiles */ UShort num_Profs; /* current number of profiles */
Bool fresh; /* signals a fresh new profile which */ Bool fresh; /* signals a fresh new profile which */
/* 'start' field must be completed */ /* `start' field must be completed */
Bool joint; /* signals that the last arc ended */ Bool joint; /* signals that the last arc ended */
/* exactly on a scanline. Allows */ /* exactly on a scanline. Allows */
/* removal of doublets */ /* removal of doublets */
@ -648,12 +642,12 @@
switch ( aState ) switch ( aState )
{ {
case Ascending_State: case Ascending_State:
ras.cProfile->flow = Flow_Up; ras.cProfile->flags |= Flow_Up;
FT_TRACE6(( "New ascending profile = %lx\n", (long)ras.cProfile )); FT_TRACE6(( "New ascending profile = %lx\n", (long)ras.cProfile ));
break; break;
case Descending_State: case Descending_State:
ras.cProfile->flow = Flow_Down; ras.cProfile->flags &= ~Flow_Up;
FT_TRACE6(( "New descending profile = %lx\n", (long)ras.cProfile )); FT_TRACE6(( "New descending profile = %lx\n", (long)ras.cProfile ));
break; break;
@ -823,19 +817,17 @@
else else
p->link = NULL; p->link = NULL;
switch ( p->flow ) if ( p->flags & Flow_Up )
{
bottom = (Int)p->start;
top = (Int)( p->start + p->height - 1 );
}
else
{ {
case Flow_Down:
bottom = (Int)( p->start - p->height + 1 ); bottom = (Int)( p->start - p->height + 1 );
top = (Int)p->start; top = (Int)p->start;
p->start = bottom; p->start = bottom;
p->offset += p->height - 1; p->offset += p->height - 1;
break;
case Flow_Up:
default:
bottom = (Int)p->start;
top = (Int)( p->start + p->height - 1 );
} }
if ( Insert_Y_Turn( RAS_VARS bottom ) || if ( Insert_Y_Turn( RAS_VARS bottom ) ||
@ -1925,7 +1917,9 @@
if ( FRAC( ras.lastY ) == 0 && if ( FRAC( ras.lastY ) == 0 &&
ras.lastY >= ras.minY && ras.lastY >= ras.minY &&
ras.lastY <= ras.maxY ) ras.lastY <= ras.maxY )
if ( ras.gProfile && ras.gProfile->flow == ras.cProfile->flow ) if ( ras.gProfile &&
( ras.gProfile->flags & Flow_Up ) ==
( ras.cProfile->flags & Flow_Up ) )
ras.top--; ras.top--;
/* Note that ras.gProfile can be nil if the contour was too small */ /* Note that ras.gProfile can be nil if the contour was too small */
/* to be drawn. */ /* to be drawn. */
@ -2051,7 +2045,7 @@
while ( current ) while ( current )
{ {
current->X = *current->offset; current->X = *current->offset;
current->offset += current->flow; current->offset += current->flags & Flow_Up ? 1 : -1;
current->height--; current->height--;
current = current->link; current = current->link;
} }
@ -2830,16 +2824,10 @@
{ {
DelOld( &waiting, P ); DelOld( &waiting, P );
switch ( P->flow ) if ( P->flags & Flow_Up )
{
case Flow_Up:
InsNew( &draw_left, P ); InsNew( &draw_left, P );
break; else
case Flow_Down:
InsNew( &draw_right, P ); InsNew( &draw_right, P );
break;
}
} }
P = Q; P = Q;