99#define FT_COMPONENT smooth
107#define FT_RENDER_POOL_SIZE 16384L
111#define FT_ERR_XCAT( x, y ) x ## y
112#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )
114#define FT_BEGIN_STMNT do {
115#define FT_END_STMNT } while ( 0 )
117#define FT_MIN( a, b ) ( (a) < (b) ? (a) : (b) )
118#define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) )
119#define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) )
127#define FT_HYPOT( x, y ) \
130 x > y ? x + ( 3 * y >> 3 ) \
131 : y + ( 3 * x >> 3 ) )
138#ifdef FT_DEBUG_LEVEL_TRACE
147#define FT_CHAR_BIT CHAR_BIT
148#define FT_UINT_MAX UINT_MAX
149#define FT_INT_MAX INT_MAX
150#define FT_ULONG_MAX ULONG_MAX
152#define ADD_LONG( a, b ) \
153 (long)( (unsigned long)(a) + (unsigned long)(b) )
154#define SUB_LONG( a, b ) \
155 (long)( (unsigned long)(a) - (unsigned long)(b) )
156#define MUL_LONG( a, b ) \
157 (long)( (unsigned long)(a) * (unsigned long)(b) )
158#define NEG_LONG( a ) \
159 (long)( -(unsigned long)(a) )
162#define ft_memset memset
164#define ft_setjmp setjmp
165#define ft_longjmp longjmp
166#define ft_jmp_buf jmp_buf
171#define ErrRaster_Invalid_Mode -2
172#define ErrRaster_Invalid_Outline -1
173#define ErrRaster_Invalid_Argument -3
174#define ErrRaster_Memory_Overflow -4
176#define FT_BEGIN_HEADER
187#define FT_UNUSED( x ) (x) = (x)
192#ifdef FT_DEBUG_LEVEL_TRACE
225#define FT_TRACE5( varformat ) FT_Message varformat
228#define FT_TRACE7( varformat ) FT_Message varformat
231#define FT_ERROR( varformat ) FT_Message varformat
234#define FT_THROW( e ) \
235 ( FT_Throw( FT_ERR_CAT( ErrRaster_, e ), \
238 FT_ERR_CAT( ErrRaster_, e ) )
242#define FT_TRACE5( x ) do { } while ( 0 )
243#define FT_TRACE7( x ) do { } while ( 0 )
244#define FT_ERROR( x ) do { } while ( 0 )
245#define FT_THROW( e ) FT_ERR_CAT( ErrRaster_, e )
251#define FT_DEFINE_OUTLINE_FUNCS( class_, \
252 move_to_, line_to_, \
253 conic_to_, cubic_to_, \
255 static const FT_Outline_Funcs class_ = \
265#define FT_DEFINE_RASTER_FUNCS( class_, glyph_format_, \
266 raster_new_, raster_reset_, \
267 raster_set_mode_, raster_render_, \
269 const FT_Raster_Funcs class_ = \
291#define Smooth_Err_Invalid_Mode Smooth_Err_Cannot_Render_Glyph
292#define Smooth_Err_Memory_Overflow Smooth_Err_Out_Of_Memory
293#define ErrRaster_Memory_Overflow Smooth_Err_Out_Of_Memory
300#define FT_MEM_SET( d, s, c ) ft_memset( d, s, c )
304#define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count )
308#define FT_ZERO( p ) FT_MEM_ZERO( p, sizeof ( *(p) ) )
318#ifndef FT_STATIC_RASTER
320#define RAS_ARG gray_PWorker worker
321#define RAS_ARG_ gray_PWorker worker,
323#define RAS_VAR worker
324#define RAS_VAR_ worker,
339#define ONE_PIXEL ( 1 << PIXEL_BITS )
340#define TRUNC( x ) (TCoord)( (x) >> PIXEL_BITS )
341#define FRACT( x ) (TCoord)( (x) & ( ONE_PIXEL - 1 ) )
344#define UPSCALE( x ) ( (x) * ( ONE_PIXEL >> 6 ) )
345#define DOWNSCALE( x ) ( (x) >> ( PIXEL_BITS - 6 ) )
347#define UPSCALE( x ) ( (x) >> ( 6 - PIXEL_BITS ) )
348#define DOWNSCALE( x ) ( (x) * ( 64 >> PIXEL_BITS ) )
356#define FT_DIV_MOD( type, dividend, divisor, quotient, remainder ) \
358 (quotient) = (type)( (dividend) / (divisor) ); \
359 (remainder) = (type)( (dividend) % (divisor) ); \
360 if ( (remainder) < 0 ) \
363 (remainder) += (type)(divisor); \
374#define FT_DIV_MOD( type, dividend, divisor, quotient, remainder ) \
376 (quotient) = (type)( (dividend) / (divisor) ); \
377 (remainder) = (type)( (dividend) - (quotient) * (divisor) ); \
378 if ( (remainder) < 0 ) \
381 (remainder) += (type)(divisor); \
389#define FT_UDIVPREP( c, b ) \
390 long b ## _r = c ? (long)( FT_ULONG_MAX >> PIXEL_BITS ) / ( b ) \
392#define FT_UDIV( a, b ) \
393 (TCoord)( ( (unsigned long)( a ) * (unsigned long)( b ## _r ) ) >> \
394 ( sizeof( long ) * FT_CHAR_BIT - PIXEL_BITS ) )
430#if FT_RENDER_POOL_SIZE > 2048
431#define FT_MAX_GRAY_POOL ( FT_RENDER_POOL_SIZE / sizeof ( TCell ) )
433#define FT_MAX_GRAY_POOL ( 2048 / sizeof ( TCell ) )
437#define FT_MAX_GRAY_SPANS 10
440#if defined( _MSC_VER )
444#pragma warning( push )
445#pragma warning( disable : 4324 )
477#if defined( _MSC_VER )
478#pragma warning( pop )
482#ifndef FT_STATIC_RASTER
496#ifdef FT_DEBUG_LEVEL_TRACE
506 for (
y =
ras.min_ey;
y <
ras.max_ey;
y++ )
513 for ( ; cell !=
NULL; cell = cell->
next )
514 printf(
" (%3d, c:%4d, a:%6d)",
534 pcell = &
ras.ycells[
ras.ey -
ras.min_ey];
535 while ( ( cell = *pcell ) )
546 if (
ras.num_cells >=
ras.max_cells )
550 cell =
ras.cells +
ras.num_cells++;
586 if ( !
ras.invalid && (
ras.area ||
ras.cover ) )
594 ras.invalid = ( ey >=
ras.max_ey || ey <
ras.min_ey ||
689 }
while ( ex1 != ex2 );
719 if ( ( ey1 >=
ras.max_ey && ey2 >=
ras.max_ey ) ||
720 ( ey1 <
ras.min_ey && ey2 <
ras.min_ey ) )
831 }
while ( ey1 != ey2 );
854 TCoord fx1, fy1, fx2, fy2;
855 TCoord ex1, ey1, ex2, ey2;
862 if ( ( ey1 >=
ras.max_ey && ey2 >=
ras.max_ey ) ||
863 ( ey1 <
ras.min_ey && ey2 <
ras.min_ey ) )
875 if ( ex1 == ex2 && ey1 == ey2 )
888 ras.cover += ( fy2 - fy1 );
889 ras.area += ( fy2 - fy1 ) * fx1 * 2;
893 }
while ( ey1 != ey2 );
898 ras.cover += ( fy2 - fy1 );
899 ras.area += ( fy2 - fy1 ) * fx1 * 2;
903 }
while ( ey1 != ey2 );
923 ras.cover += ( fy2 - fy1 );
924 ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
935 ras.cover += ( fy2 - fy1 );
936 ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
947 ras.cover += ( fy2 - fy1 );
948 ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
959 ras.cover += ( fy2 - fy1 );
960 ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
967 }
while ( ex1 != ex2 || ey1 != ey2 );
973 ras.cover += ( fy2 - fy1 );
974 ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
993 base[2].x = (
a +
b ) >> 2;
1000 base[2].y = (
a +
b ) >> 2;
1023 if ( (
TRUNC( arc[0].
y ) >=
ras.max_ey &&
1035 dx =
FT_ABS( arc[2].
x + arc[0].
x - 2 * arc[1].
x );
1036 dy =
FT_ABS( arc[2].
y + arc[0].
y - 2 * arc[1].
y );
1055 split = draw & ( -draw );
1056 while ( (
split >>= 1 ) )
1085 base[3].x = (
a +
c ) >> 3;
1097 base[3].y = (
a +
c ) >> 3;
1120 if ( (
TRUNC( arc[0].
y ) >=
ras.max_ey &&
1147 if ( arc == bez_stack )
1223 if ( coverage >= 256 )
1224 coverage = 511 - coverage;
1229 coverage = ~coverage;
1231 if ( coverage >= 256 )
1235 if (
ras.num_spans >= 0 )
1242 span->coverage = (
unsigned char)coverage;
1247 ras.render_span(
y,
ras.num_spans,
ras.spans,
ras.render_span_data );
1253 unsigned char*
q =
ras.target.origin -
ras.target.pitch *
y +
x;
1254 unsigned char c = (
unsigned char)coverage;
1299 for (
y =
ras.min_ey;
y <
ras.max_ey;
y++ )
1307 for ( ; cell !=
NULL; cell = cell->
next )
1309 if ( cover != 0 && cell->
x >
x )
1315 if (
area != 0 && cell->
x >=
ras.min_ex )
1324 if (
ras.num_spans > 0 )
1327 ras.render_span(
y,
ras.num_spans,
ras.spans,
ras.render_span_data );
1379#define SCALED( x ) ( (x) * ( 1L << shift ) - delta )
1400 return FT_THROW( Invalid_Outline );
1402 if ( !func_interface )
1403 return FT_THROW( Invalid_Argument );
1406 delta = func_interface->
delta;
1414 FT_TRACE5((
"FT_Outline_Decompose: Outline %d\n",
n ));
1418 goto Invalid_Outline;
1429 v_control = v_start;
1437 goto Invalid_Outline;
1454 v_start.
x = ( v_start.
x + v_last.
x ) / 2;
1455 v_start.
y = ( v_start.
y + v_last.
y ) / 2;
1464 v_start.
x / 64.0, v_start.
y / 64.0 ));
1514 " with control (%.2f, %.2f)\n",
1516 v_control.
x / 64.0, v_control.
y / 64.0 ));
1524 goto Invalid_Outline;
1526 v_middle.
x = ( v_control.
x +
vec.
x ) / 2;
1527 v_middle.
y = ( v_control.
y +
vec.
y ) / 2;
1530 " with control (%.2f, %.2f)\n",
1531 v_middle.
x / 64.0, v_middle.
y / 64.0,
1532 v_control.
x / 64.0, v_control.
y / 64.0 ));
1542 " with control (%.2f, %.2f)\n",
1543 v_start.
x / 64.0, v_start.
y / 64.0,
1544 v_control.
x / 64.0, v_control.
y / 64.0 ));
1555 goto Invalid_Outline;
1575 " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
1577 vec1.
x / 64.0, vec1.
y / 64.0,
1578 vec2.
x / 64.0, vec2.
y / 64.0 ));
1586 " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
1587 v_start.
x / 64.0, v_start.
y / 64.0,
1588 vec1.
x / 64.0, vec1.
y / 64.0,
1589 vec2.
x / 64.0, vec2.
y / 64.0 ));
1598 v_start.
x / 64.0, v_start.
y / 64.0 ));
1608 FT_TRACE5((
"FT_Outline_Decompose: Done\n",
n ));
1616 return FT_THROW( Invalid_Outline );
1636 gray_convert_glyph_inner(
RAS_ARG,
1653 FT_TRACE7((
"band [%d..%d]: %ld cell%s\n",
1657 ras.num_cells == 1 ?
"" :
"s" ));
1664 ras.min_ey,
ras.max_ey ));
1709 for (
y = yMin;
y < yMax; )
1716 band[1] =
ras.min_ey;
1717 band[0] =
ras.max_ey;
1729 ras.min_ey = band[1];
1730 ras.max_ey = band[0];
1757 FT_TRACE7((
"gray_convert_glyph: rotten glyph\n" ));
1767 }
while ( band >= bands );
1785#ifndef FT_STATIC_RASTER
1795 return FT_THROW( Invalid_Argument );
1802 return FT_THROW( Invalid_Outline );
1809 return FT_THROW( Invalid_Outline );
1813 return FT_THROW( Invalid_Outline );
1815#if !defined(FT_STATIC_RASTER) && defined(__REACTOS__)
1816 worker =
malloc(
sizeof(*worker));
1825 if ( !
params->gray_spans )
1826#if !defined(FT_STATIC_RASTER) && defined(__REACTOS__)
1848#if !defined(FT_STATIC_RASTER) && defined(__REACTOS__)
1851 return FT_THROW( Invalid_Argument );
1854 return FT_THROW( Invalid_Argument );
1858 if ( !target_map->width || !target_map->rows )
1859#if !defined(FT_STATIC_RASTER) && defined(__REACTOS__)
1868 if ( !target_map->buffer )
1869#if !defined(FT_STATIC_RASTER) && defined(__REACTOS__)
1872 return FT_THROW( Invalid_Argument );
1875 return FT_THROW( Invalid_Argument );
1878 if ( target_map->pitch < 0 )
1879 ras.target.origin = target_map->buffer;
1881 ras.target.origin = target_map->buffer
1882 + ( target_map->rows - 1 ) * (
unsigned int)target_map->pitch;
1884 ras.target.pitch = target_map->pitch;
1897 if (
ras.max_ex <=
ras.min_ex ||
ras.max_ey <=
ras.min_ey )
1898#if !defined(FT_STATIC_RASTER) && defined(__REACTOS__)
1907#if !defined(FT_STATIC_RASTER) && defined(__REACTOS__)
1982 unsigned char* pool_base,
1983 unsigned long pool_size )
2008 FT_GLYPH_FORMAT_OUTLINE,
std::map< E_MODULE, HMODULE > mod
void user(int argc, const char *argv[])
static LPSTR * split(LPSTR s, LPINT args)
int CDECL vfprintf(FILE *file, const char *format, va_list valist)
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
#define FT_TRACE5(varformat)
#define FT_TRACE7(varformat)
void FT_Message(const char *format,...)
static void gray_render_conic(RAS_ARG_ const FT_Vector *control, const FT_Vector *to)
static void gray_record_cell(RAS_ARG)
static int gray_conic_to(const FT_Vector *control, const FT_Vector *to, gray_PWorker worker)
#define ErrRaster_Memory_Overflow
static int gray_line_to(const FT_Vector *to, gray_PWorker worker)
static void gray_hline(RAS_ARG_ TCoord x, TCoord y, TArea coverage, TCoord acount)
static void gray_render_line(RAS_ARG_ TPos to_x, TPos to_y)
#define FT_UDIVPREP(c, b)
struct gray_TRaster_ gray_TRaster
static int gray_raster_new(FT_Memory memory, FT_Raster *araster)
static int gray_move_to(const FT_Vector *to, gray_PWorker worker)
#define FT_MEM_SET(d, s, c)
static void gray_sweep(RAS_ARG)
static int gray_convert_glyph(RAS_ARG)
static void gray_render_cubic(RAS_ARG_ const FT_Vector *control1, const FT_Vector *control2, const FT_Vector *to)
struct gray_TRaster_ * gray_PRaster
static void gray_raster_done(FT_Raster raster)
struct gray_TWorker_ gray_TWorker
static void gray_set_cell(RAS_ARG_ TCoord ex, TCoord ey)
static void gray_split_cubic(FT_Vector *base)
static int gray_raster_set_mode(FT_Raster raster, unsigned long mode, void *args)
static int gray_cubic_to(const FT_Vector *control1, const FT_Vector *control2, const FT_Vector *to, gray_PWorker worker)
#define FT_MEM_ZERO(dest, count)
struct gray_TWorker_ * gray_PWorker
static void gray_render_scanline(RAS_ARG_ TCoord ey, TPos x1, TCoord y1, TPos x2, TCoord y2)
#define FT_DIV_MOD(type, dividend, divisor, quotient, remainder)
static void gray_split_conic(FT_Vector *base)
static void gray_raster_reset(FT_Raster raster, unsigned char *pool_base, unsigned long pool_size)
static int gray_raster_render(FT_Raster raster, const FT_Raster_Params *params)
#define FT_MAX_GRAY_SPANS
#define FT_CURVE_TAG_CUBIC
#define FT_RASTER_FLAG_AA
#define FT_Raster_Span_Func
#define FT_CURVE_TAG_CONIC
#define FT_Raster_Render_Func
#define FT_OUTLINE_EVEN_ODD_FILL
#define FT_Outline_CubicTo_Func
struct FT_RasterRec_ * FT_Raster
#define FT_Outline_LineTo_Func
#define FT_Raster_Reset_Func
#define FT_RASTER_FLAG_DIRECT
#define FT_CURVE_TAG(flag)
#define FT_Outline_ConicTo_Func
#define FT_Raster_New_Func
#define FT_Raster_Set_Mode_Func
#define FT_Outline_MoveTo_Func
#define FT_Raster_Done_Func
FT_BEGIN_HEADER typedef signed long FT_Pos
#define FT_ALLOC(ptr, size)
#define FT_DEFINE_OUTLINE_FUNCS( class_, move_to_, line_to_, conic_to_, cubic_to_, shift_, delta_)
#define FT_DEFINE_RASTER_FUNCS( class_, glyph_format_, raster_new_, raster_reset_, raster_set_mode_, raster_render_, raster_done_)
FT_BEGIN_HEADER FT_Outline_Decompose(FT_Outline *outline, const FT_Outline_Funcs *func_interface, void *user)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
GLint GLint GLsizei GLsizei height
GLint GLint GLsizei width
GLdouble GLdouble GLdouble GLdouble q
GLenum GLenum GLvoid GLvoid GLvoid * span
GLboolean GLboolean GLboolean b
GLenum const GLfloat * params
GLboolean GLboolean GLboolean GLboolean a
static char memory[1024 *256]
static Real area(Real A[2], Real B[2], Real C[2])
FT_Outline_ConicToFunc conic_to
FT_Outline_LineToFunc line_to
FT_Outline_CubicToFunc cubic_to
FT_Outline_MoveToFunc move_to
FT_Raster_Span_Func render_span
FT_Span spans[FT_MAX_GRAY_SPANS]
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
void int int ULONGLONG int va_list * ap
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList