From 41bd254198b8b879a562a85f7dc868c3c0f7fbc1 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 12 Mar 2012 10:33:22 +0100 Subject: Updated to freetype-2.4.9 --- freetype/src/raster/ftraster.c | 77 ++++++++++++++++++++++++------------------ freetype/src/raster/rasterrs.h | 3 +- freetype/src/raster/rastpic.c | 39 ++++++++++++--------- freetype/src/raster/rastpic.h | 15 +++++++- 4 files changed, 83 insertions(+), 51 deletions(-) (limited to 'freetype/src/raster') diff --git a/freetype/src/raster/ftraster.c b/freetype/src/raster/ftraster.c index 55e2d0d75..f85845ec6 100644 --- a/freetype/src/raster/ftraster.c +++ b/freetype/src/raster/ftraster.c @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2005, 2007, 2008, 2009, 2010, 2011 by */ +/* Copyright 1996-2003, 2005, 2007-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -369,18 +369,23 @@ /* Simple record used to implement a stack of bands, required */ /* by the sub-banding mechanism */ - typedef struct TBand_ + typedef struct black_TBand_ { Short y_min; /* band's minimum */ Short y_max; /* band's maximum */ - } TBand; + } black_TBand; #define AlignProfileSize \ ( ( sizeof ( TProfile ) + sizeof ( Alignment ) - 1 ) / sizeof ( long ) ) +#undef RAS_ARG +#undef RAS_ARGS +#undef RAS_VAR +#undef RAS_VARS + #ifdef FT_STATIC_RASTER @@ -396,8 +401,8 @@ #else /* !FT_STATIC_RASTER */ -#define RAS_ARGS PWorker worker, -#define RAS_ARG PWorker worker +#define RAS_ARGS black_PWorker worker, +#define RAS_ARG black_PWorker worker #define RAS_VARS worker, #define RAS_VAR worker @@ -408,7 +413,7 @@ #endif /* !FT_STATIC_RASTER */ - typedef struct TWorker_ TWorker, *PWorker; + typedef struct black_TWorker_ black_TWorker, *black_PWorker; /* prototypes used for sweep function dispatch */ @@ -428,6 +433,10 @@ /* NOTE: These operations are only valid on 2's complement processors */ +#undef FLOOR +#undef CEILING +#undef TRUNC +#undef SCALED #define FLOOR( x ) ( (x) & -ras.precision ) #define CEILING( x ) ( ( (x) + ras.precision - 1 ) & -ras.precision ) @@ -442,7 +451,7 @@ /* Thus, their offset can be coded with less opcodes, resulting in a */ /* smaller executable. */ - struct TWorker_ + struct black_TWorker_ { Int precision_bits; /* precision related variables */ Int precision; @@ -515,8 +524,8 @@ TPoint arcs[3 * MaxBezier + 1]; /* The Bezier stack */ - TBand band_stack[16]; /* band stack used for sub-banding */ - Int band_top; /* band stack top */ + black_TBand band_stack[16]; /* band stack used for sub-banding */ + Int band_top; /* band stack top */ #ifdef FT_RASTER_OPTION_ANTI_ALIASING @@ -540,20 +549,20 @@ }; - typedef struct TRaster_ + typedef struct black_TRaster_ { - char* buffer; - long buffer_size; - void* memory; - PWorker worker; - Byte grays[5]; - Short gray_width; + char* buffer; + long buffer_size; + void* memory; + black_PWorker worker; + Byte grays[5]; + Short gray_width; - } TRaster, *PRaster; + } black_TRaster, *black_PRaster; #ifdef FT_STATIC_RASTER - static TWorker cur_ras; + static black_TWorker cur_ras; #define ras cur_ras #else /* !FT_STATIC_RASTER */ @@ -3391,7 +3400,7 @@ static void - ft_black_init( PRaster raster ) + ft_black_init( black_PRaster raster ) { #ifdef FT_RASTER_OPTION_ANTI_ALIASING FT_UInt n; @@ -3419,7 +3428,7 @@ ft_black_new( void* memory, FT_Raster *araster ) { - static TRaster the_raster; + static black_TRaster the_raster; FT_UNUSED( memory ); @@ -3443,11 +3452,11 @@ static int - ft_black_new( FT_Memory memory, - PRaster *araster ) + ft_black_new( FT_Memory memory, + black_PRaster *araster ) { - FT_Error error; - PRaster raster = NULL; + FT_Error error; + black_PRaster raster = NULL; *araster = 0; @@ -3464,9 +3473,11 @@ static void - ft_black_done( PRaster raster ) + ft_black_done( black_PRaster raster ) { FT_Memory memory = (FT_Memory)raster->memory; + + FT_FREE( raster ); } @@ -3475,15 +3486,15 @@ static void - ft_black_reset( PRaster raster, - char* pool_base, - long pool_size ) + ft_black_reset( black_PRaster raster, + char* pool_base, + long pool_size ) { if ( raster ) { - if ( pool_base && pool_size >= (long)sizeof(TWorker) + 2048 ) + if ( pool_base && pool_size >= (long)sizeof ( black_TWorker ) + 2048 ) { - PWorker worker = (PWorker)pool_base; + black_PWorker worker = (black_PWorker)pool_base; raster->buffer = pool_base + ( ( sizeof ( *worker ) + 7 ) & ~7 ); @@ -3501,7 +3512,7 @@ static void - ft_black_set_mode( PRaster raster, + ft_black_set_mode( black_PRaster raster, unsigned long mode, const char* palette ) { @@ -3528,12 +3539,12 @@ static int - ft_black_render( PRaster raster, + ft_black_render( black_PRaster raster, const FT_Raster_Params* params ) { const FT_Outline* outline = (const FT_Outline*)params->source; const FT_Bitmap* target_map = params->target; - PWorker worker; + black_PWorker worker; if ( !raster || !raster->buffer || !raster->buffer_size ) diff --git a/freetype/src/raster/rasterrs.h b/freetype/src/raster/rasterrs.h index 5df9a7ab1..ab85c002a 100644 --- a/freetype/src/raster/rasterrs.h +++ b/freetype/src/raster/rasterrs.h @@ -4,7 +4,7 @@ /* */ /* monochrome renderer error codes (specification only). */ /* */ -/* Copyright 2001 by */ +/* Copyright 2001, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -30,6 +30,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX Raster_Err_ #define FT_ERR_BASE FT_Mod_Err_Raster diff --git a/freetype/src/raster/rastpic.c b/freetype/src/raster/rastpic.c index e31c54976..2883e3fde 100644 --- a/freetype/src/raster/rastpic.c +++ b/freetype/src/raster/rastpic.c @@ -20,21 +20,25 @@ #include FT_FREETYPE_H #include FT_INTERNAL_OBJECTS_H #include "rastpic.h" +#include "rasterrs.h" #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from ftraster.c */ - void FT_Init_Class_ft_standard_raster(FT_Raster_Funcs*); + void + FT_Init_Class_ft_standard_raster( FT_Raster_Funcs* funcs ); void - ft_raster1_renderer_class_pic_free( FT_Library library ) + ft_raster1_renderer_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; + + if ( pic_container->raster ) { RasterPIC* container = (RasterPIC*)pic_container->raster; - if(--container->ref_count) + if ( --container->ref_count ) return; FT_FREE( container ); pic_container->raster = NULL; @@ -43,7 +47,7 @@ FT_Error - ft_raster1_renderer_class_pic_init( FT_Library library ) + ft_raster1_renderer_class_pic_init( FT_Library library ) { FT_PIC_Container* pic_container = &library->pic_container; FT_Error error = Raster_Err_Ok; @@ -51,7 +55,7 @@ FT_Memory memory = library->memory; - /* since this function also serve raster5 renderer, + /* since this function also serve raster5 renderer, it implements reference counting */ if ( pic_container->raster ) { @@ -60,28 +64,31 @@ } /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_ALLOC( container, sizeof ( *container ) ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); + FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->raster = container; container->ref_count = 1; /* initialize pointer table - this is how the module usually expects this data */ - FT_Init_Class_ft_standard_raster(&container->ft_standard_raster); + FT_Init_Class_ft_standard_raster( &container->ft_standard_raster ); /*Exit:*/ - if(error) - ft_raster1_renderer_class_pic_free(library); + if( error ) + ft_raster1_renderer_class_pic_free( library ); return error; } /* re-route these init and free functions to the above functions */ - FT_Error ft_raster5_renderer_class_pic_init(FT_Library library) + FT_Error + ft_raster5_renderer_class_pic_init( FT_Library library ) { - return ft_raster1_renderer_class_pic_init(library); + return ft_raster1_renderer_class_pic_init( library ); } - void ft_raster5_renderer_class_pic_free(FT_Library library) + + void + ft_raster5_renderer_class_pic_free( FT_Library library ) { - ft_raster1_renderer_class_pic_free(library); + ft_raster1_renderer_class_pic_free( library ); } #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/freetype/src/raster/rastpic.h b/freetype/src/raster/rastpic.h index dcd82b8ca..7822a24b4 100644 --- a/freetype/src/raster/rastpic.h +++ b/freetype/src/raster/rastpic.h @@ -19,7 +19,7 @@ #ifndef __RASTPIC_H__ #define __RASTPIC_H__ - + FT_BEGIN_HEADER #include FT_INTERNAL_PIC_H @@ -38,6 +38,19 @@ FT_BEGIN_HEADER #define GET_PIC(lib) ((RasterPIC*)((lib)->pic_container.raster)) #define FT_STANDARD_RASTER_GET (GET_PIC(library)->ft_standard_raster) + /* see rastpic.c for the implementation */ + void + ft_raster1_renderer_class_pic_free( FT_Library library ); + + void + ft_raster5_renderer_class_pic_free( FT_Library library ); + + FT_Error + ft_raster1_renderer_class_pic_init( FT_Library library ); + + FT_Error + ft_raster5_renderer_class_pic_init( FT_Library library ); + #endif /* FT_CONFIG_OPTION_PIC */ /* */ -- cgit v1.2.3