ref: 90c699af0cb6e40ba96f43e80433818c83d2560f
parent: cbdba615115b0f07984130d9420ee7299ab0a3cc
author: Werner Lemberg <[email protected]>
date: Fri Jun 5 06:37:15 EDT 2009
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.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-06-04 Werner Lemberg <[email protected]>
+
+ 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 <[email protected]>
Enable autohinting for glyphs rotated by multiples of 90°.
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -305,15 +305,9 @@
} TPoint;
- typedef enum TFlow_
- {
- Flow_None = 0,
- Flow_Up = 1,
- Flow_Down = -1
+#define Flow_Up 0x1
- } TFlow;
-
/* States of each line, arc, and profile */
typedef enum TStates_
{
@@ -330,18 +324,18 @@
struct TProfile_
{
- FT_F26Dot6 X; /* current coordinate during sweep */
- PProfile link; /* link to next profile - various purpose */
- PLong offset; /* start of profile's data in render pool */
- int flow; /* Profile orientation: Asc/Descending */
- long height; /* profile's height in scanlines */
- long start; /* profile's starting scanline */
+ FT_F26Dot6 X; /* current coordinate during sweep */
+ PProfile link; /* link to next profile (various purposes) */
+ PLong offset; /* start of profile's data in render pool */
+ unsigned flags; /* Bit 0: profile orientation: up/down */
+ long height; /* profile's height in scanlines */
+ long start; /* profile's starting scanline */
- unsigned countL; /* number of lines to step before this */
- /* profile becomes drawable */
+ unsigned countL; /* number of lines to step before this */
+ /* profile becomes drawable */
- PProfile next; /* next profile in same contour, used */
- /* during drop-out control */
+ PProfile next; /* next profile in same contour, used */
+ /* during drop-out control */
};
typedef PProfile TProfileList;
@@ -454,7 +448,7 @@
UShort num_Profs; /* current number of profiles */
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 */
/* exactly on a scanline. Allows */
/* removal of doublets */
@@ -648,12 +642,12 @@
switch ( aState )
{
case Ascending_State:
- ras.cProfile->flow = Flow_Up;
+ ras.cProfile->flags |= Flow_Up;
FT_TRACE6(( "New ascending profile = %lx\n", (long)ras.cProfile ));
break;
case Descending_State:
- ras.cProfile->flow = Flow_Down;
+ ras.cProfile->flags &= ~Flow_Up;
FT_TRACE6(( "New descending profile = %lx\n", (long)ras.cProfile ));
break;
@@ -823,23 +817,21 @@
else
p->link = NULL;
- switch ( p->flow )
+ if ( p->flags & Flow_Up )
{
- case Flow_Down:
+ bottom = (Int)p->start;
+ top = (Int)( p->start + p->height - 1 );
+ }
+ else
+ {
bottom = (Int)( p->start - p->height + 1 );
top = (Int)p->start;
p->start = bottom;
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 ) ||
- Insert_Y_Turn( RAS_VARS top + 1 ) )
+ if ( Insert_Y_Turn( RAS_VARS bottom ) ||
+ Insert_Y_Turn( RAS_VARS top + 1 ) )
return FAILURE;
p = p->link;
@@ -1925,7 +1917,9 @@
if ( FRAC( ras.lastY ) == 0 &&
ras.lastY >= ras.minY &&
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--;
/* Note that ras.gProfile can be nil if the contour was too small */
/* to be drawn. */
@@ -2051,7 +2045,7 @@
while ( current )
{
current->X = *current->offset;
- current->offset += current->flow;
+ current->offset += current->flags & Flow_Up ? 1 : -1;
current->height--;
current = current->link;
}
@@ -2830,16 +2824,10 @@
{
DelOld( &waiting, P );
- switch ( P->flow )
- {
- case Flow_Up:
+ if ( P->flags & Flow_Up )
InsNew( &draw_left, P );
- break;
-
- case Flow_Down:
+ else
InsNew( &draw_right, P );
- break;
- }
}
P = Q;