diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2011-07-18 20:30:00 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2011-07-18 20:30:00 +0000 |
commit | 18c040ad5197a47d908cba66fdac8e77c83809e4 (patch) | |
tree | 5e8a5a395a910ff95b080560f5239d761529f943 /lib/freetype/src/cache | |
parent | 7dfeaf2d218d6d8404ff3e77d21e9c6260eb63ed (diff) |
Update to freetype 2.4.5. Tested by many.
Diffstat (limited to 'lib/freetype/src/cache')
-rw-r--r-- | lib/freetype/src/cache/ftcbasic.c | 8 | ||||
-rw-r--r-- | lib/freetype/src/cache/ftccache.c | 103 | ||||
-rw-r--r-- | lib/freetype/src/cache/ftccache.h | 66 | ||||
-rw-r--r-- | lib/freetype/src/cache/ftccback.h | 8 | ||||
-rw-r--r-- | lib/freetype/src/cache/ftccmap.c | 14 | ||||
-rw-r--r-- | lib/freetype/src/cache/ftcglyph.c | 18 | ||||
-rw-r--r-- | lib/freetype/src/cache/ftcglyph.h | 12 | ||||
-rw-r--r-- | lib/freetype/src/cache/ftcmanag.h | 2 | ||||
-rw-r--r-- | lib/freetype/src/cache/ftcmru.c | 12 | ||||
-rw-r--r-- | lib/freetype/src/cache/ftcsbits.c | 25 | ||||
-rw-r--r-- | lib/freetype/src/cache/ftcsbits.h | 9 |
11 files changed, 198 insertions, 79 deletions
diff --git a/lib/freetype/src/cache/ftcbasic.c b/lib/freetype/src/cache/ftcbasic.c index 609ff78e5..09d793ecf 100644 --- a/lib/freetype/src/cache/ftcbasic.c +++ b/lib/freetype/src/cache/ftcbasic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType basic cache interface (body). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007, 2009, 2010 by */ +/* Copyright 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,6 +17,7 @@ #include <ft2build.h> +#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H #include FT_CACHE_H #include "ftcglyph.h" @@ -237,7 +238,8 @@ FT_CALLBACK_DEF( FT_Bool ) ftc_basic_gnode_compare_faceid( FTC_Node ftcgnode, FT_Pointer ftcface_id, - FTC_Cache cache ) + FTC_Cache cache, + FT_Bool* list_changed ) { FTC_GNode gnode = (FTC_GNode)ftcgnode; FTC_FaceID face_id = (FTC_FaceID)ftcface_id; @@ -245,6 +247,8 @@ FT_Bool result; + if ( list_changed ) + *list_changed = FALSE; result = FT_BOOL( family->attrs.scaler.face_id == face_id ); if ( result ) { diff --git a/lib/freetype/src/cache/ftccache.c b/lib/freetype/src/cache/ftccache.c index a5a915e08..f01c403f8 100644 --- a/lib/freetype/src/cache/ftccache.c +++ b/lib/freetype/src/cache/ftccache.c @@ -4,7 +4,8 @@ /* */ /* The FreeType internal cache interface (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 by */ +/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, */ +/* 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -32,7 +33,7 @@ #define FTC_HASH_MIN_LOAD 1 #define FTC_HASH_SUB_LOAD ( FTC_HASH_MAX_LOAD - FTC_HASH_MIN_LOAD ) -/* this one _must_ be a power of 2! */ + /* this one _must_ be a power of 2! */ #define FTC_HASH_INITIAL_SIZE 8 @@ -83,6 +84,25 @@ (FTC_MruNode)node ); } + + /* get a top bucket for specified hash from cache, + * body for FTC_NODE__TOP_FOR_HASH( cache, hash ) + */ + FT_LOCAL_DEF( FTC_Node* ) + ftc_get_top_node_for_hash( FTC_Cache cache, + FT_PtrDist hash ) + { + FTC_Node* pnode; + FT_UInt idx; + + + idx = (FT_UInt)( hash & cache->mask ); + if ( idx < cache->p ) + idx = (FT_UInt)( hash & ( 2 * cache->mask + 1 ) ); + pnode = cache->buckets + idx; + return pnode; + } + #endif /* !FTC_INLINE */ @@ -96,9 +116,9 @@ for (;;) { FTC_Node node, *pnode; - FT_UFast p = cache->p; - FT_UFast mask = cache->mask; - FT_UFast count = mask + p + 1; /* number of buckets */ + FT_UFast p = cache->p; + FT_UFast mask = cache->mask; + FT_UFast count = mask + p + 1; /* number of buckets */ /* do we need to shrink the buckets array? */ @@ -117,7 +137,8 @@ /* if we can't expand the array, leave immediately */ - if ( FT_RENEW_ARRAY( cache->buckets, (mask+1)*2, (mask+1)*4 ) ) + if ( FT_RENEW_ARRAY( cache->buckets, + ( mask + 1 ) * 2, ( mask + 1 ) * 4 ) ) break; } @@ -191,7 +212,9 @@ cache->slack -= FTC_HASH_MAX_LOAD; cache->p = p; } - else /* the hash table is balanced */ + + /* otherwise, the hash table is balanced */ + else break; } } @@ -202,15 +225,8 @@ ftc_node_hash_unlink( FTC_Node node0, FTC_Cache cache ) { - FTC_Node *pnode; - FT_UInt idx; - - - idx = (FT_UInt)( node0->hash & cache->mask ); - if ( idx < cache->p ) - idx = (FT_UInt)( node0->hash & ( 2 * cache->mask + 1 ) ); + FTC_Node *pnode = FTC_NODE__TOP_FOR_HASH( cache, node0->hash ); - pnode = cache->buckets + idx; for (;;) { @@ -242,16 +258,9 @@ ftc_node_hash_link( FTC_Node node, FTC_Cache cache ) { - FTC_Node *pnode; - FT_UInt idx; + FTC_Node *pnode = FTC_NODE__TOP_FOR_HASH( cache, node->hash ); - idx = (FT_UInt)( node->hash & cache->mask ); - if ( idx < cache->p ) - idx = (FT_UInt)( node->hash & (2 * cache->mask + 1 ) ); - - pnode = cache->buckets + idx; - node->link = *pnode; *pnode = node; @@ -413,8 +422,8 @@ FT_PtrDist hash, FTC_Node node ) { - node->hash = hash; - node->cache_index = (FT_UInt16) cache->index; + node->hash = hash; + node->cache_index = (FT_UInt16)cache->index; node->ref_count = 0; ftc_node_hash_link( node, cache ); @@ -456,7 +465,7 @@ { error = cache->clazz.node_new( &node, query, cache ); } - FTC_CACHE_TRYLOOP_END(); + FTC_CACHE_TRYLOOP_END( NULL ); if ( error ) node = NULL; @@ -481,11 +490,11 @@ FT_Pointer query, FTC_Node *anode ) { - FT_UFast idx; FTC_Node* bucket; FTC_Node* pnode; FTC_Node node; - FT_Error error = FTC_Err_Ok; + FT_Error error = FTC_Err_Ok; + FT_Bool list_changed = FALSE; FTC_Node_CompareFunc compare = cache->clazz.node_compare; @@ -493,24 +502,43 @@ if ( cache == NULL || anode == NULL ) return FTC_Err_Invalid_Argument; - idx = hash & cache->mask; - if ( idx < cache->p ) - idx = hash & ( cache->mask * 2 + 1 ); + /* Go to the `top' node of the list sharing same masked hash */ + bucket = pnode = FTC_NODE__TOP_FOR_HASH( cache, hash ); - bucket = cache->buckets + idx; - pnode = bucket; + /* Lookup a node with exactly same hash and queried properties. */ + /* NOTE: _nodcomp() may change the linked list to reduce memory. */ for (;;) { node = *pnode; if ( node == NULL ) goto NewNode; - if ( node->hash == hash && compare( node, query, cache ) ) + if ( node->hash == hash && + compare( node, query, cache, &list_changed ) ) break; pnode = &node->link; } + if ( list_changed ) + { + /* Update bucket by modified linked list */ + bucket = pnode = FTC_NODE__TOP_FOR_HASH( cache, hash ); + + /* Update pnode by modified linked list */ + while ( *pnode != node ) + { + if ( *pnode == NULL ) + { + FT_ERROR(( "FTC_Cache_Lookup: oops!!! node missing\n" )); + goto NewNode; + } + else + pnode = &((*pnode)->link); + } + } + + /* Reorder the list to move the found node to the `top' */ if ( node != *bucket ) { *pnode = node->link; @@ -527,6 +555,7 @@ ftc_node_mru_up( node, manager ); } *anode = node; + return error; NewNode: @@ -545,7 +574,7 @@ FTC_Node frees = NULL; - count = cache->p + cache->mask; + count = cache->p + cache->mask + 1; for ( i = 0; i < count; i++ ) { FTC_Node* bucket = cache->buckets + i; @@ -555,12 +584,14 @@ for ( ;; ) { FTC_Node node = *pnode; + FT_Bool list_changed = FALSE; if ( node == NULL ) break; - if ( cache->clazz.node_remove_faceid( node, face_id, cache ) ) + if ( cache->clazz.node_remove_faceid( node, face_id, + cache, &list_changed ) ) { *pnode = node->link; node->link = frees; diff --git a/lib/freetype/src/cache/ftccache.h b/lib/freetype/src/cache/ftccache.h index 10830a9f8..d60984f77 100644 --- a/lib/freetype/src/cache/ftccache.h +++ b/lib/freetype/src/cache/ftccache.h @@ -4,7 +4,8 @@ /* */ /* FreeType internal cache interface (specification). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 by */ +/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, */ +/* 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -24,7 +25,7 @@ FT_BEGIN_HEADER -#define _FTC_FACE_ID_HASH( i ) \ +#define _FTC_FACE_ID_HASH( i ) \ ((FT_PtrDist)(( (FT_PtrDist)(i) >> 3 ) ^ ( (FT_PtrDist)(i) << 7 ))) /* handle to cache object */ @@ -72,6 +73,19 @@ FT_BEGIN_HEADER #define FTC_NODE__NEXT( x ) FTC_NODE( (x)->mru.next ) #define FTC_NODE__PREV( x ) FTC_NODE( (x)->mru.prev ) +#ifdef FTC_INLINE +#define FTC_NODE__TOP_FOR_HASH( cache, hash ) \ + ( ( cache )->buckets + \ + ( ( ( ( hash ) & ( cache )->mask ) < ( cache )->p ) \ + ? ( ( hash ) & ( ( cache )->mask * 2 + 1 ) ) \ + : ( ( hash ) & ( cache )->mask ) ) ) +#else + FT_LOCAL( FTC_Node* ) + ftc_get_top_node_for_hash( FTC_Cache cache, + FT_PtrDist hash ); +#define FTC_NODE__TOP_FOR_HASH( cache, hash ) \ + ftc_get_top_node_for_hash( ( cache ), ( hash ) ) +#endif #ifdef FT_CONFIG_OPTION_OLD_INTERNALS FT_BASE( void ) @@ -102,7 +116,8 @@ FT_BEGIN_HEADER typedef FT_Bool (*FTC_Node_CompareFunc)( FTC_Node node, FT_Pointer key, - FTC_Cache cache ); + FTC_Cache cache, + FT_Bool* list_changed ); typedef void @@ -162,7 +177,7 @@ FT_BEGIN_HEADER FT_LOCAL( void ) FTC_Cache_Done( FTC_Cache cache ); - /* Call this function to lookup the cache. If no corresponding + /* Call this function to look up the cache. If no corresponding * node is found, a new one is automatically created. This function * is capable of flushing the cache adequately to make room for the * new cache object. @@ -184,7 +199,7 @@ FT_BEGIN_HEADER /* Remove all nodes that relate to a given face_id. This is useful * when un-installing fonts. Note that if a cache node relates to - * the face_id, but is locked (i.e., has `ref_count > 0'), the node + * the face_id but is locked (i.e., has `ref_count > 0'), the node * will _not_ be destroyed, but its internal face_id reference will * be modified. * @@ -205,28 +220,49 @@ FT_BEGIN_HEADER FTC_Cache _cache = FTC_CACHE(cache); \ FT_PtrDist _hash = (FT_PtrDist)(hash); \ FTC_Node_CompareFunc _nodcomp = (FTC_Node_CompareFunc)(nodecmp); \ - FT_UFast _idx; \ + FT_Bool _list_changed = FALSE; \ \ \ error = FTC_Err_Ok; \ node = NULL; \ - _idx = _hash & _cache->mask; \ - if ( _idx < _cache->p ) \ - _idx = _hash & ( _cache->mask*2 + 1 ); \ \ - _bucket = _pnode = _cache->buckets + _idx; \ + /* Go to the `top' node of the list sharing same masked hash */ \ + _bucket = _pnode = FTC_NODE__TOP_FOR_HASH( _cache, _hash ); \ + \ + /* Look up a node with identical hash and queried properties. */ \ + /* NOTE: _nodcomp() may change the linked list to reduce memory. */ \ for (;;) \ { \ _node = *_pnode; \ if ( _node == NULL ) \ goto _NewNode; \ \ - if ( _node->hash == _hash && _nodcomp( _node, query, _cache ) ) \ + if ( _node->hash == _hash && \ + _nodcomp( _node, query, _cache, &_list_changed ) ) \ break; \ \ _pnode = &_node->link; \ } \ \ + if ( _list_changed ) \ + { \ + /* Update _bucket by possibly modified linked list */ \ + _bucket = _pnode = FTC_NODE__TOP_FOR_HASH( _cache, _hash ); \ + \ + /* Update _pnode by possibly modified linked list */ \ + while ( *_pnode != _node ) \ + { \ + if ( *_pnode == NULL ) \ + { \ + FT_ERROR(( "FTC_CACHE_LOOKUP_CMP: oops!!! node missing\n" )); \ + goto _NewNode; \ + } \ + else \ + _pnode = &((*_pnode)->link); \ + } \ + } \ + \ + /* Reorder the list to move the found node to the `top' */ \ if ( _node != *_bucket ) \ { \ *_pnode = _node->link; \ @@ -234,6 +270,7 @@ FT_BEGIN_HEADER *_bucket = _node; \ } \ \ + /* Update MRU list */ \ { \ FTC_Manager _manager = _cache->manager; \ void* _nl = &_manager->nodes_list; \ @@ -268,7 +305,7 @@ FT_BEGIN_HEADER * loop to flush the cache repeatedly in case of memory overflows. * * It is used when creating a new cache node, or within a lookup - * that needs to allocate data (e.g., the sbit cache lookup). + * that needs to allocate data (e.g. the sbit cache lookup). * * Example: * @@ -290,11 +327,14 @@ FT_BEGIN_HEADER FT_UInt _try_done; -#define FTC_CACHE_TRYLOOP_END() \ +#define FTC_CACHE_TRYLOOP_END( list_changed ) \ if ( !error || error != FTC_Err_Out_Of_Memory ) \ break; \ \ _try_done = FTC_Manager_FlushN( _try_manager, _try_count ); \ + if ( _try_done > 0 && ( list_changed ) ) \ + *(FT_Bool*)( list_changed ) = TRUE; \ + \ if ( _try_done == 0 ) \ break; \ \ diff --git a/lib/freetype/src/cache/ftccback.h b/lib/freetype/src/cache/ftccback.h index 4d0818db2..80ec9ce44 100644 --- a/lib/freetype/src/cache/ftccback.h +++ b/lib/freetype/src/cache/ftccback.h @@ -4,7 +4,7 @@ /* */ /* Callback functions of the caching sub-system (specification only). */ /* */ -/* Copyright 2004, 2005, 2006 by */ +/* Copyright 2004, 2005, 2006, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -57,13 +57,15 @@ FT_LOCAL( FT_Bool ) ftc_snode_compare( FTC_Node snode, FT_Pointer gquery, - FTC_Cache cache ); + FTC_Cache cache, + FT_Bool* list_changed ); FT_LOCAL( FT_Bool ) ftc_gnode_compare( FTC_Node gnode, FT_Pointer gquery, - FTC_Cache cache ); + FTC_Cache cache, + FT_Bool* list_changed ); FT_LOCAL( FT_Error ) diff --git a/lib/freetype/src/cache/ftccmap.c b/lib/freetype/src/cache/ftccmap.c index 15060baf7..b7bd2919d 100644 --- a/lib/freetype/src/cache/ftccmap.c +++ b/lib/freetype/src/cache/ftccmap.c @@ -5,7 +5,7 @@ /* FreeType CharMap cache (body) */ /* */ /* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* 2010, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -22,6 +22,7 @@ #include FT_CACHE_H #include "ftcmanag.h" #include FT_INTERNAL_MEMORY_H +#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H #include "ftccback.h" @@ -190,13 +191,16 @@ FT_CALLBACK_DEF( FT_Bool ) ftc_cmap_node_compare( FTC_Node ftcnode, FT_Pointer ftcquery, - FTC_Cache cache ) + FTC_Cache cache, + FT_Bool* list_changed ) { FTC_CMapNode node = (FTC_CMapNode)ftcnode; FTC_CMapQuery query = (FTC_CMapQuery)ftcquery; FT_UNUSED( cache ); + if ( list_changed ) + *list_changed = FALSE; if ( node->face_id == query->face_id && node->cmap_index == query->cmap_index ) { @@ -213,12 +217,16 @@ FT_CALLBACK_DEF( FT_Bool ) ftc_cmap_node_remove_faceid( FTC_Node ftcnode, FT_Pointer ftcface_id, - FTC_Cache cache ) + FTC_Cache cache, + FT_Bool* list_changed ) { FTC_CMapNode node = (FTC_CMapNode)ftcnode; FTC_FaceID face_id = (FTC_FaceID)ftcface_id; FT_UNUSED( cache ); + + if ( list_changed ) + *list_changed = FALSE; return FT_BOOL( node->face_id == face_id ); } diff --git a/lib/freetype/src/cache/ftcglyph.c b/lib/freetype/src/cache/ftcglyph.c index a73e2431e..441e17723 100644 --- a/lib/freetype/src/cache/ftcglyph.c +++ b/lib/freetype/src/cache/ftcglyph.c @@ -4,7 +4,7 @@ /* */ /* FreeType Glyph Image (FT_Glyph) cache (body). */ /* */ -/* Copyright 2000-2001, 2003, 2004, 2006, 2009 by */ +/* Copyright 2000-2001, 2003, 2004, 2006, 2009, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,6 +17,7 @@ #include <ft2build.h> +#include FT_INTERNAL_OBJECTS_H #include FT_CACHE_H #include "ftcglyph.h" #include FT_ERRORS_H @@ -64,25 +65,34 @@ FT_LOCAL_DEF( FT_Bool ) ftc_gnode_compare( FTC_Node ftcgnode, FT_Pointer ftcgquery, - FTC_Cache cache ) + FTC_Cache cache, + FT_Bool* list_changed ) { FTC_GNode gnode = (FTC_GNode)ftcgnode; FTC_GQuery gquery = (FTC_GQuery)ftcgquery; FT_UNUSED( cache ); + if ( list_changed ) + *list_changed = FALSE; return FT_BOOL( gnode->family == gquery->family && gnode->gindex == gquery->gindex ); } +#ifdef FTC_INLINE + FT_LOCAL_DEF( FT_Bool ) FTC_GNode_Compare( FTC_GNode gnode, - FTC_GQuery gquery ) + FTC_GQuery gquery, + FTC_Cache cache, + FT_Bool* list_changed ) { - return ftc_gnode_compare( FTC_NODE( gnode ), gquery, NULL ); + return ftc_gnode_compare( FTC_NODE( gnode ), gquery, + cache, list_changed ); } +#endif /*************************************************************************/ /*************************************************************************/ diff --git a/lib/freetype/src/cache/ftcglyph.h b/lib/freetype/src/cache/ftcglyph.h index 2bc5624c6..5fed19cb8 100644 --- a/lib/freetype/src/cache/ftcglyph.h +++ b/lib/freetype/src/cache/ftcglyph.h @@ -4,7 +4,7 @@ /* */ /* FreeType abstract glyph cache (specification). */ /* */ -/* Copyright 2000-2001, 2003, 2004, 2006, 2007 by */ +/* Copyright 2000-2001, 2003, 2004, 2006, 2007, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -180,12 +180,18 @@ FT_BEGIN_HEADER FT_UInt gindex, /* glyph index for node */ FTC_Family family ); +#ifdef FTC_INLINE + /* returns TRUE iff the query's glyph index correspond to the node; */ /* this assumes that the `family' and `hash' fields of the query are */ /* already correctly set */ FT_LOCAL( FT_Bool ) FTC_GNode_Compare( FTC_GNode gnode, - FTC_GQuery gquery ); + FTC_GQuery gquery, + FTC_Cache cache, + FT_Bool* list_changed ); + +#endif /* call this function to clear a node's family -- this is necessary */ /* to implement the `node_remove_faceid' cache method correctly */ @@ -307,7 +313,7 @@ FT_BEGIN_HEADER FT_BEGIN_STMNT \ \ error = FTC_GCache_Lookup( FTC_GCACHE( cache ), hash, gindex, \ - FTC_GQUERY( query ), node ); \ + FTC_GQUERY( query ), &node ); \ \ FT_END_STMNT diff --git a/lib/freetype/src/cache/ftcmanag.h b/lib/freetype/src/cache/ftcmanag.h index 13f26bb10..d6c85162a 100644 --- a/lib/freetype/src/cache/ftcmanag.h +++ b/lib/freetype/src/cache/ftcmanag.h @@ -4,7 +4,7 @@ /* */ /* FreeType Cache Manager (specification). */ /* */ -/* Copyright 2000-2001, 2003, 2004, 2006 by */ +/* Copyright 2000-2001, 2003, 2004, 2006, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/lib/freetype/src/cache/ftcmru.c b/lib/freetype/src/cache/ftcmru.c index 9944b5898..dc8b4cc39 100644 --- a/lib/freetype/src/cache/ftcmru.c +++ b/lib/freetype/src/cache/ftcmru.c @@ -161,7 +161,7 @@ *plist = NULL; } else if ( node == first ) - *plist = next; + *plist = next; } @@ -238,7 +238,7 @@ FTC_MruNode *anode ) { FT_Error error; - FTC_MruNode node; + FTC_MruNode node = NULL; FT_Memory memory = list->memory; @@ -264,14 +264,14 @@ list->clazz.node_done( node, list->data ); } else if ( FT_ALLOC( node, list->clazz.node_size ) ) - goto Exit; + goto Exit; error = list->clazz.node_init( node, key, list->data ); if ( error ) goto Fail; - FTC_MruNode_Prepend( &list->nodes, node ); - list->num_nodes++; + FTC_MruNode_Prepend( &list->nodes, node ); + list->num_nodes++; Exit: *anode = node; @@ -316,7 +316,7 @@ if ( list->clazz.node_done ) - list->clazz.node_done( node, list->data ); + list->clazz.node_done( node, list->data ); FT_FREE( node ); } diff --git a/lib/freetype/src/cache/ftcsbits.c b/lib/freetype/src/cache/ftcsbits.c index 83245af1e..8bf8d607e 100644 --- a/lib/freetype/src/cache/ftcsbits.c +++ b/lib/freetype/src/cache/ftcsbits.c @@ -4,7 +4,7 @@ /* */ /* FreeType sbits manager (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010 by */ +/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -217,6 +217,7 @@ FTC_SFamilyClass clazz = FTC_CACHE__SFAMILY_CLASS( cache ); FT_UInt total; + FT_UInt node_count; total = clazz->family_get_count( family, cache->manager ); @@ -239,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, @@ -319,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; @@ -328,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 ) @@ -368,7 +376,7 @@ * */ - if ( sbit->buffer == NULL && sbit->width != 255 ) + if ( sbit->buffer == NULL && sbit->width == 255 ) { FT_ULong size; FT_Error error; @@ -381,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 */ @@ -396,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 */ diff --git a/lib/freetype/src/cache/ftcsbits.h b/lib/freetype/src/cache/ftcsbits.h index 6261745f1..df55dca80 100644 --- a/lib/freetype/src/cache/ftcsbits.h +++ b/lib/freetype/src/cache/ftcsbits.h @@ -4,7 +4,7 @@ /* */ /* A small-bitmap cache (specification). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2006 by */ +/* Copyright 2000-2001, 2002, 2003, 2006, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -83,10 +83,15 @@ FT_BEGIN_HEADER #endif +#ifdef FTC_INLINE + FT_LOCAL( FT_Bool ) FTC_SNode_Compare( FTC_SNode snode, FTC_GQuery gquery, - FTC_Cache cache ); + FTC_Cache cache, + FT_Bool* list_changed); + +#endif /* */ |