91#define FT_COMPONENT smooth
99#define FT_RENDER_POOL_SIZE 16384L
103#define FT_ERR_XCAT( x, y ) x ## y
104#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )
106#define FT_BEGIN_STMNT do {
107#define FT_END_STMNT } while ( 0 )
109#define FT_MIN( a, b ) ( (a) < (b) ? (a) : (b) )
110#define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) )
111#define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) )
119#define FT_HYPOT( x, y ) \
122 x > y ? x + ( 3 * y >> 3 ) \
123 : y + ( 3 * x >> 3 ) )
130#ifdef FT_DEBUG_LEVEL_TRACE
139#define FT_CHAR_BIT CHAR_BIT
140#define FT_UINT_MAX UINT_MAX
141#define FT_INT_MAX INT_MAX
142#define FT_ULONG_MAX ULONG_MAX
144#define ADD_LONG( a, b ) \
145 (long)( (unsigned long)(a) + (unsigned long)(b) )
146#define SUB_LONG( a, b ) \
147 (long)( (unsigned long)(a) - (unsigned long)(b) )
148#define MUL_LONG( a, b ) \
149 (long)( (unsigned long)(a) * (unsigned long)(b) )
150#define NEG_LONG( a ) \
151 (long)( -(unsigned long)(a) )
154#define ft_memset memset
156#define ft_setjmp setjmp
157#define ft_longjmp longjmp
158#define ft_jmp_buf jmp_buf
163#define ErrRaster_Invalid_Mode -2
164#define ErrRaster_Invalid_Outline -1
165#define ErrRaster_Invalid_Argument -3
166#define ErrRaster_Memory_Overflow -4
168#define FT_BEGIN_HEADER
179#define FT_UNUSED( x ) (x) = (x)
184#ifdef FT_DEBUG_LEVEL_TRACE
215#define FT_TRACE5( varformat ) FT_Message varformat
218#define FT_TRACE7( varformat ) FT_Message varformat
221#define FT_ERROR( varformat ) FT_Message varformat
224#define FT_THROW( e ) \
225 ( FT_Throw( FT_ERR_CAT( ErrRaster_, e ), \
228 FT_ERR_CAT( ErrRaster_, e ) )
232#define FT_TRACE5( x ) do { } while ( 0 )
233#define FT_TRACE7( x ) do { } while ( 0 )
234#define FT_ERROR( x ) do { } while ( 0 )
235#define FT_THROW( e ) FT_ERR_CAT( ErrRaster_, e )
241#define FT_DEFINE_OUTLINE_FUNCS( class_, \
242 move_to_, line_to_, \
243 conic_to_, cubic_to_, \
245 static const FT_Outline_Funcs class_ = \
255#define FT_DEFINE_RASTER_FUNCS( class_, glyph_format_, \
256 raster_new_, raster_reset_, \
257 raster_set_mode_, raster_render_, \
259 const FT_Raster_Funcs class_ = \
275#include FT_INTERNAL_OBJECTS_H
276#include FT_INTERNAL_DEBUG_H
277#include FT_INTERNAL_CALC_H
282#define Smooth_Err_Invalid_Mode Smooth_Err_Cannot_Render_Glyph
283#define Smooth_Err_Memory_Overflow Smooth_Err_Out_Of_Memory
284#define ErrRaster_Memory_Overflow Smooth_Err_Out_Of_Memory
291#define FT_MEM_SET( d, s, c ) ft_memset( d, s, c )
295#define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count )
299#define FT_ZERO( p ) FT_MEM_ZERO( p, sizeof ( *(p) ) )
309#ifndef FT_STATIC_RASTER
311#define RAS_ARG gray_PWorker worker
312#define RAS_ARG_ gray_PWorker worker,
314#define RAS_VAR worker
315#define RAS_VAR_ worker,
335#define ONE_PIXEL ( 1 << PIXEL_BITS )
336#define TRUNC( x ) ( (TCoord)( (x) >> PIXEL_BITS ) )
337#define SUBPIXELS( x ) ( (TPos)(x) * ONE_PIXEL )
338#define FLOOR( x ) ( (x) & -ONE_PIXEL )
339#define CEILING( x ) ( ( (x) + ONE_PIXEL - 1 ) & -ONE_PIXEL )
340#define ROUND( x ) ( ( (x) + ONE_PIXEL / 2 ) & -ONE_PIXEL )
343#define UPSCALE( x ) ( (x) * ( ONE_PIXEL >> 6 ) )
344#define DOWNSCALE( x ) ( (x) >> ( PIXEL_BITS - 6 ) )
346#define UPSCALE( x ) ( (x) >> ( 6 - PIXEL_BITS ) )
347#define DOWNSCALE( x ) ( (x) * ( 64 >> PIXEL_BITS ) )
355#define FT_DIV_MOD( type, dividend, divisor, quotient, remainder ) \
357 (quotient) = (type)( (dividend) / (divisor) ); \
358 (remainder) = (type)( (dividend) % (divisor) ); \
359 if ( (remainder) < 0 ) \
362 (remainder) += (type)(divisor); \
373#define FT_DIV_MOD( type, dividend, divisor, quotient, remainder ) \
375 (quotient) = (type)( (dividend) / (divisor) ); \
376 (remainder) = (type)( (dividend) - (quotient) * (divisor) ); \
377 if ( (remainder) < 0 ) \
380 (remainder) += (type)(divisor); \
388#define FT_UDIVPREP( c, b ) \
389 long b ## _r = c ? (long)( FT_ULONG_MAX >> PIXEL_BITS ) / ( b ) \
391#define FT_UDIV( a, b ) \
392 ( ( (unsigned long)( a ) * (unsigned long)( b ## _r ) ) >> \
393 ( sizeof( long ) * FT_CHAR_BIT - PIXEL_BITS ) )
429#if FT_RENDER_POOL_SIZE > 2048
430#define FT_MAX_GRAY_POOL ( FT_RENDER_POOL_SIZE / sizeof ( TCell ) )
432#define FT_MAX_GRAY_POOL ( 2048 / sizeof ( TCell ) )
436#if defined( _MSC_VER )
440#pragma warning( push )
441#pragma warning( disable : 4324 )
471#if defined( _MSC_VER )
472#pragma warning( pop )
476#ifndef FT_STATIC_RASTER
490#ifdef FT_DEBUG_LEVEL_TRACE
500 for (
y =
ras.min_ey;
y <
ras.max_ey;
y++ )
507 for ( ; cell !=
NULL; cell = cell->
next )
508 printf(
" (%3d, c:%4d, a:%6d)",
528 pcell = &
ras.ycells[
ras.ey -
ras.min_ey];
532 if ( !cell || cell->
x >
x )
541 if (
ras.num_cells >=
ras.max_cells )
545 cell =
ras.cells +
ras.num_cells++;
580 if (
ex <
ras.min_ex )
584 if ( !
ras.invalid && (
ras.area ||
ras.cover ) )
592 ras.invalid = ( ey >=
ras.max_ey || ey <
ras.min_ey ||
684 }
while ( ex1 != ex2 );
714 if ( ( ey1 >=
ras.max_ey && ey2 >=
ras.max_ey ) ||
715 ( ey1 <
ras.min_ey && ey2 <
ras.min_ey ) )
824 }
while ( ey1 != ey2 );
847 TCoord ex1, ex2, ey1, ey2;
854 if ( ( ey1 >=
ras.max_ey && ey2 >=
ras.max_ey ) ||
855 ( ey1 <
ras.min_ey && ey2 <
ras.min_ey ) )
867 if ( ex1 == ex2 && ey1 == ey2 )
880 ras.cover += ( fy2 - fy1 );
881 ras.area += ( fy2 - fy1 ) * fx1 * 2;
885 }
while ( ey1 != ey2 );
890 ras.cover += ( fy2 - fy1 );
891 ras.area += ( fy2 - fy1 ) * fx1 * 2;
895 }
while ( ey1 != ey2 );
915 ras.cover += ( fy2 - fy1 );
916 ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
927 ras.cover += ( fy2 - fy1 );
928 ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
939 ras.cover += ( fy2 - fy1 );
940 ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
951 ras.cover += ( fy2 - fy1 );
952 ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
959 }
while ( ex1 != ex2 || ey1 != ey2 );
965 ras.cover += ( fy2 - fy1 );
966 ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
985 base[2].x = (
a +
b ) / 2;
991 base[2].y = (
a +
b ) / 2;
1013 if ( (
TRUNC( arc[0].
y ) >=
ras.max_ey &&
1025 dx =
FT_ABS( arc[2].
x + arc[0].
x - 2 * arc[1].
x );
1026 dy =
FT_ABS( arc[2].
y + arc[0].
y - 2 * arc[1].
y );
1046 while ( ( draw &
split ) == 0 )
1072 base[2].x =
a = (
a +
c ) / 2;
1073 base[4].x =
b = (
b +
c ) / 2;
1074 base[3].x = (
a +
b ) / 2;
1082 base[2].y =
a = (
a +
c ) / 2;
1083 base[4].y =
b = (
b +
c ) / 2;
1084 base[3].y = (
a +
b ) / 2;
1096 TPos dx1, dy1, dx2, dy2;
1110 if ( (
TRUNC( arc[0].
y ) >=
ras.max_ey &&
1132 dx = dx_ = arc[3].
x - arc[0].
x;
1133 dy = dy_ = arc[3].
y - arc[0].
y;
1145 dx1 = arc[1].
x - arc[0].
x;
1146 dy1 = arc[1].
y - arc[0].
y;
1153 dx2 = arc[2].
x - arc[0].
x;
1154 dy2 = arc[2].
y - arc[0].
y;
1163 if ( dx1 * ( dx1 -
dx ) + dy1 * ( dy1 -
dy ) > 0 ||
1164 dx2 * ( dx2 -
dx ) + dy2 * ( dy2 -
dy ) > 0 )
1169 if ( arc == bez_stack )
1240 coverage = -coverage - 1;
1247 if ( coverage >= 256 )
1248 coverage = 511 - coverage;
1253 if ( coverage >= 256 )
1257 if (
ras.render_span )
1264 span.coverage = (
unsigned char)coverage;
1266 ras.render_span(
y, 1, &
span,
ras.render_span_data );
1270 unsigned char*
q =
ras.target.origin -
ras.target.pitch *
y +
x;
1271 unsigned char c = (
unsigned char)coverage;
1301 for (
y =
ras.min_ey;
y <
ras.max_ey;
y++ )
1309 for ( ; cell !=
NULL; cell = cell->
next )
1311 if ( cover != 0 && cell->
x >
x )
1317 if (
area != 0 && cell->
x >=
ras.min_ex )
1374#define SCALED( x ) ( ( (x) << shift ) - delta )
1395 return FT_THROW( Invalid_Outline );
1397 if ( !func_interface )
1398 return FT_THROW( Invalid_Argument );
1401 delta = func_interface->
delta;
1409 FT_TRACE5((
"FT_Outline_Decompose: Outline %d\n",
n ));
1413 goto Invalid_Outline;
1424 v_control = v_start;
1432 goto Invalid_Outline;
1449 v_start.
x = ( v_start.
x + v_last.
x ) / 2;
1450 v_start.
y = ( v_start.
y + v_last.
y ) / 2;
1459 v_start.
x / 64.0, v_start.
y / 64.0 ));
1509 " with control (%.2f, %.2f)\n",
1511 v_control.
x / 64.0, v_control.
y / 64.0 ));
1519 goto Invalid_Outline;
1521 v_middle.
x = ( v_control.
x +
vec.
x ) / 2;
1522 v_middle.
y = ( v_control.
y +
vec.
y ) / 2;
1525 " with control (%.2f, %.2f)\n",
1526 v_middle.
x / 64.0, v_middle.
y / 64.0,
1527 v_control.
x / 64.0, v_control.
y / 64.0 ));
1537 " with control (%.2f, %.2f)\n",
1538 v_start.
x / 64.0, v_start.
y / 64.0,
1539 v_control.
x / 64.0, v_control.
y / 64.0 ));
1550 goto Invalid_Outline;
1570 " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
1572 vec1.
x / 64.0, vec1.
y / 64.0,
1573 vec2.
x / 64.0, vec2.
y / 64.0 ));
1581 " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
1582 v_start.
x / 64.0, v_start.
y / 64.0,
1583 vec1.
x / 64.0, vec1.
y / 64.0,
1584 vec2.
x / 64.0, vec2.
y / 64.0 ));
1593 v_start.
x / 64.0, v_start.
y / 64.0 ));
1603 FT_TRACE5((
"FT_Outline_Decompose: Done\n",
n ));
1611 return FT_THROW( Invalid_Outline );
1631 gray_convert_glyph_inner(
RAS_ARG,
1634 volatile int error = 0;
1648 FT_TRACE7((
"band [%d..%d]: %d cell%s\n",
1652 ras.num_cells == 1 ?
"" :
"s" ));
1659 ras.min_ey,
ras.max_ey ));
1704 for (
y = yMin;
y < yMax; )
1711 band[1] =
ras.min_ey;
1712 band[0] =
ras.max_ey;
1724 ras.min_ey = band[1];
1725 ras.max_ey = band[0];
1752 FT_TRACE7((
"gray_convert_glyph: rotten glyph\n" ));
1762 }
while ( band >= bands );
1781#ifndef FT_STATIC_RASTER
1791 return FT_THROW( Invalid_Argument );
1798 return FT_THROW( Invalid_Outline );
1805 return FT_THROW( Invalid_Outline );
1809 return FT_THROW( Invalid_Outline );
1811#if !defined(FT_STATIC_RASTER) && defined(__REACTOS__)
1812 worker =
malloc(
sizeof(*worker));
1821 if ( !
params->gray_spans )
1822#if !defined(FT_STATIC_RASTER) && defined(__REACTOS__)
1838#if !defined(FT_STATIC_RASTER) && defined(__REACTOS__)
1841 return FT_THROW( Invalid_Argument );
1844 return FT_THROW( Invalid_Argument );
1848 if ( !target_map->width || !target_map->rows )
1849#if !defined(FT_STATIC_RASTER) && defined(__REACTOS__)
1858 if ( !target_map->buffer )
1859#if !defined(FT_STATIC_RASTER) && defined(__REACTOS__)
1862 return FT_THROW( Invalid_Argument );
1865 return FT_THROW( Invalid_Argument );
1868 if ( target_map->pitch < 0 )
1869 ras.target.origin = target_map->buffer;
1871 ras.target.origin = target_map->buffer
1872 + ( target_map->rows - 1 ) * (
unsigned int)target_map->pitch;
1874 ras.target.pitch = target_map->pitch;
1889 clip.xMax = (
FT_Pos)target_map->width;
1890 clip.yMax = (
FT_Pos)target_map->rows;
1894 ras.min_ex = clip.xMin;
1895 ras.min_ey = clip.yMin;
1896 ras.max_ex = clip.xMax;
1897 ras.max_ey = clip.yMax;
1899 if (
ras.max_ex <=
ras.min_ex ||
ras.max_ey <=
ras.min_ey )
1900#if !defined(FT_STATIC_RASTER) && defined(__REACTOS__)
1909#if !defined(FT_STATIC_RASTER) && defined(__REACTOS__)
1984 unsigned char* pool_base,
1985 unsigned long pool_size )
std::map< E_MODULE, HMODULE > mod
void user(int argc, const char *argv[])
static LPSTR * split(LPSTR s, LPINT args)
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
__kernel_ptrdiff_t ptrdiff_t
#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_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_RASTER_FLAG_CLIP
#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)
smooth FT_Module_Constructor FT_Module_Destructor FT_Module_Requester FT_GLYPH_FORMAT_OUTLINE
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
_Check_return_opt_ _CRTIMP int __cdecl vfprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
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
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
void int int ULONGLONG int va_list * ap
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList