"ftrast.c" now works for monochrome bitmaps, and doesn't produce the artefacts of the current "ftraster.c".. I'll change it soon to handle optimised 5-levels anti-aliasing (backwards compatibility) in order to completely replace "ftraster.c"
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 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
diff --git a/demos/src/ftrast.c b/demos/src/ftrast.c
index 756912e..07c8df4 100644
--- a/demos/src/ftrast.c
+++ b/demos/src/ftrast.c
@@ -133,8 +133,8 @@
typedef enum TFlow_
{
Flow_None = 0,
- Flow_Up,
- Flow_Down
+ Flow_Up = 1,
+ Flow_Down = -1
} TFlow;
@@ -196,24 +196,6 @@
static const Byte RMask[8] =
{ 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF };
- /* We provide two different builds of the scan-line converter */
- /* The static build uses global variables and isn't */
- /* re-entrant. */
- /* The indirect build is re-entrant but accesses all variables */
- /* indirectly. */
- /* */
- /* As a consequence, the indirect build is about 10% slower */
- /* than the static one on a _Pentium_ (this could get worse */
- /* on older processors), but the code size is reduced by */
- /* more than 30% ! */
- /* */
- /* The indirect build is now the default, defined in */
- /* ttconfig.h. Be careful if you experiment with this. */
-
- /* Note also that, though its code can be re-entrant, the */
- /* component is always used in thread-safe mode. This is */
- /* simply due to the fact that we want to use a single */
- /* render pool (of 64 Kb), and not to waste memory. */
#ifdef TT_STATIC_RASTER
@@ -398,7 +380,7 @@
/* */
/************************************************************************/
- static void Set_High_Precision( RAS_ARGS Bool High )
+ static void Set_High_Precision( RAS_ARGS Int High )
{
if ( High )
{
@@ -1120,10 +1102,10 @@
/* Description: Injects a new conic arc and adjusts the profile list. */
/* */
- static Bool Conic_To( RAS_ARGS Long x,
- Long y,
- Long cx,
- Long cy )
+ static Bool Conic_To( RAS_ARGS Long cx,
+ Long cy,
+ Long x,
+ Long y )
{
Long y1, y2, y3, x3, ymin, ymax;
TStates state_bez;
@@ -1211,12 +1193,12 @@
/* Description: Injects a new cubic arc and adjusts the profile list. */
/* */
- static Bool Cubic_To( RAS_ARGS Long x,
- Long y,
- Long cx1,
+ static Bool Cubic_To( RAS_ARGS Long cx1,
Long cy1,
Long cx2,
- Long cy2 )
+ Long cy2,
+ Long x,
+ Long y )
{
Long y1, y2, y3, y4, x4, ymin1, ymax1, ymin2, ymax2;
TStates state_bez;
@@ -1333,7 +1315,7 @@
static Bool Decompose_Curve( RAS_ARGS UShort first,
UShort last,
- Bool flipped )
+ int flipped )
{
FT_Vector v_last;
FT_Vector v_control;
@@ -1393,6 +1375,9 @@
tags--;
}
+ ras.lastX = v_start.x;
+ ras.lastY = v_start.y;
+
while (point < limit)
{
point++;
@@ -1763,9 +1748,9 @@
(void)max;
- ras.traceIncr = - pitch;
+ ras.traceIncr = (Short)- pitch;
ras.traceOfs = - *min * pitch;
- if (ras.traceIncr > 0)
+ if (pitch > 0)
ras.traceOfs += (ras.target.rows-1)*pitch;
ras.gray_min_x = 0;
@@ -2152,7 +2137,7 @@
ras.traceOfs = 0;
pitch = ras.target.pitch;
byte_len = -pitch;
- ras.traceIncr = byte_len;
+ ras.traceIncr = (Short)byte_len;
ras.traceG = (*min/2)*byte_len;
if (pitch > 0)
{
@@ -2160,8 +2145,8 @@
byte_len = -byte_len;
}
- ras.gray_min_x = byte_len;
- ras.gray_max_x = -byte_len;
+ ras.gray_min_x = (Short)byte_len;
+ ras.gray_max_x = -(Short)byte_len;
}
@@ -2359,8 +2344,8 @@
{
Q = P->link;
- bottom = P->start;
- top = P->start + P->height-1;
+ bottom = (Short)P->start;
+ top = (Short)P->start + P->height-1;
if ( min_Y > bottom ) min_Y = bottom;
if ( max_Y < top ) max_Y = top;
@@ -2959,8 +2944,8 @@ Scan_DropOuts :
ras.target = *target_map;
return ( params->flags & ft_raster_flag_aa
- ? Render_Glyph( raster )
- : Render_Gray_Glyph( raster ) );
+ ? Render_Gray_Glyph( raster )
+ : Render_Glyph( raster ) );
#if 0
/* Note that we always use drop-out mode 2, because it seems that */
diff --git a/demos/src/ftrast.h b/demos/src/ftrast.h
new file mode 100644
index 0000000..c08dee3
--- /dev/null
+++ b/demos/src/ftrast.h
@@ -0,0 +1,8 @@
+#ifndef FTRASTER_H
+#define FTRASTER_H
+
+#include <ftimage.h>
+
+ extern FT_Raster_Funcs ft_black_raster;
+
+#endif
diff --git a/demos/src/ftview.c b/demos/src/ftview.c
index c66920a..b0c0921 100644
--- a/demos/src/ftview.c
+++ b/demos/src/ftview.c
@@ -28,6 +28,7 @@
#include "grfont.h"
#include "ftgrays.h"
+#include "ftrast.h"
#define DIM_X 500
#define DIM_Y 400
@@ -423,7 +424,10 @@ $\243^\250*\265\371%!\247:/;.,?<>";
FT_Error error;
error = 1;
- if ( use_grays && antialias )
+ if ( !antialias)
+ error = FT_Set_Raster( library, &ft_black_raster );
+
+ else if ( use_grays && antialias )
error = FT_Set_Raster( library, &ft_grays_raster );
if (error)