From dba44cd4e5754b579f2184a864ffe7b79b0a7e56 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 2 Nov 2015 07:10:28 +0400 Subject: Update bundled FreeType to 2.6.1 Change-Id: Ic489f8aa8ad42da3922f542e6c9064afe44f3799 Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/3rdparty/freetype/src/smooth/Jamfile | 7 +- src/3rdparty/freetype/src/smooth/ftgrays.c | 167 +++++++++++++--------------- src/3rdparty/freetype/src/smooth/ftgrays.h | 2 +- src/3rdparty/freetype/src/smooth/ftsmerrs.h | 2 +- src/3rdparty/freetype/src/smooth/ftsmooth.c | 8 +- src/3rdparty/freetype/src/smooth/ftsmooth.h | 2 +- src/3rdparty/freetype/src/smooth/ftspic.c | 2 +- src/3rdparty/freetype/src/smooth/ftspic.h | 7 +- src/3rdparty/freetype/src/smooth/module.mk | 2 +- src/3rdparty/freetype/src/smooth/rules.mk | 8 +- src/3rdparty/freetype/src/smooth/smooth.c | 2 +- 11 files changed, 100 insertions(+), 109 deletions(-) (limited to 'src/3rdparty/freetype/src/smooth') diff --git a/src/3rdparty/freetype/src/smooth/Jamfile b/src/3rdparty/freetype/src/smooth/Jamfile index a8496aa2c2..b1887c2c6e 100644 --- a/src/3rdparty/freetype/src/smooth/Jamfile +++ b/src/3rdparty/freetype/src/smooth/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/smooth Jamfile # -# Copyright 2001 by +# Copyright 2001-2015 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -16,7 +16,10 @@ SubDir FT2_TOP $(FT2_SRC_DIR) smooth ; if $(FT2_MULTI) { - _sources = ftgrays ftsmooth ftspic ; + _sources = ftgrays + ftsmooth + ftspic + ; } else { diff --git a/src/3rdparty/freetype/src/smooth/ftgrays.c b/src/3rdparty/freetype/src/smooth/ftgrays.c index 131ad27a0c..ba2944559c 100644 --- a/src/3rdparty/freetype/src/smooth/ftgrays.c +++ b/src/3rdparty/freetype/src/smooth/ftgrays.c @@ -4,7 +4,7 @@ /* */ /* A new `perfect' anti-aliasing renderer (body). */ /* */ -/* Copyright 2000-2003, 2005-2014 by */ +/* Copyright 2000-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -24,8 +24,8 @@ /* */ /* - copy `src/smooth/ftgrays.c' (this file) to your current directory */ /* */ - /* - copy `include/ftimage.h' and `src/smooth/ftgrays.h' to the same */ - /* directory */ + /* - copy `include/freetype/ftimage.h' and `src/smooth/ftgrays.h' to the */ + /* same directory */ /* */ /* - compile `ftgrays' with the _STANDALONE_ macro defined, as in */ /* */ @@ -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 */ @@ -297,7 +317,6 @@ typedef ptrdiff_t FT_PtrDist; #undef SCALED #define ONE_PIXEL ( 1L << PIXEL_BITS ) -#define PIXEL_MASK ( -1L << PIXEL_BITS ) #define TRUNC( x ) ( (TCoord)( (x) >> PIXEL_BITS ) ) #define SUBPIXELS( x ) ( (TPos)(x) << PIXEL_BITS ) #define FLOOR( x ) ( (x) & -ONE_PIXEL ) @@ -420,11 +439,8 @@ typedef ptrdiff_t FT_PtrDist; FT_PtrDist max_cells; FT_PtrDist num_cells; - TCoord cx, cy; TPos x, y; - TPos last_ey; - FT_Vector bez_stack[32 * 3 + 1]; int lev_stack[32]; @@ -464,11 +480,7 @@ typedef ptrdiff_t FT_PtrDist; typedef struct gray_TRaster_ { - void* buffer; - long buffer_size; - int band_size; void* memory; - gray_PWorker worker; } gray_TRaster, *gray_PRaster; @@ -480,7 +492,7 @@ typedef ptrdiff_t FT_PtrDist; /* */ static void gray_init_cells( RAS_ARG_ void* buffer, - long byte_size ) + long byte_size ) { ras.buffer = buffer; ras.buffer_size = byte_size; @@ -638,8 +650,8 @@ typedef ptrdiff_t FT_PtrDist; ras.ey = ey; } - ras.invalid = ( (unsigned)ey >= (unsigned)ras.count_ey || - ex >= ras.count_ex ); + ras.invalid = ( (unsigned int)ey >= (unsigned int)ras.count_ey || + ex >= ras.count_ex ); } @@ -661,7 +673,6 @@ typedef ptrdiff_t FT_PtrDist; ras.cover = 0; ras.ex = ex - ras.min_ex; ras.ey = ey - ras.min_ey; - ras.last_ey = SUBPIXELS( ey ); ras.invalid = 0; gray_set_cell( RAS_VAR_ ex, ey ); @@ -742,7 +753,7 @@ typedef ptrdiff_t FT_PtrDist; mod -= (int)dx; - while ( ex1 != ex2 ) + do { delta = lift; mod += rem; @@ -757,7 +768,7 @@ typedef ptrdiff_t FT_PtrDist; y1 += delta; ex1 += incr; gray_set_cell( RAS_VAR_ ex1, ey ); - } + } while ( ex1 != ex2 ); } delta = y2 - y1; @@ -780,29 +791,18 @@ typedef ptrdiff_t FT_PtrDist; int delta, rem, lift, incr; - ey1 = TRUNC( ras.last_ey ); + ey1 = TRUNC( ras.y ); ey2 = TRUNC( to_y ); /* if (ey2 >= ras.max_ey) ey2 = ras.max_ey-1; */ - fy1 = (TCoord)( ras.y - ras.last_ey ); + fy1 = (TCoord)( ras.y - SUBPIXELS( ey1 ) ); fy2 = (TCoord)( to_y - SUBPIXELS( ey2 ) ); dx = to_x - ras.x; dy = to_y - ras.y; /* perform vertical clipping */ - { - TCoord min, max; - - - min = ey1; - max = ey2; - if ( ey1 > ey2 ) - { - min = ey2; - max = ey1; - } - if ( min >= ras.max_ey || max < ras.min_ey ) - goto End; - } + if ( ( ey1 >= ras.max_ey && ey2 >= ras.max_ey ) || + ( ey1 < ras.min_ey && ey2 < ras.min_ey ) ) + goto End; /* everything is on a single scanline */ if ( ey1 == ey2 ) @@ -880,7 +880,7 @@ typedef ptrdiff_t FT_PtrDist; FT_DIV_MOD( int, p, dy, lift, rem ); mod -= (int)dy; - while ( ey1 != ey2 ) + do { delta = lift; mod += rem; @@ -898,7 +898,7 @@ typedef ptrdiff_t FT_PtrDist; ey1 += incr; gray_set_cell( RAS_VAR_ TRUNC( x ), ey1 ); - } + } while ( ey1 != ey2 ); } gray_render_scanline( RAS_VAR_ ey1, x, @@ -908,7 +908,6 @@ typedef ptrdiff_t FT_PtrDist; End: ras.x = to_x; ras.y = to_y; - ras.last_ey = SUBPIXELS( ey2 ); } @@ -1212,7 +1211,7 @@ typedef ptrdiff_t FT_PtrDist; /* first of all, compute the scanline offset */ p = (unsigned char*)map->buffer - y * map->pitch; if ( map->pitch >= 0 ) - p += (unsigned)( ( map->rows - 1 ) * map->pitch ); + p += ( map->rows - 1 ) * (unsigned int)map->pitch; for ( ; count > 0; count--, spans++ ) { @@ -1744,14 +1743,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 ) @@ -1828,7 +1830,7 @@ typedef ptrdiff_t FT_PtrDist; bands[0].max = max; band = bands; - while ( band >= bands ) + do { TPos bottom, top, middle; int error; @@ -1842,13 +1844,13 @@ typedef ptrdiff_t FT_PtrDist; ras.ycells = (PCell*)ras.buffer; ras.ycount = band->max - band->min; - cell_start = sizeof ( PCell ) * ras.ycount; - cell_mod = cell_start % sizeof ( TCell ); + cell_start = (long)sizeof ( PCell ) * ras.ycount; + cell_mod = cell_start % (long)sizeof ( TCell ); if ( cell_mod > 0 ) - cell_start += sizeof ( TCell ) - cell_mod; + cell_start += (long)sizeof ( TCell ) - cell_mod; cell_end = ras.buffer_size; - cell_end -= cell_end % sizeof ( TCell ); + cell_end -= cell_end % (long)sizeof ( TCell ); cells_max = (PCell)( (char*)ras.buffer + cell_end ); ras.cells = (PCell)( (char*)ras.buffer + cell_start ); @@ -1904,7 +1906,7 @@ typedef ptrdiff_t FT_PtrDist; band[0].min = middle; band[0].max = top; band++; - } + } while ( band >= bands ); } if ( ras.band_shoot > 8 && ras.band_size > 16 ) @@ -1918,12 +1920,18 @@ typedef ptrdiff_t FT_PtrDist; gray_raster_render( gray_PRaster raster, const FT_Raster_Params* params ) { - const FT_Outline* outline = (const FT_Outline*)params->source; - const FT_Bitmap* target_map = params->target; - gray_PWorker worker; + const FT_Outline* outline = (const FT_Outline*)params->source; + const FT_Bitmap* target_map = params->target; + + gray_TWorker worker[1]; + + TCell buffer[FT_MAX( FT_RENDER_POOL_SIZE, 2048 ) / sizeof ( TCell )]; + long buffer_size = sizeof ( buffer ); + int band_size = (int)( buffer_size / + (long)( sizeof ( TCell ) * 8 ) ); - if ( !raster || !raster->buffer || !raster->buffer_size ) + if ( !raster ) return FT_THROW( Invalid_Argument ); if ( !outline ) @@ -1940,8 +1948,6 @@ typedef ptrdiff_t FT_PtrDist; outline->contours[outline->n_contours - 1] + 1 ) return FT_THROW( Invalid_Outline ); - worker = raster->worker; - /* if direct mode is not set, we must have a target bitmap */ if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) ) { @@ -1966,8 +1972,8 @@ typedef ptrdiff_t FT_PtrDist; /* compute clip box from target pixmap */ ras.clip_box.xMin = 0; ras.clip_box.yMin = 0; - ras.clip_box.xMax = target_map->width; - ras.clip_box.yMax = target_map->rows; + ras.clip_box.xMax = (FT_Pos)target_map->width; + ras.clip_box.yMax = (FT_Pos)target_map->rows; } else if ( params->flags & FT_RASTER_FLAG_CLIP ) ras.clip_box = params->clip_box; @@ -1979,13 +1985,14 @@ typedef ptrdiff_t FT_PtrDist; ras.clip_box.yMax = 32767L; } - gray_init_cells( RAS_VAR_ raster->buffer, raster->buffer_size ); + gray_init_cells( RAS_VAR_ buffer, buffer_size ); ras.outline = *outline; ras.num_cells = 0; ras.invalid = 1; - ras.band_size = raster->band_size; + ras.band_size = band_size; ras.num_gray_spans = 0; + ras.span_y = 0; if ( params->flags & FT_RASTER_FLAG_DIRECT ) { @@ -2069,34 +2076,9 @@ typedef ptrdiff_t FT_PtrDist; char* pool_base, long pool_size ) { - gray_PRaster rast = (gray_PRaster)raster; - - - if ( raster ) - { - if ( pool_base && pool_size >= (long)sizeof ( gray_TWorker ) + 2048 ) - { - gray_PWorker worker = (gray_PWorker)pool_base; - - - rast->worker = worker; - rast->buffer = pool_base + - ( ( sizeof ( gray_TWorker ) + - sizeof ( TCell ) - 1 ) & - ~( sizeof ( TCell ) - 1 ) ); - rast->buffer_size = (long)( ( pool_base + pool_size ) - - (char*)rast->buffer ) & - ~( sizeof ( TCell ) - 1 ); - rast->band_size = (int)( rast->buffer_size / - ( sizeof ( TCell ) * 8 ) ); - } - else - { - rast->buffer = NULL; - rast->buffer_size = 0; - rast->worker = NULL; - } - } + FT_UNUSED( raster ); + FT_UNUSED( pool_base ); + FT_UNUSED( pool_size ); } @@ -2114,15 +2096,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 */ diff --git a/src/3rdparty/freetype/src/smooth/ftgrays.h b/src/3rdparty/freetype/src/smooth/ftgrays.h index f20f55f14b..1b5760330c 100644 --- a/src/3rdparty/freetype/src/smooth/ftgrays.h +++ b/src/3rdparty/freetype/src/smooth/ftgrays.h @@ -4,7 +4,7 @@ /* */ /* FreeType smooth renderer declaration */ /* */ -/* Copyright 1996-2001 by */ +/* Copyright 1996-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/3rdparty/freetype/src/smooth/ftsmerrs.h b/src/3rdparty/freetype/src/smooth/ftsmerrs.h index 413d2f1f70..cc38aa1996 100644 --- a/src/3rdparty/freetype/src/smooth/ftsmerrs.h +++ b/src/3rdparty/freetype/src/smooth/ftsmerrs.h @@ -4,7 +4,7 @@ /* */ /* smooth renderer error codes (specification only). */ /* */ -/* Copyright 2001, 2012 by */ +/* Copyright 2001-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/3rdparty/freetype/src/smooth/ftsmooth.c b/src/3rdparty/freetype/src/smooth/ftsmooth.c index 4e2dee562b..3620550534 100644 --- a/src/3rdparty/freetype/src/smooth/ftsmooth.c +++ b/src/3rdparty/freetype/src/smooth/ftsmooth.c @@ -4,7 +4,7 @@ /* */ /* Anti-aliasing renderer interface (body). */ /* */ -/* Copyright 2000-2006, 2009-2013 by */ +/* Copyright 2000-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -230,7 +230,7 @@ } /* allocate new one */ - if ( FT_ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) ) + if ( FT_ALLOC( bitmap->buffer, (FT_ULong)( pitch * height ) ) ) goto Exit; else have_buffer = TRUE; @@ -243,8 +243,8 @@ bitmap->pixel_mode = FT_PIXEL_MODE_GRAY; bitmap->num_grays = 256; - bitmap->width = width; - bitmap->rows = height; + bitmap->width = (unsigned int)width; + bitmap->rows = (unsigned int)height; bitmap->pitch = pitch; /* translate outline to render it into the bitmap */ diff --git a/src/3rdparty/freetype/src/smooth/ftsmooth.h b/src/3rdparty/freetype/src/smooth/ftsmooth.h index 3708790df1..765018c239 100644 --- a/src/3rdparty/freetype/src/smooth/ftsmooth.h +++ b/src/3rdparty/freetype/src/smooth/ftsmooth.h @@ -4,7 +4,7 @@ /* */ /* Anti-aliasing renderer interface (specification). */ /* */ -/* Copyright 1996-2001 by */ +/* Copyright 1996-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/3rdparty/freetype/src/smooth/ftspic.c b/src/3rdparty/freetype/src/smooth/ftspic.c index 67a2b8310c..8e6ed57eec 100644 --- a/src/3rdparty/freetype/src/smooth/ftspic.c +++ b/src/3rdparty/freetype/src/smooth/ftspic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for smooth module. */ /* */ -/* Copyright 2009, 2010, 2012, 2013 by */ +/* Copyright 2009-2015 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/src/3rdparty/freetype/src/smooth/ftspic.h b/src/3rdparty/freetype/src/smooth/ftspic.h index 334b51c3f1..071afcff20 100644 --- a/src/3rdparty/freetype/src/smooth/ftspic.h +++ b/src/3rdparty/freetype/src/smooth/ftspic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for smooth module. */ /* */ -/* Copyright 2009 by */ +/* Copyright 2009-2015 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,10 +20,11 @@ #define __FTSPIC_H__ -FT_BEGIN_HEADER - #include FT_INTERNAL_PIC_H + +FT_BEGIN_HEADER + #ifndef FT_CONFIG_OPTION_PIC #define FT_GRAYS_RASTER_GET ft_grays_raster diff --git a/src/3rdparty/freetype/src/smooth/module.mk b/src/3rdparty/freetype/src/smooth/module.mk index 47f6c04076..740936f5b1 100644 --- a/src/3rdparty/freetype/src/smooth/module.mk +++ b/src/3rdparty/freetype/src/smooth/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2006 by +# Copyright 1996-2015 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/3rdparty/freetype/src/smooth/rules.mk b/src/3rdparty/freetype/src/smooth/rules.mk index 88d0aa53ac..f00ebd5f15 100644 --- a/src/3rdparty/freetype/src/smooth/rules.mk +++ b/src/3rdparty/freetype/src/smooth/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2001, 2003, 2011 by +# Copyright 1996-2015 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -17,9 +17,13 @@ # SMOOTH_DIR := $(SRC_DIR)/smooth + # compilation flags for the driver # -SMOOTH_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SMOOTH_DIR)) +SMOOTH_COMPILE := $(CC) $(ANSIFLAGS) \ + $I$(subst /,$(COMPILER_SEP),$(SMOOTH_DIR)) \ + $(INCLUDE_FLAGS) \ + $(FT_CFLAGS) # smooth driver sources (i.e., C files) diff --git a/src/3rdparty/freetype/src/smooth/smooth.c b/src/3rdparty/freetype/src/smooth/smooth.c index a8ac51f9f8..4ca4344c89 100644 --- a/src/3rdparty/freetype/src/smooth/smooth.c +++ b/src/3rdparty/freetype/src/smooth/smooth.c @@ -4,7 +4,7 @@ /* */ /* FreeType anti-aliasing rasterer module component (body only). */ /* */ -/* Copyright 1996-2001 by */ +/* Copyright 1996-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ -- cgit v1.2.3