From 4d1f7af17b4b0966d5ed7fab215fc855fe459345 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 23 Feb 2015 07:04:36 +0100 Subject: [PATCH] [smooth, raster] Re-enable standalone compilation. * src/raster/ftraster.c (FT_RENDER_POOL_SIZE, FT_MAX) [_STANDALONE_]: Define macros. * src/smooth/ftgrays.c (FT_RENDER_POOL_SIZE, FT_MAX, FT_ABS, FT_HYPOT) [_STANDALONE_]: Define macros. --- ChangeLog | 10 ++++++++++ src/raster/ftraster.c | 14 ++++++++++--- src/smooth/ftgrays.c | 46 ++++++++++++++++++++++++++++++++----------- 3 files changed, 56 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 17e4379f5..944459515 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2015-02-23 Werner Lemberg + + [smooth, raster] Re-enable standalone compilation. + + * src/raster/ftraster.c (FT_RENDER_POOL_SIZE, FT_MAX) + [_STANDALONE_]: Define macros. + + * src/smooth/ftgrays.c (FT_RENDER_POOL_SIZE, FT_MAX, FT_ABS, + FT_HYPOT) [_STANDALONE_]: Define macros. + 2015-02-22 Werner Lemberg [smooth] Signedness fixes. diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c index 70fe4e735..317cd7db1 100644 --- a/src/raster/ftraster.c +++ b/src/raster/ftraster.c @@ -49,6 +49,10 @@ #ifdef _STANDALONE_ + /* The size in bytes of the render pool used by the scan-line converter */ + /* to do all of its work. */ +#define FT_RENDER_POOL_SIZE 16384L + #define FT_CONFIG_STANDARD_LIBRARY_H #include /* for memset */ @@ -175,6 +179,8 @@ #define FT_ERR_XCAT( x, y ) x ## y #define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y ) +#define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) ) + /* This macro is used to indicate that a function parameter is unused. */ /* Its purpose is simply to reduce compiler warnings. Note also that */ /* simply defining it as `(void)x' doesn't avoid warnings with certain */ @@ -3131,14 +3137,16 @@ } - FT_DEFINE_RASTER_FUNCS( ft_standard_raster, + FT_DEFINE_RASTER_FUNCS( + ft_standard_raster, + FT_GLYPH_FORMAT_OUTLINE, + (FT_Raster_New_Func) ft_black_new, (FT_Raster_Reset_Func) ft_black_reset, (FT_Raster_Set_Mode_Func)ft_black_set_mode, (FT_Raster_Render_Func) ft_black_render, - (FT_Raster_Done_Func) ft_black_done - ) + (FT_Raster_Done_Func) ft_black_done ) /* END */ diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index 2ac451a36..77b58f25f 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -94,6 +94,11 @@ #ifdef _STANDALONE_ + /* The size in bytes of the render pool used by the scan-line converter */ + /* to do all of its work. */ +#define FT_RENDER_POOL_SIZE 16384L + + /* Auxiliary macros for token concatenation. */ #define FT_ERR_XCAT( x, y ) x ## y #define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y ) @@ -101,6 +106,21 @@ #define FT_BEGIN_STMNT do { #define FT_END_STMNT } while ( 0 ) +#define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) ) +#define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) ) + + + /* + * Approximate sqrt(x*x+y*y) using the `alpha max plus beta min' + * algorithm. We use alpha = 1, beta = 3/8, giving us results with a + * largest error less than 7% compared to the exact value. + */ +#define FT_HYPOT( x, y ) \ + ( x = FT_ABS( x ), \ + y = FT_ABS( y ), \ + x > y ? x + ( 3 * y >> 3 ) \ + : y + ( 3 * x >> 3 ) ) + /* define this to dump debugging information */ /* #define FT_DEBUG_LEVEL_TRACE */ @@ -1740,14 +1760,17 @@ typedef ptrdiff_t FT_PtrDist; } gray_TBand; - 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 - ) + + 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 ) @@ -2090,15 +2113,16 @@ typedef ptrdiff_t FT_PtrDist; } - FT_DEFINE_RASTER_FUNCS(ft_grays_raster, + FT_DEFINE_RASTER_FUNCS( + ft_grays_raster, + FT_GLYPH_FORMAT_OUTLINE, (FT_Raster_New_Func) gray_raster_new, (FT_Raster_Reset_Func) gray_raster_reset, (FT_Raster_Set_Mode_Func)gray_raster_set_mode, (FT_Raster_Render_Func) gray_raster_render, - (FT_Raster_Done_Func) gray_raster_done - ) + (FT_Raster_Done_Func) gray_raster_done ) /* END */