52 #define FT_CONFIG_STANDARD_LIBRARY_H <stdlib.h>
63 #include FT_INTERNAL_CALC_H
159 #define RASTER_GRAY_LINES 2048
177 #define FT_COMPONENT trace_raster
187 #define FT_UNUSED( x ) (x) = (x)
192 #define FT_ERROR( x ) do { } while ( 0 )
196 #define FT_TRACE( x ) do { } while ( 0 )
197 #define FT_TRACE1( x ) do { } while ( 0 )
198 #define FT_TRACE6( x ) do { } while ( 0 )
201 #define Raster_Err_None 0
202 #define Raster_Err_Not_Ini -1
203 #define Raster_Err_Overflow -2
204 #define Raster_Err_Neg_Height -3
205 #define Raster_Err_Invalid -4
206 #define Raster_Err_Unsupported -5
208 #define ft_memset memset
210 #define FT_DEFINE_RASTER_FUNCS( class_, glyph_format_, raster_new_, \
211 raster_reset_, raster_set_mode_, \
212 raster_render_, raster_done_ ) \
213 const FT_Raster_Funcs class_ = \
226 #include FT_INTERNAL_OBJECTS_H
227 #include FT_INTERNAL_DEBUG_H
231 #define Raster_Err_None Raster_Err_Ok
232 #define Raster_Err_Not_Ini Raster_Err_Raster_Uninitialized
233 #define Raster_Err_Overflow Raster_Err_Raster_Overflow
234 #define Raster_Err_Neg_Height Raster_Err_Raster_Negative_Height
235 #define Raster_Err_Invalid Raster_Err_Invalid_Outline
236 #define Raster_Err_Unsupported Raster_Err_Cannot_Render_Glyph
243 #define FT_MEM_SET( d, s, c ) ft_memset( d, s, c )
247 #define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count )
253 #define FMulDiv( a, b, c ) ( (a) * (b) / (c) )
258 #define SMulDiv FT_MulDiv
273 #define NULL (void*)0
310 typedef union Alignment_
319 typedef struct TPoint_
329 #define Overshoot_Top 0x10
330 #define Overshoot_Bottom 0x20
372 typedef struct black_TBand_
380 #define AlignProfileSize \
381 ( ( sizeof ( TProfile ) + sizeof ( Alignment ) - 1 ) / sizeof ( long ) )
389 #ifdef FT_STATIC_RASTER
398 #define FT_UNUSED_RASTER do { } while ( 0 )
404 #define RAS_ARGS black_PWorker worker,
405 #define RAS_ARG black_PWorker worker
407 #define RAS_VARS worker,
408 #define RAS_VAR worker
410 #define FT_UNUSED_RASTER FT_UNUSED( worker )
441 #define FLOOR( x ) ( (x) & -ras.precision )
442 #define CEILING( x ) ( ( (x) + ras.precision - 1 ) & -ras.precision )
443 #define TRUNC( x ) ( (signed long)(x) >> ras.precision_bits )
444 #define FRAC( x ) ( (x) & ( ras.precision - 1 ) )
445 #define SCALED( x ) ( ( (x) << ras.scale_shift ) - ras.precision_half )
447 #define IS_BOTTOM_OVERSHOOT( x ) ( CEILING( x ) - x >= ras.precision_half )
448 #define IS_TOP_OVERSHOOT( x ) ( x - FLOOR( x ) >= ras.precision_half )
454 struct black_TWorker_
461 Int precision_jitter;
530 #ifdef FT_RASTER_OPTION_ANTI_ALIASING
552 typedef struct black_TRaster_
563 #ifdef FT_STATIC_RASTER
570 #define ras (*worker)
575 #ifdef FT_RASTER_OPTION_ANTI_ALIASING
599 static const short count_table[256] =
601 0x0000, 0x0001, 0x0001, 0x0002, 0x0010, 0x0011, 0x0011, 0x0012,
602 0x0010, 0x0011, 0x0011, 0x0012, 0x0020, 0x0021, 0x0021, 0x0022,
603 0x0100, 0x0101, 0x0101, 0x0102, 0x0110, 0x0111, 0x0111, 0x0112,
604 0x0110, 0x0111, 0x0111, 0x0112, 0x0120, 0x0121, 0x0121, 0x0122,
605 0x0100, 0x0101, 0x0101, 0x0102, 0x0110, 0x0111, 0x0111, 0x0112,
606 0x0110, 0x0111, 0x0111, 0x0112, 0x0120, 0x0121, 0x0121, 0x0122,
607 0x0200, 0x0201, 0x0201, 0x0202, 0x0210, 0x0211, 0x0211, 0x0212,
608 0x0210, 0x0211, 0x0211, 0x0212, 0x0220, 0x0221, 0x0221, 0x0222,
609 0x1000, 0x1001, 0x1001, 0x1002, 0x1010, 0x1011, 0x1011, 0x1012,
610 0x1010, 0x1011, 0x1011, 0x1012, 0x1020, 0x1021, 0x1021, 0x1022,
611 0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112,
612 0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122,
613 0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112,
614 0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122,
615 0x1200, 0x1201, 0x1201, 0x1202, 0x1210, 0x1211, 0x1211, 0x1212,
616 0x1210, 0x1211, 0x1211, 0x1212, 0x1220, 0x1221, 0x1221, 0x1222,
617 0x1000, 0x1001, 0x1001, 0x1002, 0x1010, 0x1011, 0x1011, 0x1012,
618 0x1010, 0x1011, 0x1011, 0x1012, 0x1020, 0x1021, 0x1021, 0x1022,
619 0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112,
620 0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122,
621 0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112,
622 0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122,
623 0x1200, 0x1201, 0x1201, 0x1202, 0x1210, 0x1211, 0x1211, 0x1212,
624 0x1210, 0x1211, 0x1211, 0x1212, 0x1220, 0x1221, 0x1221, 0x1222,
625 0x2000, 0x2001, 0x2001, 0x2002, 0x2010, 0x2011, 0x2011, 0x2012,
626 0x2010, 0x2011, 0x2011, 0x2012, 0x2020, 0x2021, 0x2021, 0x2022,
627 0x2100, 0x2101, 0x2101, 0x2102, 0x2110, 0x2111, 0x2111, 0x2112,
628 0x2110, 0x2111, 0x2111, 0x2112, 0x2120, 0x2121, 0x2121, 0x2122,
629 0x2100, 0x2101, 0x2101, 0x2102, 0x2110, 0x2111, 0x2111, 0x2112,
630 0x2110, 0x2111, 0x2111, 0x2112, 0x2120, 0x2121, 0x2121, 0x2122,
631 0x2200, 0x2201, 0x2201, 0x2202, 0x2210, 0x2211, 0x2211, 0x2212,
632 0x2210, 0x2211, 0x2211, 0x2212, 0x2220, 0x2221, 0x2221, 0x2222
687 ras.precision_bits = 12;
688 ras.precision_step = 256;
689 ras.precision_jitter = 30;
693 ras.precision_bits = 6;
694 ras.precision_step = 32;
695 ras.precision_jitter = 2;
698 FT_TRACE6((
"Set_High_Precision(%s)\n", High ?
"true" :
"false" ));
700 ras.precision = 1 <<
ras.precision_bits;
701 ras.precision_half =
ras.precision / 2;
731 ras.fProfile =
ras.cProfile;
735 if (
ras.top >=
ras.maxBuff )
741 ras.cProfile->flags = 0;
742 ras.cProfile->start = 0;
743 ras.cProfile->height = 0;
744 ras.cProfile->offset =
ras.top;
747 ras.cProfile->flags =
ras.dropOutControl;
756 FT_TRACE6((
"New ascending profile = %p\n",
ras.cProfile ));
762 FT_TRACE6((
"New descending profile = %p\n",
ras.cProfile ));
766 FT_ERROR((
"New_Profile: invalid profile direction\n" ));
772 ras.gProfile =
ras.cProfile;
808 FT_ERROR((
"End_Profile: negative height encountered\n" ));
815 FT_TRACE6((
"Ending profile %p, start = %ld, height = %ld\n",
816 ras.cProfile,
ras.cProfile->start, h ));
818 ras.cProfile->height =
h;
827 oldProfile =
ras.cProfile;
832 ras.cProfile->height = 0;
833 ras.cProfile->offset =
ras.top;
835 oldProfile->next =
ras.cProfile;
839 if (
ras.top >=
ras.maxBuff )
841 FT_TRACE1((
"overflow in End_Profile\n" ));
874 n =
ras.numTurns - 1;
875 y_turns =
ras.sizeBuff -
ras.numTurns;
878 while ( n >= 0 && y < y_turns[n] )
882 if ( n >= 0 && y > y_turns[n] )
885 y2 = (
Int)y_turns[n];
894 if (
ras.maxBuff <=
ras.top )
900 ras.sizeBuff[-
ras.numTurns] =
y;
934 p->link = (
PProfile)( p->offset + p->height );
940 bottom = (
Int)p->start;
941 top = (
Int)( p->start + p->height - 1 );
945 bottom = (
Int)( p->start - p->height + 1 );
948 p->offset += p->height - 1;
988 base[4].x = base[2].x;
990 a = base[3].x = ( base[2].x +
b ) / 2;
991 b = base[1].x = ( base[0].x +
b ) / 2;
992 base[2].x = ( a +
b ) / 2;
994 base[4].y = base[2].y;
996 a = base[3].y = ( base[2].y +
b ) / 2;
997 b = base[1].y = ( base[0].y +
b ) / 2;
998 base[2].y = ( a +
b ) / 2;
1025 base[6].x = base[3].x;
1028 base[1].x = a = ( base[0].x + c + 1 ) >> 1;
1029 base[5].x = b = ( base[3].x + d + 1 ) >> 1;
1030 c = ( c + d + 1 ) >> 1;
1031 base[2].x = a = ( a + c + 1 ) >> 1;
1032 base[4].x = b = ( b + c + 1 ) >> 1;
1033 base[3].x = ( a + b + 1 ) >> 1;
1035 base[6].y = base[3].y;
1038 base[1].y = a = ( base[0].y + c + 1 ) >> 1;
1039 base[5].y = b = ( base[3].y + d + 1 ) >> 1;
1040 c = ( c + d + 1 ) >> 1;
1041 base[2].y = a = ( a + c + 1 ) >> 1;
1042 base[4].y = b = ( b + c + 1 ) >> 1;
1043 base[3].y = ( a + b + 1 ) >> 1;
1097 x1 +=
SMulDiv( Dx, miny - y1, Dy );
1136 ras.joint = (char)( f2 == 0 );
1140 ras.cProfile->start = e1;
1145 if (
ras.top + size >=
ras.maxBuff )
1154 Rx = (
ras.precision * Dx ) % Dy;
1160 Rx = (
ras.precision * -Dx ) % Dy;
1226 if ( fresh && !
ras.fresh )
1227 ras.cProfile->start = -
ras.cProfile->start;
1304 *top++ = arc[degree].x;
1319 if ( ( top +
TRUNC( e2 - e ) + 1 ) >=
ras.maxBuff )
1328 while ( arc >= start_arc && e <= e2 )
1337 if ( y2 - y1 >=
ras.precision_step )
1344 *top++ = arc[degree].x +
FMulDiv( arc[0].
x - arc[degree].
x,
1401 arc[0].y = -arc[0].y;
1402 arc[1].y = -arc[1].y;
1403 arc[2].y = -arc[2].y;
1405 arc[3].y = -arc[3].y;
1411 if ( fresh && !
ras.fresh )
1412 ras.cProfile->start = -
ras.cProfile->start;
1414 arc[0].y = -arc[0].y;
1444 switch (
ras.state )
1447 if ( y >
ras.lastY )
1455 if ( y <
ras.lastY )
1463 if ( y <
ras.lastY )
1473 if ( y >
ras.lastY )
1488 switch (
ras.state )
1492 x, y,
ras.minY,
ras.maxY ) )
1498 x, y,
ras.minY,
ras.maxY ) )
1547 ras.arc[2].x =
ras.lastX;
1548 ras.arc[2].y =
ras.lastY;
1580 else if ( y1 == y3 )
1590 if (
ras.state != state_bez )
1617 }
while (
ras.arc >=
ras.arcs );
1664 Long y1,
y2, y3, y4, x4, ymin1, ymax1, ymin2, ymax2;
1669 ras.arc[3].x =
ras.lastX;
1670 ras.arc[3].y =
ras.lastY;
1710 if ( ymin2 < ymin1 || ymax2 > ymax1 )
1716 else if ( y1 == y4 )
1726 if (
ras.state != state_bez )
1752 }
while (
ras.arc >=
ras.arcs );
1765 #define SWAP_( x, y ) do \
1813 points =
ras.outline.points;
1814 limit = points + last;
1816 v_start.
x =
SCALED( points[first].
x );
1817 v_start.
y =
SCALED( points[first].
y );
1818 v_last.
x =
SCALED( points[last].x );
1819 v_last.
y =
SCALED( points[last].y );
1823 SWAP_( v_start.
x, v_start.
y );
1827 v_control = v_start;
1829 point = points +
first;
1834 ras.dropOutControl = (
Byte)tags[0] >> 5;
1840 goto Invalid_Outline;
1857 v_start.
x = ( v_start.
x + v_last.
x ) / 2;
1858 v_start.
y = ( v_start.
y + v_last.
y ) / 2;
1866 ras.lastX = v_start.
x;
1867 ras.lastY = v_start.
y;
1869 while ( point < limit )
1894 v_control.
x =
SCALED( point[0].x );
1895 v_control.
y =
SCALED( point[0].y );
1898 SWAP_( v_control.
x, v_control.
y );
1901 if ( point < limit )
1911 x =
SCALED( point[0].x );
1912 y =
SCALED( point[0].y );
1925 goto Invalid_Outline;
1927 v_middle.
x = ( v_control.
x +
x ) / 2;
1928 v_middle.
y = ( v_control.
y +
y ) / 2;
1931 v_middle.
x, v_middle.
y ) )
1941 v_start.
x, v_start.
y ) )
1951 if ( point + 1 > limit ||
1953 goto Invalid_Outline;
1958 x1 =
SCALED( point[-2].x );
1959 y1 =
SCALED( point[-2].y );
1960 x2 =
SCALED( point[-1].x );
1961 y2 =
SCALED( point[-1].y );
1969 if ( point <= limit )
1971 x3 =
SCALED( point[0].x );
1972 y3 =
SCALED( point[0].y );
2038 ras.cProfile->offset =
ras.top;
2043 for ( i = 0; i <
ras.outline.n_contours; i++ )
2052 ras.outline.contours[i],
2056 start =
ras.outline.contours[
i] + 1;
2059 if (
FRAC(
ras.lastY ) == 0 &&
2062 if (
ras.gProfile &&
2069 lastProfile =
ras.cProfile;
2079 lastProfile->next =
ras.gProfile;
2133 old = ¤t->link;
2137 profile->link = current;
2160 if ( current == profile )
2162 *old = current->link;
2166 old = ¤t->link;
2193 current->X = *current->offset;
2194 current->offset += current->flags &
Flow_Up ? 1 : -1;
2196 current = current->link;
2206 next = current->link;
2210 if ( current->X <= next->X )
2212 old = ¤t->link;
2221 current->link = next->link;
2222 next->link = current;
2228 next = current->link;
2246 Long pitch =
ras.target.pitch;
2252 ras.traceOfs = -*min * pitch;
2254 ras.traceOfs += (
ras.target.rows - 1 ) * pitch;
2282 if ( x2 - x1 -
ras.precision <=
ras.precision_jitter )
2287 if ( e2 >= 0 && e1 <
ras.bWidth )
2291 if ( e2 >=
ras.bWidth )
2292 e2 =
ras.bWidth - 1;
2294 c1 = (
Short)( e1 >> 3 );
2295 c2 = (
Short)( e2 >> 3 );
2297 f1 = (
Byte) ( 0xFF >> ( e1 & 7 ) );
2298 f2 = (
Byte) ~( 0x7F >> ( e2 & 7 ) );
2300 if (
ras.gray_min_x > c1 )
2301 ras.gray_min_x = (short)c1;
2302 if (
ras.gray_max_x < c2 )
2303 ras.gray_max_x = (short)c2;
2305 target =
ras.bTarget +
ras.traceOfs + c1;
2324 *target |= ( f1 & f2 );
2369 Int dropOutControl = left->flags & 7;
2372 if ( e1 == e2 +
ras.precision )
2374 switch ( dropOutControl )
2381 pxl =
FLOOR( ( x1 + x2 - 1 ) / 2 +
ras.precision_half );
2414 if ( left->next == right &&
2415 left->height <= 0 &&
2417 x2 - x1 >=
ras.precision_half ) )
2421 if ( right->next == left &&
2424 x2 - x1 >=
ras.precision_half ) )
2427 if ( dropOutControl == 1 )
2430 pxl =
FLOOR( ( x1 + x2 - 1 ) / 2 +
ras.precision_half );
2442 else if (
TRUNC( pxl ) >=
ras.bWidth )
2446 e1 = pxl == e1 ? e2 : e1;
2450 c1 = (
Short)( e1 >> 3 );
2451 f1 = (
Short)( e1 & 7 );
2453 if ( e1 >= 0 && e1 <
ras.bWidth &&
2454 ras.bTarget[
ras.traceOfs + c1] & ( 0x80 >> f1 ) )
2463 if ( e1 >= 0 && e1 <
ras.bWidth )
2465 c1 = (
Short)( e1 >> 3 );
2466 f1 = (
Short)( e1 & 7 );
2468 if (
ras.gray_min_x > c1 )
2469 ras.gray_min_x = c1;
2470 if (
ras.gray_max_x < c1 )
2471 ras.gray_max_x = c1;
2473 ras.bTarget[
ras.traceOfs + c1] |= (char)( 0x80 >> f1 );
2481 ras.traceOfs +=
ras.traceIncr;
2520 if ( x2 - x1 <
ras.precision )
2527 bits =
ras.bTarget + ( y >> 3 );
2528 f1 = (
Byte)( 0x80 >> ( y & 7 ) );
2532 if ( e1 >= 0 && e1 <
ras.target.rows )
2537 p = bits - e1 *
ras.target.pitch;
2538 if (
ras.target.pitch > 0 )
2539 p += (
ras.target.rows - 1 ) *
ras.target.pitch;
2578 Int dropOutControl = left->flags & 7;
2581 if ( e1 == e2 +
ras.precision )
2583 switch ( dropOutControl )
2590 pxl =
FLOOR( ( x1 + x2 - 1 ) / 2 +
ras.precision_half );
2598 if ( left->next == right &&
2599 left->height <= 0 &&
2601 x2 - x1 >=
ras.precision_half ) )
2605 if ( right->next == left &&
2608 x2 - x1 >=
ras.precision_half ) )
2611 if ( dropOutControl == 1 )
2614 pxl =
FLOOR( ( x1 + x2 - 1 ) / 2 +
ras.precision_half );
2626 else if (
TRUNC( pxl ) >=
ras.target.rows )
2630 e1 = pxl == e1 ? e2 : e1;
2634 bits =
ras.bTarget + ( y >> 3 );
2635 f1 = (
Byte)( 0x80 >> ( y & 7 ) );
2637 bits -= e1 *
ras.target.pitch;
2638 if (
ras.target.pitch > 0 )
2639 bits += (
ras.target.rows - 1 ) *
ras.target.pitch;
2642 e1 <
ras.target.rows &&
2650 bits =
ras.bTarget + ( y >> 3 );
2651 f1 = (
Byte)( 0x80 >> ( y & 7 ) );
2655 if ( e1 >= 0 && e1 <
ras.target.rows )
2657 bits -= e1 *
ras.target.pitch;
2658 if (
ras.target.pitch > 0 )
2659 bits += (
ras.target.rows - 1 ) *
ras.target.pitch;
2674 #ifdef FT_RASTER_OPTION_ANTI_ALIASING
2697 Long pitch, byte_len;
2701 *max = ( *max + 3 ) & -2;
2704 pitch =
ras.target.pitch;
2707 ras.traceG = ( *min / 2 ) * byte_len;
2711 ras.traceG += (
ras.target.rows - 1 ) * pitch;
2712 byte_len = -byte_len;
2721 Vertical_Gray_Sweep_Step(
RAS_ARG )
2724 PByte pix, bit, bit2;
2725 short*
count = (
short*)count_table;
2729 ras.traceOfs +=
ras.gray_width;
2731 if (
ras.traceOfs >
ras.gray_width )
2733 pix =
ras.gTarget +
ras.traceG +
ras.gray_min_x * 4;
2736 if (
ras.gray_max_x >= 0 )
2738 Long last_pixel =
ras.target.width - 1;
2739 Int last_cell = last_pixel >> 2;
2740 Int last_bit = last_pixel & 3;
2744 if (
ras.gray_max_x >= last_cell && last_bit != 3 )
2746 ras.gray_max_x = last_cell - 1;
2750 if (
ras.gray_min_x < 0 )
2753 bit =
ras.bTarget +
ras.gray_min_x;
2754 bit2 = bit +
ras.gray_width;
2756 c1 =
ras.gray_max_x -
ras.gray_min_x;
2760 c2 = count[*bit] + count[*bit2];
2764 pix[0] = grays[(c2 >> 12) & 0x000F];
2765 pix[1] = grays[(c2 >> 8 ) & 0x000F];
2766 pix[2] = grays[(c2 >> 4 ) & 0x000F];
2767 pix[3] = grays[ c2 & 0x000F];
2781 c2 = count[*bit] + count[*bit2];
2787 pix[2] = grays[(c2 >> 4 ) & 0x000F];
2789 pix[1] = grays[(c2 >> 8 ) & 0x000F];
2791 pix[0] = grays[(c2 >> 12) & 0x000F];
2801 ras.traceG +=
ras.traceIncr;
2803 ras.gray_min_x = 32000;
2804 ras.gray_max_x = -32000;
2845 Int dropOutControl = left->flags & 7;
2848 if ( e1 == e2 +
ras.precision )
2850 switch ( dropOutControl )
2857 e1 =
FLOOR( ( x1 + x2 - 1 ) / 2 +
ras.precision_half );
2865 if ( left->next == right && left->height <= 0 )
2869 if ( right->next == left && left->start == y )
2872 if ( dropOutControl == 1 )
2875 e1 =
FLOOR( ( x1 + x2 - 1 ) / 2 +
ras.precision_half );
2889 if ( x2 - x1 >=
ras.precision_half )
2890 color =
ras.grays[2];
2892 color =
ras.grays[1];
2894 e1 =
TRUNC( e1 ) / 2;
2895 if ( e1 <
ras.target.rows )
2897 pixel =
ras.gTarget - e1 *
ras.target.pitch + y / 2;
2898 if (
ras.target.pitch > 0 )
2899 pixel += (
ras.target.rows - 1 ) *
ras.target.pitch;
2901 if ( pixel[0] ==
ras.grays[0] )
2920 Short y, y_change, y_height;
2949 bottom = (
Short)P->start;
2950 top = (
Short)( P->start + P->height - 1 );
2952 if ( min_Y > bottom )
2964 if (
ras.numTurns == 0 )
2980 P->countL = (
UShort)( P->start - min_Y );
2989 if (
ras.numTurns > 0 &&
2990 ras.sizeBuff[-
ras.numTurns] == min_Y )
2993 while (
ras.numTurns > 0 )
3002 P->countL -= y_height;
3003 if ( P->countL == 0 )
3010 InsNew( &draw_right, P );
3019 Sort( &draw_right );
3022 y_height = (
Short)( y_change -
y );
3024 while ( y < y_change )
3031 P_Right = draw_right;
3048 if ( x2 - x1 <=
ras.precision &&
3049 e1 != x1 && e2 != x2 )
3051 if ( e1 > e2 || e2 == e1 +
ras.precision )
3053 Int dropOutControl = P_Left->flags & 7;
3056 if ( dropOutControl != 2 )
3072 ras.Proc_Sweep_Span(
RAS_VARS y, x1, x2, P_Left, P_Right );
3076 P_Left = P_Left->link;
3077 P_Right = P_Right->link;
3095 Sort( &draw_right );
3105 if ( P->height == 0 )
3114 if ( P->height == 0 )
3115 DelOld( &draw_right, P );
3121 while ( y <= max_Y )
3132 P_Right = draw_right;
3136 if ( P_Left->countL )
3149 P_Left = P_Left->link;
3150 P_Right = P_Right->link;
3177 while (
ras.band_top >= 0 )
3199 i =
ras.band_stack[
ras.band_top].y_min;
3200 j =
ras.band_stack[
ras.band_top].y_max;
3202 k = (
Short)( ( i + j ) / 2 );
3204 if (
ras.band_top >= 7 || k < i )
3212 ras.band_stack[
ras.band_top + 1].y_min =
k;
3213 ras.band_stack[
ras.band_top + 1].y_max =
j;
3215 ras.band_stack[
ras.band_top].y_max = (
Short)( k - 1 );
3251 ras.scale_shift =
ras.precision_shift;
3254 ras.dropOutControl = 2;
3258 ras.dropOutControl = 4;
3260 ras.dropOutControl = 0;
3263 ras.dropOutControl += 1;
3276 ras.band_stack[0].y_min = 0;
3277 ras.band_stack[0].y_max = (short)(
ras.target.rows - 1 );
3279 ras.bWidth = (
unsigned short)
ras.target.width;
3286 if (
ras.second_pass &&
ras.dropOutControl != 2 )
3294 ras.band_stack[0].y_min = 0;
3295 ras.band_stack[0].y_max = (short)(
ras.target.width - 1 );
3305 #ifdef FT_RASTER_OPTION_ANTI_ALIASING
3327 ras.scale_shift =
ras.precision_shift + 1;
3330 ras.dropOutControl = 2;
3334 ras.dropOutControl = 4;
3336 ras.dropOutControl = 0;
3339 ras.dropOutControl += 1;
3347 ras.band_stack[0].y_min = 0;
3348 ras.band_stack[0].y_max = 2 *
ras.target.rows - 1;
3350 ras.bWidth =
ras.gray_width;
3351 pixel_width = 2 * ( (
ras.target.width + 3 ) >> 2 );
3353 if (
ras.bWidth > pixel_width )
3354 ras.bWidth = pixel_width;
3356 ras.bWidth =
ras.bWidth * 8;
3360 ras.Proc_Sweep_Init = Vertical_Gray_Sweep_Init;
3363 ras.Proc_Sweep_Step = Vertical_Gray_Sweep_Step;
3370 if (
ras.second_pass &&
ras.dropOutControl != 2 )
3373 ras.Proc_Sweep_Span = Horizontal_Gray_Sweep_Span;
3374 ras.Proc_Sweep_Drop = Horizontal_Gray_Sweep_Drop;
3378 ras.band_stack[0].y_min = 0;
3379 ras.band_stack[0].y_max =
ras.target.width * 2 - 1;
3405 #ifdef FT_RASTER_OPTION_ANTI_ALIASING
3410 for ( n = 0; n < 5; n++ )
3411 raster->grays[n] = n * 255 / 4;
3436 FT_MEM_ZERO( &the_raster,
sizeof ( the_raster ) );
3465 raster->memory = memory;
3495 if ( pool_base && pool_size >= (
long)
sizeof (
black_TWorker ) + 2048 )
3500 raster->buffer = pool_base + ( (
sizeof ( *worker ) + 7 ) & ~7 );
3501 raster->buffer_size = pool_base + pool_size - (
char*)raster->buffer;
3502 raster->worker = worker;
3506 raster->buffer =
NULL;
3507 raster->buffer_size = 0;
3508 raster->worker =
NULL;
3517 const char* palette )
3519 #ifdef FT_RASTER_OPTION_ANTI_ALIASING
3524 raster->grays[0] = palette[0];
3525 raster->grays[1] = palette[1];
3526 raster->grays[2] = palette[2];
3527 raster->grays[3] = palette[3];
3528 raster->grays[4] = palette[4];
3550 if ( !raster || !raster->buffer || !raster->buffer_size )
3567 worker = raster->worker;
3577 if ( !target_map->width || !target_map->rows )
3580 if ( !target_map->buffer )
3583 ras.outline = *outline;
3584 ras.target = *target_map;
3586 worker->buff = (
PLong) raster->buffer;
3587 worker->sizeBuff = worker->buff +
3589 #ifdef FT_RASTER_OPTION_ANTI_ALIASING
3590 worker->grays = raster->grays;
3591 worker->gray_width = raster->gray_width;
3593 FT_MEM_ZERO( worker->gray_lines, worker->gray_width * 2 );
#define FT_OUTLINE_SINGLE_PASS
#define FT_Raster_Done_Func
static Bool Decompose_Curve(RAS_ARGS UShort first, UShort last, int flipped)
union Alignment_ * PAlignment
#define Raster_Err_Invalid
static void Set_High_Precision(RAS_ARGS Int High)
struct black_TWorker_ black_TWorker
GLfloat GLfloat GLfloat GLfloat h
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
static void ft_black_reset(black_PRaster raster, char *pool_base, long pool_size)
struct FT_RasterRec_ * FT_Raster
static void Horizontal_Sweep_Init(RAS_ARGS Short *min, Short *max)
#define FT_CURVE_TAG_CUBIC
#define FT_Raster_Set_Mode_Func
#define FT_Raster_New_Func
#define RASTER_GRAY_LINES
#define FT_OUTLINE_IGNORE_DROPOUTS
void(* TSplitter)(TPoint *base)
static void Vertical_Sweep_Step(RAS_ARG)
static Bool Insert_Y_Turn(RAS_ARGS Int y)
static void Vertical_Sweep_Init(RAS_ARGS Short *min, Short *max)
#define Raster_Err_Overflow
struct black_TBand_ black_TBand
return Display return Display Bool Bool int int e
void Function_Sweep_Init(RAS_ARGS Short *min, Short *max)
#define FT_RASTER_FLAG_AA
#define Raster_Err_Not_Ini
EGLSurface EGLint EGLint EGLint EGLint height
static Bool Draw_Sweep(RAS_ARG)
GLboolean GLboolean GLboolean GLboolean a
static void ft_black_set_mode(black_PRaster raster, unsigned long mode, const char *palette)
#define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_,raster_reset_, raster_set_mode_,raster_render_, raster_done_)
return Display return Display Bool Bool int d
static Bool Bezier_Up(RAS_ARGS Int degree, TSplitter splitter, Long miny, Long maxy)
struct TProfile_ TProfile
static void Split_Conic(TPoint *base)
#define IS_BOTTOM_OVERSHOOT(x)
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLfixed GLfixed GLfixed y2
struct black_TRaster_ black_TRaster
#define FT_TRACE1(varformat)
#define FT_CURVE_TAG_HAS_SCANMODE
#define FT_ERROR(varformat)
static int ft_black_render(black_PRaster raster, const FT_Raster_Params *params)
static void DelOld(PProfileList list, PProfile profile)
EGLContext EGLenum target
union Alignment_ Alignment
static Bool Convert_Glyph(RAS_ARGS int flipped)
EGLContext EGLenum EGLClientBuffer buffer
static Bool New_Profile(RAS_ARGS TStates aState, Bool overshoot)
#define FT_Raster_Render_Func
static void Init_Linked(TProfileList *l)
static void Vertical_Sweep_Drop(RAS_ARGS Short y, FT_F26Dot6 x1, FT_F26Dot6 x2, PProfile left, PProfile right)
#define FT_OUTLINE_HIGH_PRECISION
static void ft_black_done(black_PRaster raster)
static int Render_Single_Pass(RAS_ARGS Bool flipped)
static Bool Cubic_To(RAS_ARGS Long cx1, Long cy1, Long cx2, Long cy2, Long x, Long y)
static void Horizontal_Sweep_Drop(RAS_ARGS Short y, FT_F26Dot6 x1, FT_F26Dot6 x2, PProfile left, PProfile right)
#define FT_MEM_ZERO(dest, count)
GLfloat GLfloat GLfloat top
void Function_Sweep_Span(RAS_ARGS Short y, FT_F26Dot6 x1, FT_F26Dot6 x2, PProfile left, PProfile right)
static Bool Finalize_Profile_Table(RAS_ARG)
void Function_Sweep_Step(RAS_ARG)
static void Horizontal_Sweep_Step(RAS_ARG)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
static Bool End_Profile(RAS_ARGS Bool overshoot)
static void Vertical_Sweep_Span(RAS_ARGS Short y, FT_F26Dot6 x1, FT_F26Dot6 x2, PProfile left, PProfile right)
static void Sort(PProfileList list)
GLuint GLfloat GLfloat GLfloat x1
#define FT_OUTLINE_INCLUDE_STUBS
#define FT_RASTER_FLAG_DIRECT
EGLSurface EGLint EGLint y
#define FT_Raster_Reset_Func
#define FT_TRACE6(varformat)
static Bool Line_To(RAS_ARGS Long x, Long y)
static void ft_black_init(black_PRaster raster)
#define IS_TOP_OVERSHOOT(x)
struct black_TRaster_ * black_PRaster
GLenum GLsizei GLsizei GLsizei GLsizei GLbitfield flags
#define Raster_Err_Neg_Height
static Bool Conic_To(RAS_ARGS Long cx, Long cy, Long x, Long y)
#define FT_OUTLINE_SMART_DROPOUTS
GLdouble GLdouble GLdouble b
GLuint GLdouble GLdouble GLint GLint const GLdouble * points
#define FT_MAKE_TAG(_x1, _x2, _x3, _x4)
#define FT_CURVE_TAG_CONIC
GLenum GLint GLint * precision
#define FT_CURVE_TAG(flag)
#define Raster_Err_Unsupported
static void Horizontal_Sweep_Span(RAS_ARGS Short y, FT_F26Dot6 x1, FT_F26Dot6 x2, PProfile left, PProfile right)
static Bool Line_Up(RAS_ARGS Long x1, Long y1, Long x2, Long y2, Long miny, Long maxy)
static Bool Line_Down(RAS_ARGS Long x1, Long y1, Long x2, Long y2, Long miny, Long maxy)
static Bool Bezier_Down(RAS_ARGS Int degree, TSplitter splitter, Long miny, Long maxy)
static void Split_Cubic(TPoint *base)
FT_Module_Constructor FT_GLYPH_FORMAT_OUTLINE
static void InsNew(PProfileList list, PProfile profile)
struct black_TWorker_ * black_PWorker
static int ft_black_new(FT_Memory memory, black_PRaster *araster)
Render_Gray_Glyph(RAS_ARG)