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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
diff --git a/ChangeLog b/ChangeLog
index 47d0a4e..3c99c2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
Enable autohinting for glyphs rotated by multiples of 90°.
diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index 202383b..62b1a69 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -305,13 +305,7 @@
} TPoint;
- typedef enum TFlow_
- {
- Flow_None = 0,
- Flow_Up = 1,
- Flow_Down = -1
-
- } TFlow;
+#define Flow_Up 0x1
/* States of each line, arc, and profile */
@@ -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 */
-
- unsigned countL; /* number of lines to step before this */
- /* profile becomes drawable */
-
- PProfile next; /* next profile in same contour, used */
- /* during drop-out control */
+ 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 */
+
+ 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 )
+ {
+ bottom = (Int)p->start;
+ top = (Int)( p->start + p->height - 1 );
+ }
+ else
{
- case Flow_Down:
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;