22#include FT_INTERNAL_OBJECTS_H
23#include FT_INTERNAL_DEBUG_H
29#ifdef FT_CONFIG_OPTION_PIC
30#error "cache system does not support PIC yet"
35#define FT_COMPONENT trace_cache
86#define FTC_SIZE_NODE( x ) ( (FTC_SizeNode)( x ) )
131 node->scaler = scaler[0];
149 node->scaler = scaler[0];
191 if ( !asize || !scaler )
192 return FT_THROW( Invalid_Argument );
197 return FT_THROW( Invalid_Cache_Handle );
205 error = FTC_MruList_Lookup( &manager->sizes, scaler, &mrunode );
231#define FTC_FACE_NODE( x ) ( ( FTC_FaceNode )( x ) )
245 node->face_id = face_id;
254 if (
node->face->size )
319 return FT_THROW( Invalid_Argument );
324 return FT_THROW( Invalid_Cache_Handle );
333 error = FTC_MruList_Lookup( &manager->faces, face_id, &mrunode );
369 return FT_THROW( Invalid_Library_Handle );
371 if ( !amanager || !requester )
372 return FT_THROW( Invalid_Argument );
379 if ( max_faces == 0 )
382 if ( max_sizes == 0 )
385 if ( max_bytes == 0 )
423 if ( !manager || !manager->library )
429 for (
idx = manager->num_caches;
idx-- > 0; )
441 manager->num_caches = 0;
447 manager->library =
NULL;
448 manager->memory =
NULL;
493 FT_TRACE0((
"FTC_Manager_Check: invalid node (cache index = %ld\n",
494 node->cache_index ));
503 FT_TRACE0((
"FTC_Manager_Check: invalid weight %ld instead of %ld\n",
523 " invalid cache node count %d instead of %d\n",
546 first = manager->nodes_list;
549 FTC_Manager_Check( manager );
551 FT_TRACE0((
"compressing, weight = %ld, max = %ld, nodes = %d\n",
552 manager->cur_weight, manager->max_weight,
553 manager->num_nodes ));
556 if ( manager->cur_weight < manager->max_weight || !
first )
568 if (
node->ref_count <= 0 )
573 }
while (
node && manager->cur_weight > manager->max_weight );
588 if ( manager && clazz && acache )
596 FT_ERROR((
"FTC_Manager_RegisterCache:"
597 " too many registered caches\n" ));
603 cache->manager = manager;
605 cache->clazz = clazz[0];
606 cache->org_class = clazz;
610 cache->index = manager->num_caches;
615 clazz->cache_done(
cache );
620 manager->caches[manager->num_caches++] =
cache;
652 if (
node->ref_count <= 0 )
686 for ( nn = 0; nn < manager->num_caches; nn++ )
FT_Set_Pixel_Sizes(FT_Face face, FT_UInt pixel_width, FT_UInt pixel_height)
FT_Done_Face(FT_Face face)
FT_Set_Char_Size(FT_Face face, FT_F26Dot6 char_width, FT_F26Dot6 char_height, FT_UInt horz_resolution, FT_UInt vert_resolution)
FT_Error(* FTC_Face_Requester)(FTC_FaceID face_id, FT_Library library, FT_Pointer req_data, FT_Face *aface)
FT_BEGIN_HEADER typedef FT_Pointer FTC_FaceID
struct FTC_ScalerRec_ * FTC_Scaler
struct FTC_ManagerRec_ * FTC_Manager
ftc_node_destroy(FTC_Node node, FTC_Manager manager)
FTC_Cache_RemoveFaceID(FTC_Cache cache, FTC_FaceID face_id)
FTC_Manager_RegisterCache(FTC_Manager manager, FTC_CacheClass clazz, FTC_Cache *acache)
ftc_face_node_done(FTC_MruNode ftcnode, FT_Pointer ftcmanager)
FTC_Manager_Done(FTC_Manager manager)
ftc_size_node_done(FTC_MruNode ftcnode, FT_Pointer data)
struct FTC_FaceNodeRec_ * FTC_FaceNode
struct FTC_FaceNodeRec_ FTC_FaceNodeRec
static const FTC_MruListClassRec ftc_size_list_class
static const FTC_MruListClassRec ftc_face_list_class
FTC_Manager_RemoveFaceID(FTC_Manager manager, FTC_FaceID face_id)
static FT_Bool ftc_size_node_compare_faceid(FTC_MruNode ftcnode, FT_Pointer ftcface_id)
struct FTC_SizeNodeRec_ FTC_SizeNodeRec
FTC_Manager_LookupFace(FTC_Manager manager, FTC_FaceID face_id, FT_Face *aface)
FTC_Manager_Compress(FTC_Manager manager)
FTC_Node_Unref(FTC_Node node, FTC_Manager manager)
FTC_Manager_Reset(FTC_Manager manager)
FTC_Manager_FlushN(FTC_Manager manager, FT_UInt count)
ftc_size_node_reset(FTC_MruNode ftcnode, FT_Pointer ftcscaler, FT_Pointer ftcmanager)
struct FTC_SizeNodeRec_ * FTC_SizeNode
ftc_size_node_compare(FTC_MruNode ftcnode, FT_Pointer ftcscaler)
ftc_face_node_compare(FTC_MruNode ftcnode, FT_Pointer ftcface_id)
static FT_Error ftc_scaler_lookup_size(FTC_Manager manager, FTC_Scaler scaler, FT_Size *asize)
ftc_size_node_init(FTC_MruNode ftcnode, FT_Pointer ftcscaler, FT_Pointer ftcmanager)
FTC_Manager_LookupSize(FTC_Manager manager, FTC_Scaler scaler, FT_Size *asize)
FTC_Manager_New(FT_Library library, FT_UInt max_faces, FT_UInt max_sizes, FT_ULong max_bytes, FTC_Face_Requester requester, FT_Pointer req_data, FTC_Manager *amanager)
ftc_face_node_init(FTC_MruNode ftcnode, FT_Pointer ftcface_id, FT_Pointer ftcmanager)
#define FTC_MAX_BYTES_DEFAULT
#define FTC_MAX_SIZES_DEFAULT
#define FTC_SCALER_COMPARE(a, b)
#define FTC_MAX_FACES_DEFAULT
FTC_MruList_Reset(FTC_MruList list)
FTC_MruList_Done(FTC_MruList list)
FTC_MruList_Init(FTC_MruList list, FTC_MruListClass clazz, FT_UInt max_nodes, FT_Pointer data, FT_Memory memory)
FTC_MruList_RemoveSelection(FTC_MruList list, FTC_MruNode_CompareFunc selection, FT_Pointer key)
#define FTC_MRULIST_LOOKUP_CMP(list, key, compare, node, error)
typedefFT_BEGIN_HEADER struct FTC_MruNodeRec_ * FTC_MruNode
#define FT_CALLBACK_DEF(x)
#define FT_TRACE0(varformat)
#define FT_ERROR(varformat)
#define FT_ALLOC(ptr, size)
FT_Done_Size(FT_Size size)
FT_Activate_Size(FT_Size size)
FT_BEGIN_HEADER FT_New_Size(FT_Face face, FT_Size *size)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
FT_BEGIN_HEADER typedef unsigned char FT_Bool
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum GLuint GLint GLenum face
static char memory[1024 *256]
FTC_Cache caches[FTC_MAX_CACHES]
FTC_Face_Requester request_face