diff --git a/include/freetype/cache/ftccache.h b/include/freetype/cache/ftccache.h index 0a0e6ecd9..d45b223e8 100644 --- a/include/freetype/cache/ftccache.h +++ b/include/freetype/cache/ftccache.h @@ -21,7 +21,7 @@ /* define to allow cache lookup inlining */ -#undef FTC_CACHE_USE_INLINE +#define FTC_CACHE_USE_INLINE /* define to use linear hash table */ #define FTC_CACHE_USE_LINEAR_HASHING diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 41d285515..9fd37ee51 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -257,8 +257,8 @@ FT_BEGIN_HEADER /* */ /* Don't define any of these macros to compile in `release' mode! */ /* */ -#define FT_DEBUG_LEVEL_ERROR -#define FT_DEBUG_LEVEL_TRACE +#undef FT_DEBUG_LEVEL_ERROR +#undef FT_DEBUG_LEVEL_TRACE /*************************************************************************/ @@ -273,7 +273,7 @@ FT_BEGIN_HEADER /* Note that the memory debugger is only activated at runtime when */ /* when the _environment_ variable "FT_DEBUG_MEMORY" is also defined! */ /* */ -#define FT_DEBUG_MEMORY +#undef FT_DEBUG_MEMORY /*************************************************************************/ diff --git a/src/cache/ftccache.c b/src/cache/ftccache.c index 51522d573..d5bcf9275 100644 --- a/src/cache/ftccache.c +++ b/src/cache/ftccache.c @@ -23,10 +23,6 @@ #include "ftcerror.h" -/* define for level-1 optimisations */ -#undef OPT1 - - #ifdef FTC_CACHE_USE_LINEAR_HASHING @@ -75,7 +71,9 @@ if ( first ) { FTC_Node last = first->mru_prev; - + + FT_ASSERT( last->mru_next == first ); + node->mru_prev = last; node->mru_next = first; @@ -137,11 +135,12 @@ { FTC_Node prev = node->mru_prev; FTC_Node next = node->mru_next; - FTC_Node last = first->mru_prev; + FTC_Node last; prev->mru_next = next; next->mru_prev = prev; + last = first->mru_prev; node->mru_next = first; node->mru_prev = last; first->mru_prev = node; @@ -741,7 +740,8 @@ query->hash = 0; query->family = NULL; -#ifdef OPT1 + /* XXX: we break encapsulation for the sake of speed !! */ +#if 1 { /* first of all, find the relevant family */ FT_LruList list = cache->families; @@ -827,14 +827,9 @@ if ( node == NULL ) break; -#ifdef OPT1 if ( node->hash == hash && (FT_UInt)node->fam_index == family->fam_index && compare( node, query, cache ) ) -#else - if ( (FT_UInt)node->fam_index == family->fam_index && - compare( node, query, cache ) ) -#endif { /* move to head of bucket list */ if ( pnode != bucket ) diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c index f4ec779ff..8eb9a84f2 100644 --- a/src/cache/ftccmap.c +++ b/src/cache/ftccmap.c @@ -318,6 +318,23 @@ } +#ifdef FTC_CACHE_USE_INLINE + +# define GEN_CACHE_FAMILY_COMPARE(f,q,c) \ + ftc_cmap_family_compare( (FTC_CMapFamily)(f), (FTC_CMapQuery)(q) ) + +# define GEN_CACHE_NODE_COMPARE(n,q,c) \ + ftc_cmap_node_compare( (FTC_CMapNode)(n), (FTC_CMapQuery)(q) ) + +# define GEN_CACHE_LOOKUP ftc_cmap_cache_lookup +# include "ftccache.i" + +#else /* !FTC_CACHE_USE_INLINE */ + +# define ftc_cmap_cache_lookup ftc_cache_lookup + +#endif /* !FTC_CACHE_USE_INLINE */ + /* documentation is in ftccmap.h */ FT_EXPORT_DEF( FT_UInt ) @@ -340,9 +357,9 @@ cquery.desc = desc; cquery.char_code = char_code; - error = ftc_cache_lookup( FTC_CACHE( cache ), - FTC_QUERY( &cquery ), - (FTC_Node*)&node ); + error = ftc_cmap_cache_lookup( FTC_CACHE( cache ), + FTC_QUERY( &cquery ), + (FTC_Node*)&node ); if ( !error ) { FT_UInt offset = (FT_UInt)( char_code - node->first );