changed the FTC_Manager_New function to accept "max_faces" and
"max_sizes" parameters fixed some bugs. the cache manager is now tested and validated (now, it's time for the glyph image cache)
This commit is contained in:
parent
4a47f668a1
commit
98d2701c58
|
@ -154,6 +154,12 @@
|
|||
* <Input>
|
||||
* library :: the parent FreeType library handle to use
|
||||
*
|
||||
* max_faces :: maximum number of faces to keep alive in manager
|
||||
* use 0 for defaults
|
||||
*
|
||||
* max_sizes :: maximum number of sizes to keep alive in manager
|
||||
* use 0 for defaults
|
||||
*
|
||||
* requester :: an application-provided callback used to translate
|
||||
* face IDs into real FT_Face objects
|
||||
*
|
||||
|
@ -169,6 +175,8 @@
|
|||
**************************************************************************/
|
||||
|
||||
FT_EXPORT_DEF( FT_Error ) FTC_Manager_New( FT_Library library,
|
||||
FT_UInt max_faces,
|
||||
FT_UInt max_sizes,
|
||||
FTC_Face_Requester requester,
|
||||
FT_Pointer req_data,
|
||||
FTC_Manager* amanager );
|
||||
|
|
|
@ -104,15 +104,17 @@
|
|||
FTC_SizeRequest* size_req = (FTC_SizeRequest*)node->key;
|
||||
FT_Size size;
|
||||
FT_Error error;
|
||||
FT_Face face = size_req->face;
|
||||
|
||||
FT_UNUSED( lru );
|
||||
|
||||
|
||||
node->root.data = 0;
|
||||
error = FT_New_Size( size_req->face, &size );
|
||||
error = FT_New_Size( face, &size );
|
||||
if ( !error )
|
||||
{
|
||||
error = FT_Set_Pixel_Sizes( size_req->face,
|
||||
face->size = size;
|
||||
error = FT_Set_Pixel_Sizes( face,
|
||||
size_req->width,
|
||||
size_req->height );
|
||||
if ( error )
|
||||
|
@ -200,6 +202,8 @@
|
|||
|
||||
|
||||
FT_EXPORT_FUNC( FT_Error ) FTC_Manager_New( FT_Library library,
|
||||
FT_UInt max_faces,
|
||||
FT_UInt max_sizes,
|
||||
FTC_Face_Requester requester,
|
||||
FT_Pointer req_data,
|
||||
FTC_Manager* amanager )
|
||||
|
@ -211,9 +215,15 @@
|
|||
|
||||
if ( ALLOC( manager, sizeof ( *manager ) ) )
|
||||
goto Exit;
|
||||
|
||||
if (max_faces == 0)
|
||||
max_faces = FTC_MAX_FACES;
|
||||
|
||||
if (max_sizes == 0)
|
||||
max_sizes = FTC_MAX_SIZES;
|
||||
|
||||
error = FT_Lru_New( &ftc_face_lru_class,
|
||||
FTC_MAX_FACES,
|
||||
max_faces,
|
||||
manager,
|
||||
memory,
|
||||
1, /* pre_alloc = TRUE */
|
||||
|
@ -222,7 +232,7 @@
|
|||
goto Exit;
|
||||
|
||||
error = FT_Lru_New( &ftc_size_lru_class,
|
||||
FTC_MAX_SIZES,
|
||||
max_sizes,
|
||||
manager,
|
||||
memory,
|
||||
1, /* pre_alloc = TRUE */
|
||||
|
|
|
@ -159,6 +159,7 @@
|
|||
|
||||
node = lru->elements.tail;
|
||||
lru_node = (FT_LruNode)node;
|
||||
found = lru_node;
|
||||
|
||||
if ( clazz->flush_element )
|
||||
error = clazz->flush_element( lru, lru_node, key );
|
||||
|
@ -185,6 +186,8 @@
|
|||
FT_List_Insert( &lru->free_nodes, node );
|
||||
else
|
||||
FREE( lru_node );
|
||||
|
||||
found = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue