From 2eaf0cf8fd6e7c290497fedb08134a89e7b49b1d Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Thu, 19 Mar 2015 17:34:42 +0400 Subject: Update bundled FreeType to 2.5.5 Removed everything, imported with help of import_from_tarball.sh script, and then added a pre-generated builds/unix/ftconfig.h Task-number: QTBUG-44648 Change-Id: Iea948e41f7761f1580382b3763d04c7a61383382 Reviewed-by: Lars Knoll --- src/3rdparty/freetype/src/base/ftglyph.c | 124 +++++++++++++++---------------- 1 file changed, 61 insertions(+), 63 deletions(-) (limited to 'src/3rdparty/freetype/src/base/ftglyph.c') diff --git a/src/3rdparty/freetype/src/base/ftglyph.c b/src/3rdparty/freetype/src/base/ftglyph.c index 3505d6dde9..ac178c41be 100644 --- a/src/3rdparty/freetype/src/base/ftglyph.c +++ b/src/3rdparty/freetype/src/base/ftglyph.c @@ -4,7 +4,7 @@ /* */ /* FreeType convenience functions to handle glyphs (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2007, 2008 by */ +/* Copyright 1996-2005, 2007, 2008, 2010, 2012-2014 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -29,6 +29,8 @@ #include +#include FT_INTERNAL_DEBUG_H + #include FT_GLYPH_H #include FT_OUTLINE_H #include FT_BITMAP_H @@ -65,7 +67,7 @@ if ( slot->format != FT_GLYPH_FORMAT_BITMAP ) { - error = FT_Err_Invalid_Glyph_Format; + error = FT_THROW( Invalid_Glyph_Format ); goto Exit; } @@ -166,7 +168,7 @@ /* check format in glyph slot */ if ( slot->format != FT_GLYPH_FORMAT_OUTLINE ) { - error = FT_Err_Invalid_Glyph_Format; + error = FT_THROW( Invalid_Glyph_Format ); goto Exit; } @@ -254,7 +256,7 @@ } - FT_DEFINE_GLYPH( ft_outline_glyph_class, + FT_DEFINE_GLYPH( ft_outline_glyph_class, sizeof ( FT_OutlineGlyphRec ), FT_GLYPH_FORMAT_OUTLINE, @@ -282,7 +284,7 @@ { FT_Memory memory = library->memory; FT_Error error; - FT_Glyph glyph; + FT_Glyph glyph = NULL; *aglyph = 0; @@ -312,17 +314,17 @@ /* check arguments */ - if ( !target ) + if ( !target || !source || !source->clazz ) { - error = FT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } - *target = 0; + *target = NULL; if ( !source || !source->clazz ) { - error = FT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -357,16 +359,16 @@ FT_Error error; FT_Glyph glyph; - const FT_Glyph_Class* clazz = 0; + const FT_Glyph_Class* clazz = NULL; if ( !slot ) - return FT_Err_Invalid_Slot_Handle; + return FT_THROW( Invalid_Slot_Handle ); library = slot->library; if ( !aglyph ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); /* if it is a bitmap, that's easy :-) */ if ( slot->format == FT_GLYPH_FORMAT_BITMAP ) @@ -388,7 +390,7 @@ if ( !clazz ) { - error = FT_Err_Invalid_Glyph_Format; + error = FT_THROW( Invalid_Glyph_Format ); goto Exit; } @@ -422,15 +424,16 @@ FT_Matrix* matrix, FT_Vector* delta ) { - const FT_Glyph_Class* clazz; - FT_Error error = FT_Err_Ok; + FT_Error error = FT_Err_Ok; if ( !glyph || !glyph->clazz ) - error = FT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); else { - clazz = glyph->clazz; + const FT_Glyph_Class* clazz = glyph->clazz; + + if ( clazz->glyph_transform ) { /* transform glyph image */ @@ -441,7 +444,7 @@ FT_Vector_Transform( &glyph->advance, matrix ); } else - error = FT_Err_Invalid_Glyph_Format; + error = FT_THROW( Invalid_Glyph_Format ); } return error; } @@ -464,38 +467,33 @@ if ( !glyph || !glyph->clazz ) return; - else + + clazz = glyph->clazz; + if ( !clazz->glyph_bbox ) + return; + + /* retrieve bbox in 26.6 coordinates */ + clazz->glyph_bbox( glyph, acbox ); + + /* perform grid fitting if needed */ + if ( bbox_mode == FT_GLYPH_BBOX_GRIDFIT || + bbox_mode == FT_GLYPH_BBOX_PIXELS ) { - clazz = glyph->clazz; - if ( !clazz->glyph_bbox ) - return; - else - { - /* retrieve bbox in 26.6 coordinates */ - clazz->glyph_bbox( glyph, acbox ); - - /* perform grid fitting if needed */ - if ( bbox_mode == FT_GLYPH_BBOX_GRIDFIT || - bbox_mode == FT_GLYPH_BBOX_PIXELS ) - { - acbox->xMin = FT_PIX_FLOOR( acbox->xMin ); - acbox->yMin = FT_PIX_FLOOR( acbox->yMin ); - acbox->xMax = FT_PIX_CEIL( acbox->xMax ); - acbox->yMax = FT_PIX_CEIL( acbox->yMax ); - } - - /* convert to integer pixels if needed */ - if ( bbox_mode == FT_GLYPH_BBOX_TRUNCATE || - bbox_mode == FT_GLYPH_BBOX_PIXELS ) - { - acbox->xMin >>= 6; - acbox->yMin >>= 6; - acbox->xMax >>= 6; - acbox->yMax >>= 6; - } - } + acbox->xMin = FT_PIX_FLOOR( acbox->xMin ); + acbox->yMin = FT_PIX_FLOOR( acbox->yMin ); + acbox->xMax = FT_PIX_CEIL( acbox->xMax ); + acbox->yMax = FT_PIX_CEIL( acbox->yMax ); + } + + /* convert to integer pixels if needed */ + if ( bbox_mode == FT_GLYPH_BBOX_TRUNCATE || + bbox_mode == FT_GLYPH_BBOX_PIXELS ) + { + acbox->xMin >>= 6; + acbox->yMin >>= 6; + acbox->xMax >>= 6; + acbox->yMax >>= 6; } - return; } @@ -510,47 +508,47 @@ FT_GlyphSlotRec dummy; FT_GlyphSlot_InternalRec dummy_internal; FT_Error error = FT_Err_Ok; - FT_Glyph glyph; + FT_Glyph b, glyph; FT_BitmapGlyph bitmap = NULL; - const FT_Glyph_Class* clazz; -#ifdef FT_CONFIG_OPTION_PIC - FT_Library library = FT_GLYPH( glyph )->library; -#endif + /* FT_BITMAP_GLYPH_CLASS_GET dereferences `library' in PIC mode */ + FT_Library library; /* check argument */ if ( !the_glyph ) goto Bad; - - /* we render the glyph into a glyph bitmap using a `dummy' glyph slot */ - /* then calling FT_Render_Glyph_Internal() */ - glyph = *the_glyph; if ( !glyph ) goto Bad; - clazz = glyph->clazz; + clazz = glyph->clazz; + library = glyph->library; + if ( !library || !clazz ) + goto Bad; /* when called with a bitmap glyph, do nothing and return successfully */ if ( clazz == FT_BITMAP_GLYPH_CLASS_GET ) goto Exit; - if ( !clazz || !clazz->glyph_prepare ) + if ( !clazz->glyph_prepare ) goto Bad; + /* we render the glyph into a glyph bitmap using a `dummy' glyph slot */ + /* then calling FT_Render_Glyph_Internal() */ + FT_MEM_ZERO( &dummy, sizeof ( dummy ) ); FT_MEM_ZERO( &dummy_internal, sizeof ( dummy_internal ) ); dummy.internal = &dummy_internal; - dummy.library = glyph->library; + dummy.library = library; dummy.format = clazz->glyph_format; /* create result bitmap glyph */ - error = ft_new_glyph( glyph->library, FT_BITMAP_GLYPH_CLASS_GET, - (FT_Glyph*)(void*)&bitmap ); + error = ft_new_glyph( library, FT_BITMAP_GLYPH_CLASS_GET, &b ); if ( error ) goto Exit; + bitmap = (FT_BitmapGlyph)b; #if 1 /* if `origin' is set, translate the glyph image */ @@ -600,7 +598,7 @@ return error; Bad: - error = FT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } -- cgit v1.2.3