diff --git a/ChangeLog b/ChangeLog index 6fdcc8fe8..22ec16f81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,23 @@ +2005-10-13 David Turner + + * include/freetype/cache/ftcmanag.h, src/cache/ftcint.h, + src/cache/ftcbasic.c, src/cache/ftccmap.c, src/cache/ftccache.c, + src/cache/ftcglyph.c, src/cache/ftcimage.c, src/cache/ftcmanag.c, + src/cache/ftcmru.c, src/cache/ftcsbits.c, src/cache/rules.mk: + + make various fields of the @FTC_ManagerRec structure private, i.e. + un-accessible from client applications, introducing the new private + "src/cache/ftcint.h" header + + * include/freetype/cache/ftcmru.h, src/cache/ftcmru.c: implement + the new convenience function FTC_MruList_RemoveOldest() + 2005-09-21 David Turner - * massive redesign of the cache sub-system internals. - in order to simplify the code and even slightly improve - performance (ftbench shows a 3% improvements in the SBit - and Image caches) + * massive redesign of the cache sub-system internals. + in order to simplify the code and even slightly improve + performance (ftbench shows a 3% improvements in the SBit + and Image caches) 2005-09-19 David Somers @@ -417,7 +431,7 @@ 2005-07-04 Werner Lemberg - * include/freetype/internal/ftmemory.h (FT_REALLOC_ARRAY): Fix typo. + * include/freetype/internal/ftmemory.h (FT_REALLOC_ARRAY): Fix typo. Reported by Brett Hutley. 2005-06-30 David Turner diff --git a/include/freetype/cache/ftcmanag.h b/include/freetype/cache/ftcmanag.h index 526584822..f1704c620 100644 --- a/include/freetype/cache/ftcmanag.h +++ b/include/freetype/cache/ftcmanag.h @@ -79,33 +79,19 @@ FT_BEGIN_HEADER /* */ /*************************************************************************/ - -#define FTC_MAX_FACES_DEFAULT 2 -#define FTC_MAX_SIZES_DEFAULT 4 -#define FTC_MAX_BYTES_DEFAULT 200000L /* ~200kByte by default */ - - /* maximum number of caches registered in a single manager */ -#define FTC_MAX_CACHES 16 - +#ifndef FTC_MANAGER_PRIVATE +#define FTC_MANAGER_PRIVATE +#endif typedef struct FTC_ManagerRec_ { FT_Library library; FT_Memory memory; - FTC_Node nodes_list; - FT_ULong max_weight; - FT_ULong cur_weight; - FT_UInt num_nodes; - - FTC_Cache caches[FTC_MAX_CACHES]; - FT_UInt num_caches; - - FTC_MruListRec faces; - FTC_MruListRec sizes; + FT_UInt num_nodes; /* only used for statistics */ + FT_ULong cur_weight; /* only used for statistics */ - FT_Pointer request_data; - FTC_Face_Requester request_face; + FTC_MANAGER_PRIVATE } FTC_ManagerRec; @@ -135,15 +121,16 @@ FT_BEGIN_HEADER FTC_Manager_Compress( FTC_Manager manager ); - /* try to flush `count' old nodes from the cache; return the number - * of really flushed nodes - */ + /* try to flush `count' old nodes from the cache; return the number + * of really flushed nodes + */ FT_EXPORT( FT_UInt ) FTC_Manager_FlushN( FTC_Manager manager, FT_UInt count ); - /* this must be used internally for the moment */ + /* this must be used internally for the moment + */ FT_EXPORT( FT_Error ) FTC_Manager_RegisterCache( FTC_Manager manager, FTC_CacheClass clazz, diff --git a/include/freetype/cache/ftcmru.h b/include/freetype/cache/ftcmru.h index 5638a7283..f8f713220 100644 --- a/include/freetype/cache/ftcmru.h +++ b/include/freetype/cache/ftcmru.h @@ -171,6 +171,10 @@ FT_BEGIN_HEADER FTC_MruList_Remove( FTC_MruList list, FTC_MruNode node ); + FT_EXPORT( void ) + FTC_MruList_RemoveOldest( FTC_MruList list ); + + FT_EXPORT( void ) FTC_MruList_RemoveSelection( FTC_MruList list, FTC_MruNode_EqualFunc selection, diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c index efc9ecf29..6a5d0e6fd 100644 --- a/src/cache/ftcbasic.c +++ b/src/cache/ftcbasic.c @@ -16,8 +16,7 @@ /***************************************************************************/ -#include -#include FT_CACHE_H +#include "ftcint.h" #include FT_CACHE_INTERNAL_GLYPH_H #include FT_CACHE_INTERNAL_IMAGE_H #include FT_CACHE_INTERNAL_SBITS_H diff --git a/src/cache/ftccache.c b/src/cache/ftccache.c index abc6f1e3e..793bfefb0 100644 --- a/src/cache/ftccache.c +++ b/src/cache/ftccache.c @@ -16,8 +16,7 @@ /***************************************************************************/ -#include -#include FT_CACHE_INTERNAL_MANAGER_H +#include "ftcint.h" #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c index d0b0b2174..0accb84ac 100644 --- a/src/cache/ftccmap.c +++ b/src/cache/ftccmap.c @@ -15,11 +15,7 @@ /* */ /***************************************************************************/ - -#include -#include FT_FREETYPE_H -#include FT_CACHE_H -#include FT_CACHE_INTERNAL_MANAGER_H +#include "ftcint.h" #include FT_INTERNAL_MEMORY_H #include FT_INTERNAL_DEBUG_H #include FT_TRUETYPE_IDS_H diff --git a/src/cache/ftcglyph.c b/src/cache/ftcglyph.c index a0ea46aaa..40d066678 100644 --- a/src/cache/ftcglyph.c +++ b/src/cache/ftcglyph.c @@ -16,8 +16,7 @@ /***************************************************************************/ -#include -#include FT_CACHE_H +#include "ftcint.h" #include FT_CACHE_INTERNAL_GLYPH_H #include FT_ERRORS_H #include FT_INTERNAL_OBJECTS_H diff --git a/src/cache/ftcimage.c b/src/cache/ftcimage.c index b7d6cdfcb..f60b92719 100644 --- a/src/cache/ftcimage.c +++ b/src/cache/ftcimage.c @@ -15,9 +15,7 @@ /* */ /***************************************************************************/ - -#include -#include FT_CACHE_H +#include "ftcint.h" #include FT_CACHE_INTERNAL_IMAGE_H #include FT_INTERNAL_MEMORY_H @@ -67,7 +65,7 @@ /* we will now load the glyph image */ error = clazz->fam_load_glyph( family, gindex, - FTC_CACHE__MANAGER(cache), + FTC_CACHE__MANAGER(cache), &inode->glyph ); if ( error ) { diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c index 356e42718..70b0b3519 100644 --- a/src/cache/ftcmanag.c +++ b/src/cache/ftcmanag.c @@ -15,10 +15,7 @@ /* */ /***************************************************************************/ - -#include -#include FT_CACHE_H -#include FT_CACHE_INTERNAL_MANAGER_H +#include "ftcint.h" #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H #include FT_SIZES_H @@ -26,6 +23,15 @@ #include "ftcerror.h" + FT_EXPORT_DEF( void ) + _ftc_manager_get_debug_info( FTC_Manager manager, + FT_UInt *p_num_caches, + FT_UInt *p_num_nodes, + FT_ULong *p_cur_weight ) + { + } + + #undef FT_COMPONENT #define FT_COMPONENT trace_cache diff --git a/src/cache/ftcmru.c b/src/cache/ftcmru.c index a455848c5..b7bb1f1f3 100644 --- a/src/cache/ftcmru.c +++ b/src/cache/ftcmru.c @@ -15,9 +15,7 @@ /* */ /***************************************************************************/ - -#include -#include FT_CACHE_H +#include "ftcint.h" #include FT_CACHE_INTERNAL_MRU_H #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H @@ -321,6 +319,14 @@ } + FT_EXPORT_DEF( void ) + FTC_MruList_RemoveOldest( FTC_MruList list ) + { + if ( list && list->nodes ) + FTC_MruList_Remove( list, list->nodes->prev ); + } + + FT_EXPORT_DEF( void ) FTC_MruList_RemoveSelection( FTC_MruList list, FTC_MruNode_EqualFunc selection, diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c index 4e8922ab0..54f044404 100644 --- a/src/cache/ftcsbits.c +++ b/src/cache/ftcsbits.c @@ -15,9 +15,7 @@ /* */ /***************************************************************************/ - -#include -#include FT_CACHE_H +#include "ftcint.h" #include FT_CACHE_INTERNAL_SBITS_H #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H diff --git a/src/cache/rules.mk b/src/cache/rules.mk index 381104ad6..9d22611e7 100644 --- a/src/cache/rules.mk +++ b/src/cache/rules.mk @@ -42,6 +42,7 @@ CACHE_DRV_H := $(CACHE_H_DIR)/ftcmru.h \ $(CACHE_H_DIR)/ftcimage.h \ $(CACHE_H_DIR)/ftccmap.h \ $(CACHE_DIR)/ftcerror.h \ + $(CACHE_DIR)/ftcint.h \ $(CACHE_DIR)/ftccback.h