summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/freetype/src/cache/ftcsbits.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/freetype/src/cache/ftcsbits.c')
-rw-r--r--src/3rdparty/freetype/src/cache/ftcsbits.c43
1 files changed, 30 insertions, 13 deletions
diff --git a/src/3rdparty/freetype/src/cache/ftcsbits.c b/src/3rdparty/freetype/src/cache/ftcsbits.c
index 60d46aa7a0..59727d16e2 100644
--- a/src/3rdparty/freetype/src/cache/ftcsbits.c
+++ b/src/3rdparty/freetype/src/cache/ftcsbits.c
@@ -4,7 +4,7 @@
/* */
/* FreeType sbits manager (body). */
/* */
-/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009 by */
+/* Copyright 2000-2006, 2009-2011, 2013, 2014 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -116,7 +116,7 @@
if ( (FT_UInt)(gindex - gnode->gindex) >= snode->count )
{
FT_ERROR(( "ftc_snode_load: invalid glyph index" ));
- return FTC_Err_Invalid_Argument;
+ return FT_THROW( Invalid_Argument );
}
sbit = snode->sbits + ( gindex - gnode->gindex );
@@ -142,12 +142,12 @@
goto BadGlyph;
}
- /* Check that our values fit into 8-bit containers! */
+ /* Check whether our values fit into 8-bit containers! */
/* If this is not the case, our bitmap is too large */
/* and we will leave it as `missing' with sbit.buffer = 0 */
-#define CHECK_CHAR( d ) ( temp = (FT_Char)d, temp == d )
-#define CHECK_BYTE( d ) ( temp = (FT_Byte)d, temp == d )
+#define CHECK_CHAR( d ) ( temp = (FT_Char)d, (FT_Int) temp == (FT_Int) d )
+#define CHECK_BYTE( d ) ( temp = (FT_Byte)d, (FT_UInt)temp == (FT_UInt)d )
/* horizontal advance in pixels */
xadvance = ( slot->advance.x + 32 ) >> 6;
@@ -160,7 +160,11 @@
!CHECK_CHAR( slot->bitmap_top ) ||
!CHECK_CHAR( xadvance ) ||
!CHECK_CHAR( yadvance ) )
+ {
+ FT_TRACE2(( "ftc_snode_load:"
+ " glyph too large for small bitmap cache\n"));
goto BadGlyph;
+ }
sbit->width = (FT_Byte)bitmap->width;
sbit->height = (FT_Byte)bitmap->rows;
@@ -185,13 +189,13 @@
/* we mark unloaded glyphs with `sbit.buffer == 0' */
/* and `width == 255', `height == 0' */
/* */
- if ( error && error != FTC_Err_Out_Of_Memory )
+ if ( error && FT_ERR_NEQ( error, Out_Of_Memory ) )
{
BadGlyph:
sbit->width = 255;
sbit->height = 0;
sbit->buffer = NULL;
- error = 0;
+ error = FT_Err_Ok;
if ( asize )
*asize = 0;
}
@@ -213,12 +217,13 @@
FTC_SFamilyClass clazz = FTC_CACHE__SFAMILY_CLASS( cache );
FT_UInt total;
+ FT_UInt node_count;
total = clazz->family_get_count( family, cache->manager );
if ( total == 0 || gindex >= total )
{
- error = FT_Err_Invalid_Argument;
+ error = FT_THROW( Invalid_Argument );
goto Exit;
}
@@ -235,6 +240,10 @@
FTC_GNode_Init( FTC_GNODE( snode ), start, family );
snode->count = count;
+ for ( node_count = 0; node_count < count; node_count++ )
+ {
+ snode->sbits[node_count].width = 255;
+ }
error = ftc_snode_load( snode,
cache->manager,
@@ -315,7 +324,8 @@
FT_LOCAL_DEF( FT_Bool )
ftc_snode_compare( FTC_Node ftcsnode,
FT_Pointer ftcgquery,
- FTC_Cache cache )
+ FTC_Cache cache,
+ FT_Bool* list_changed )
{
FTC_SNode snode = (FTC_SNode)ftcsnode;
FTC_GQuery gquery = (FTC_GQuery)ftcgquery;
@@ -324,6 +334,8 @@
FT_Bool result;
+ if (list_changed)
+ *list_changed = FALSE;
result = FT_BOOL( gnode->family == gquery->family &&
(FT_UInt)( gindex - gnode->gindex ) < snode->count );
if ( result )
@@ -364,7 +376,7 @@
*
*/
- if ( sbit->buffer == NULL && sbit->width != 255 )
+ if ( sbit->buffer == NULL && sbit->width == 255 )
{
FT_ULong size;
FT_Error error;
@@ -377,7 +389,7 @@
{
error = ftc_snode_load( snode, cache->manager, gindex, &size );
}
- FTC_CACHE_TRYLOOP_END();
+ FTC_CACHE_TRYLOOP_END( list_changed );
ftcsnode->ref_count--; /* unlock the node */
@@ -392,13 +404,18 @@
}
+#ifdef FTC_INLINE
+
FT_LOCAL_DEF( FT_Bool )
FTC_SNode_Compare( FTC_SNode snode,
FTC_GQuery gquery,
- FTC_Cache cache )
+ FTC_Cache cache,
+ FT_Bool* list_changed )
{
- return ftc_snode_compare( FTC_NODE( snode ), gquery, cache );
+ return ftc_snode_compare( FTC_NODE( snode ), gquery,
+ cache, list_changed );
}
+#endif
/* END */