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
177 #define FT_END_HEADER
187 #define FT_UNUSED( x ) (x) = (x)
192 #ifdef FT_DEBUG_LEVEL_TRACE
195 FT_Message(
const char* fmt,
202 vfprintf( stderr, fmt, ap );
223 #define FT_TRACE5( varformat ) FT_Message varformat
226 #define FT_TRACE7( varformat ) FT_Message varformat
229 #define FT_ERROR( varformat ) FT_Message varformat
232 #define FT_THROW( e ) \
233 ( FT_Throw( FT_ERR_CAT( ErrRaster_, e ), \
236 FT_ERR_CAT( ErrRaster_, e ) )
240 #define FT_TRACE5( x ) do { } while ( 0 )
241 #define FT_TRACE7( x ) do { } while ( 0 )
242 #define FT_ERROR( x ) do { } while ( 0 )
243 #define FT_THROW( e ) FT_ERR_CAT( ErrRaster_, e )
249 #define FT_DEFINE_OUTLINE_FUNCS( class_, \
250 move_to_, line_to_, \
251 conic_to_, cubic_to_, \
253 static const FT_Outline_Funcs class_ = \
263 #define FT_DEFINE_RASTER_FUNCS( class_, glyph_format_, \
264 raster_new_, raster_reset_, \
265 raster_set_mode_, raster_render_, \
267 const FT_Raster_Funcs class_ = \
289 #define Smooth_Err_Invalid_Mode Smooth_Err_Cannot_Render_Glyph
290 #define Smooth_Err_Memory_Overflow Smooth_Err_Out_Of_Memory
291 #define ErrRaster_Memory_Overflow Smooth_Err_Out_Of_Memory
298 #define FT_MEM_SET( d, s, c ) ft_memset( d, s, c )
302 #define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count )
306 #define FT_ZERO( p ) FT_MEM_ZERO( p, sizeof ( *(p) ) )
316 #ifndef FT_STATIC_RASTER
318 #define RAS_ARG gray_PWorker worker
319 #define RAS_ARG_ gray_PWorker worker,
321 #define RAS_VAR worker
322 #define RAS_VAR_ worker,
337 #define ONE_PIXEL ( 1 << PIXEL_BITS )
338 #define TRUNC( x ) (TCoord)( (x) >> PIXEL_BITS )
339 #define FRACT( x ) (TCoord)( (x) & ( ONE_PIXEL - 1 ) )
342 #define UPSCALE( x ) ( (x) * ( ONE_PIXEL >> 6 ) )
343 #define DOWNSCALE( x ) ( (x) >> ( PIXEL_BITS - 6 ) )
345 #define UPSCALE( x ) ( (x) >> ( 6 - PIXEL_BITS ) )
346 #define DOWNSCALE( x ) ( (x) * ( 64 >> PIXEL_BITS ) )
354 #define FT_DIV_MOD( type, dividend, divisor, quotient, remainder ) \
356 (quotient) = (type)( (dividend) / (divisor) ); \
357 (remainder) = (type)( (dividend) % (divisor) ); \
358 if ( (remainder) < 0 ) \
361 (remainder) += (type)(divisor); \
372 #define FT_DIV_MOD( type, dividend, divisor, quotient, remainder ) \
374 (quotient) = (type)( (dividend) / (divisor) ); \
375 (remainder) = (type)( (dividend) - (quotient) * (divisor) ); \
376 if ( (remainder) < 0 ) \
379 (remainder) += (type)(divisor); \
387 #define FT_UDIVPREP( c, b ) \
388 long b ## _r = c ? (long)( FT_ULONG_MAX >> PIXEL_BITS ) / ( b ) \
390 #define FT_UDIV( a, b ) \
391 (TCoord)( ( (unsigned long)( a ) * (unsigned long)( b ## _r ) ) >> \
392 ( sizeof( long ) * FT_CHAR_BIT - PIXEL_BITS ) )
428 #if FT_RENDER_POOL_SIZE > 2048
429 #define FT_MAX_GRAY_POOL ( FT_RENDER_POOL_SIZE / sizeof ( TCell ) )
431 #define FT_MAX_GRAY_POOL ( 2048 / sizeof ( TCell ) )
435 #define FT_MAX_GRAY_SPANS 10
438 #if defined( _MSC_VER )
442 #pragma warning( push )
443 #pragma warning( disable : 4324 )
475 #if defined( _MSC_VER )
476 #pragma warning( pop )
480 #ifndef FT_STATIC_RASTER
481 #define ras (*worker)
494 #ifdef FT_DEBUG_LEVEL_TRACE
504 for (
y =
ras.min_ey;
y <
ras.max_ey;
y++ )
511 for ( ; cell !=
NULL; cell = cell->
next )
512 printf(
" (%3d, c:%4d, a:%6d)",
532 pcell = &
ras.ycells[
ras.ey -
ras.min_ey];
533 while ( ( cell = *pcell ) )
544 if (
ras.num_cells >=
ras.max_cells )
548 cell =
ras.cells +
ras.num_cells++;
584 if ( !
ras.invalid && (
ras.area ||
ras.cover ) )
592 ras.invalid = ( ey >=
ras.max_ey || ey <
ras.min_ey ||
687 }
while ( ex1 != ex2 );
695 ras.area += (
TArea)( ( fx1 + fx2 ) * dy );
717 if ( ( ey1 >=
ras.max_ey && ey2 >=
ras.max_ey ) ||
718 ( ey1 <
ras.min_ey && ey2 <
ras.min_ey ) )
727 gray_render_scanline(
RAS_VAR_ ey1,
ras.x, fy1, to_x, fy2 );
761 area = (
TArea)two_fx * delta;
829 }
while ( ey1 != ey2 );
852 TCoord fx1, fy1, fx2, fy2;
853 TCoord ex1, ey1, ex2, ey2;
860 if ( ( ey1 >=
ras.max_ey && ey2 >=
ras.max_ey ) ||
861 ( ey1 <
ras.min_ey && ey2 <
ras.min_ey ) )
873 if ( ex1 == ex2 && ey1 == ey2 )
886 ras.cover += ( fy2 - fy1 );
887 ras.area += ( fy2 - fy1 ) * fx1 * 2;
891 }
while ( ey1 != ey2 );
896 ras.cover += ( fy2 - fy1 );
897 ras.area += ( fy2 - fy1 ) * fx1 * 2;
901 }
while ( ey1 != ey2 );
921 ras.cover += ( fy2 - fy1 );
922 ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
933 ras.cover += ( fy2 - fy1 );
934 ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
945 ras.cover += ( fy2 - fy1 );
946 ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
957 ras.cover += ( fy2 - fy1 );
958 ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
965 }
while ( ex1 != ex2 || ey1 != ey2 );
971 ras.cover += ( fy2 - fy1 );
972 ras.area += ( fy2 - fy1 ) * ( fx1 + fx2 );
1021 if ( (
TRUNC( arc[0].
y ) >=
ras.max_ey &&
1033 dx =
FT_ABS( arc[2].
x + arc[0].
x - 2 * arc[1].
x );
1034 dy =
FT_ABS( arc[2].
y + arc[0].
y - 2 * arc[1].
y );
1054 while ( ( split >>= 1 ) )
1056 gray_split_conic( arc );
1060 gray_render_line(
RAS_VAR_ arc[0].
x, arc[0].
y );
1118 if ( (
TRUNC( arc[0].
y ) >=
ras.max_ey &&
1143 gray_render_line(
RAS_VAR_ arc[0].
x, arc[0].
y );
1145 if ( arc == bez_stack )
1152 gray_split_cubic( arc );
1187 gray_conic_to(
const FT_Vector* control,
1191 gray_render_conic(
RAS_VAR_ control, to );
1197 gray_cubic_to(
const FT_Vector* control1,
1202 gray_render_cubic(
RAS_VAR_ control1, control2, to );
1221 if ( coverage >= 256 )
1222 coverage = 511 - coverage;
1227 coverage = ~coverage;
1229 if ( coverage >= 256 )
1233 if (
ras.num_spans >= 0 )
1239 span->len = (
unsigned short)acount;
1240 span->coverage = (
unsigned char)coverage;
1245 ras.render_span(
y,
ras.num_spans,
ras.spans,
ras.render_span_data );
1251 unsigned char*
q =
ras.target.origin -
ras.target.pitch *
y +
x;
1252 unsigned char c = (
unsigned char)coverage;
1297 for (
y =
ras.min_ey;
y <
ras.max_ey;
y++ )
1305 for ( ; cell !=
NULL; cell = cell->
next )
1307 if ( cover != 0 && cell->
x >
x )
1311 area = cover - cell->
area;
1313 if ( area != 0 && cell->
x >=
ras.min_ex )
1322 if (
ras.num_spans > 0 )
1325 ras.render_span(
y,
ras.num_spans,
ras.spans,
ras.render_span_data );
1377 #define SCALED( x ) ( (x) * ( 1L << shift ) - delta )
1398 return FT_THROW( Invalid_Outline );
1400 if ( !func_interface )
1401 return FT_THROW( Invalid_Argument );
1404 delta = func_interface->
delta;
1412 FT_TRACE5((
"FT_Outline_Decompose: Outline %d\n",
n ));
1416 goto Invalid_Outline;
1423 v_last = outline->
points[last];
1427 v_control = v_start;
1435 goto Invalid_Outline;
1452 v_start.
x = ( v_start.
x + v_last.
x ) / 2;
1453 v_start.
y = ( v_start.
y + v_last.
y ) / 2;
1462 v_start.
x / 64.0, v_start.
y / 64.0 ));
1467 while ( point <
limit )
1496 if ( point <
limit )
1512 " with control (%.2f, %.2f)\n",
1514 v_control.
x / 64.0, v_control.
y / 64.0 ));
1522 goto Invalid_Outline;
1524 v_middle.
x = ( v_control.
x +
vec.
x ) / 2;
1525 v_middle.
y = ( v_control.
y +
vec.
y ) / 2;
1528 " with control (%.2f, %.2f)\n",
1529 v_middle.
x / 64.0, v_middle.
y / 64.0,
1530 v_control.
x / 64.0, v_control.
y / 64.0 ));
1531 error = func_interface->
conic_to( &v_control, &v_middle, user );
1540 " with control (%.2f, %.2f)\n",
1541 v_start.
x / 64.0, v_start.
y / 64.0,
1542 v_control.
x / 64.0, v_control.
y / 64.0 ));
1543 error = func_interface->
conic_to( &v_control, &v_start, user );
1551 if ( point + 1 >
limit ||
1553 goto Invalid_Outline;
1564 if ( point <=
limit )
1573 " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
1575 vec1.
x / 64.0, vec1.
y / 64.0,
1576 vec2.
x / 64.0, vec2.
y / 64.0 ));
1584 " with controls (%.2f, %.2f) and (%.2f, %.2f)\n",
1585 v_start.
x / 64.0, v_start.
y / 64.0,
1586 vec1.
x / 64.0, vec1.
y / 64.0,
1587 vec2.
x / 64.0, vec2.
y / 64.0 ));
1588 error = func_interface->
cubic_to( &vec1, &vec2, &v_start, user );
1596 v_start.
x / 64.0, v_start.
y / 64.0 ));
1606 FT_TRACE5((
"FT_Outline_Decompose: Done\n",
n ));
1614 return FT_THROW( Invalid_Outline );
1634 gray_convert_glyph_inner(
RAS_ARG,
1651 FT_TRACE7((
"band [%d..%d]: %ld cell%s\n",
1655 ras.num_cells == 1 ?
"" :
"s" ));
1662 ras.min_ey,
ras.max_ey ));
1676 size_t height = (size_t)( yMax - yMin );
1700 for (
y = yMin;
y < yMax; )
1707 band[1] =
ras.min_ey;
1708 band[0] =
ras.max_ey;
1720 ras.min_ey = band[1];
1721 ras.max_ey = band[0];
1741 FT_TRACE7((
"gray_convert_glyph: rotten glyph\n" ));
1748 }
while ( band >= bands );
1762 #ifndef FT_STATIC_RASTER
1768 return FT_THROW( Invalid_Argument );
1775 return FT_THROW( Invalid_Outline );
1782 return FT_THROW( Invalid_Outline );
1786 return FT_THROW( Invalid_Outline );
1788 ras.outline = *outline;
1792 if ( !
params->gray_spans )
1808 return FT_THROW( Invalid_Argument );
1811 if ( !target_map->width || !target_map->rows )
1814 if ( !target_map->buffer )
1815 return FT_THROW( Invalid_Argument );
1817 if ( target_map->pitch < 0 )
1818 ras.target.origin = target_map->buffer;
1820 ras.target.origin = target_map->buffer
1821 + ( target_map->rows - 1 ) * (
unsigned int)target_map->pitch;
1823 ras.target.pitch = target_map->pitch;
1836 if (
ras.max_ex <=
ras.min_ex ||
ras.max_ey <=
ras.min_ey )
1839 return gray_convert_glyph(
RAS_VAR );
1849 gray_raster_new(
void*
memory,
1906 unsigned char* pool_base,
1907 unsigned long pool_size )
1932 FT_GLYPH_FORMAT_OUTLINE,
#define FT_TRACE5(varformat)
if(ft_setjmp(ras.jump_buffer)==0)
#define ErrRaster_Memory_Overflow
#define FT_UDIVPREP(c, b)
FT_TRACE7(("band [%d..%d]: to be bisected\n", ras.min_ey, ras.max_ey))
struct gray_TRaster_ gray_TRaster
#define FT_MEM_SET(d, s, c)
struct gray_TRaster_ * gray_PRaster
struct gray_TWorker_ gray_TWorker
#define FT_MEM_ZERO(dest, count)
struct gray_TWorker_ * gray_PWorker
#define FT_DIV_MOD(type, dividend, divisor, quotient, remainder)
FT_DEFINE_OUTLINE_FUNCS(func_interface,(FT_Outline_MoveTo_Func) gray_move_to,(FT_Outline_LineTo_Func) gray_line_to,(FT_Outline_ConicTo_Func) gray_conic_to,(FT_Outline_CubicTo_Func) gray_cubic_to, 0, 0) static int gray_convert_glyph_inner(RAS_ARG
#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_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
static void const void const char bool unsigned int int const char va_start(ap, message)
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro vuzp8 reg2 vuzp d d ®2 endm macro vzip8 reg2 vzip d d ®2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld endif[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld SRC pixld MASK if DST_R else pixld DST_R endif if
GLboolean GLboolean GLboolean b
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLuint GLfloat GLfloat GLfloat x1
GLsizei GLenum GLsizei GLsizei GLuint memory
GLfixed GLfixed GLfixed y2
GLdouble GLdouble GLdouble GLdouble q
GLenum GLenum GLsizei void GLsizei void void * span
myFilter draw(painter, QPoint(0, 0), originalPixmap)
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]
virtual HRESULT STDMETHODCALLTYPE Close(void)=0
XmlOutput::xml_output tag(const QString &name)