Sat May 14 15:29:58 MSD 2005 Kirill Smelkov * (ftraster.c) tweaks to compile in standalone mode diff -rN -N -u old-ftraster-standalone/ftraster.c new-ftraster-standalone/ftraster.c --- old-ftraster-standalone/ftraster.c 2005-05-14 15:32:02.000000000 +0400 +++ new-ftraster-standalone/ftraster.c 2005-05-14 15:23:26.000000000 +0400 @@ -21,11 +21,19 @@ /* */ /*************************************************************************/ +#ifdef _STANDALONE_ + +#include "priv/ftmisc.h" +#include "priv/ftimage.h" + +#else /* _STANDALONE_ */ #include #include "ftraster.h" #include FT_INTERNAL_CALC_H /* for FT_MulDiv only */ +#endif /* _STANDALONE_ */ + /*************************************************************************/ /* */ @@ -154,6 +162,8 @@ #ifndef FT_TRACE #define FT_TRACE( x ) do ; while ( 0 ) /* nothing */ +#define FT_TRACE6( x ) do ; while ( 0 ) /* nothing */ +#define FT_TRACE1( x ) do ; while ( 0 ) /* nothing */ #endif #define Raster_Err_None 0 @@ -163,6 +173,7 @@ #define Raster_Err_Invalid -4 #define Raster_Err_Unsupported -5 +#define ft_memset memset #else /* _STANDALONE_ */ @@ -187,6 +198,9 @@ #define FT_MEM_SET( d, s, c ) ft_memset( d, s, c ) #endif +#ifndef FT_MEM_ZERO +#define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count ) +#endif /* FMulDiv means `Fast MulDiv'; it is used in case where `b' is */ /* typically a small value and the result of a*b is known to fit into */ @@ -3020,7 +3034,7 @@ return error; } - return Raster_Err_Ok; + return Raster_Err_None; } @@ -3096,7 +3110,7 @@ return error; } - return Raster_Err_Ok; + return Raster_Err_None; } #else /* !FT_RASTER_OPTION_ANTI_ALIASING */ @@ -3106,7 +3120,7 @@ { FT_UNUSED_RASTER; - return Raster_Err_Cannot_Render_Glyph; + return Raster_Err_Unsupported; } #endif /* !FT_RASTER_OPTION_ANTI_ALIASING */ @@ -3155,10 +3169,10 @@ ft_black_new( void* memory, FT_Raster *araster ) { - static FT_RasterRec_ the_raster; + static TRaster_Instance the_raster; - *araster = &the_raster; + *araster = (FT_Raster)&the_raster; FT_MEM_ZERO( &the_raster, sizeof ( the_raster ) ); ft_black_init( &the_raster ); @@ -3170,7 +3184,7 @@ ft_black_done( FT_Raster raster ) { /* nothing */ - raster->init = 0; + FT_UNUSED( raster ); } diff -rN -N -u old-ftraster-standalone/priv/ftmisc.h new-ftraster-standalone/priv/ftmisc.h --- old-ftraster-standalone/priv/ftmisc.h 1970-01-01 03:00:00.000000000 +0300 +++ new-ftraster-standalone/priv/ftmisc.h 2005-05-14 15:26:30.000000000 +0400 @@ -0,0 +1,47 @@ +/* Tiny addon to make standalone ftraster.c compile */ +/* XXX: not portable */ + +#ifndef _PRIV_FT_MISC_H +#define _PRIV_FT_MISC_H + +#include /* memset */ + +#define FT_BEGIN_HEADER +#define FT_END_HEADER + +#define FT_LOCAL_DEF( x ) static x + +/* include/freetype2/fttypes.h */ + typedef unsigned char FT_Byte; + typedef signed int FT_Int; + typedef unsigned int FT_UInt; + typedef signed long FT_Long; + typedef unsigned long FT_ULong; + typedef signed long FT_F26Dot6; + typedef int FT_Error; + +/* src/ftcalc.c */ +#include + typedef int64_t FT_Int64; + + static FT_Long + FT_MulDiv( FT_Long a, + FT_Long b, + FT_Long c ) + { + FT_Int s; + FT_Long d; + + + s = 1; + if ( a < 0 ) { a = -a; s = -1; } + if ( b < 0 ) { b = -b; s = -s; } + if ( c < 0 ) { c = -c; s = -s; } + + d = (FT_Long)( c > 0 ? ( (FT_Int64)a * b + ( c >> 1 ) ) / c + : 0x7FFFFFFFL ); + + return ( s > 0 ) ? d : -d; + } + +#endif diff -rN -N -u old-ftraster-standalone/README new-ftraster-standalone/README --- old-ftraster-standalone/README 2005-05-14 15:32:02.000000000 +0400 +++ new-ftraster-standalone/README 2005-05-14 15:29:06.000000000 +0400 @@ -4,3 +4,4 @@ ftraster.h 1.5 2001/06/28 17:48:56 ftraster.c 1.34 2005/05/11 20:04:35 ftimage.h 1.43 2005/05/11 20:04:34 + constify.patch +ftmisc.h hand made