2003-12-24 14:37:58 +01:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* ftcglyph.c */
|
|
|
|
/* */
|
|
|
|
/* FreeType Glyph Image (FT_Glyph) cache (body). */
|
|
|
|
/* */
|
Fix callback functions in cache module.
* src/cache/ftccback.h: New file for callback declarations.
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Use FT_CALLBACK_DEF.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class):
Use FT_CALLBACK_TABLE_DEF and local wrapper functions.
* src/cache/ftccache.c: Include ftccback.h.
(ftc_cache_init, ftc_cache_done): New wrapper functions which use
FT_LOCAL_DEF.
* src/cache/ftccmap.c: Include ftccback.h.
(ftc_cmap_cache_class): Use local wrapper functions.
* src/cache/ftcglyph.c: Include ftccback.h.
(ftc_gnode_compare, ftc_gcache_init, ftc_gcache_done): New wrapper
functions which use FT_LOCAL_DEF.
* src/cache/ftcimage.c: Include ftccback.h.
(ftc_inode_free, ftc_inode_new, ftc_inode_weight): New wrapper
functions which use FT_LOCAL_DEF.
* src/cache/ftcmanag.c (ftc_size_list_class, ftc_face_list_class):
Use FT_CALLBACK_TABLE_DEF.
* src/cache;/ftcsbits.c: Include ftccback.h.
(ftc_snode_free, ftc_snode_new, ftc_snode_weight,
ftc_snode_compare): New wrapper functions which use FT_LOCAL_DEF.
* src/cache/rules.mk (CACHE_DRV_H): Add ftccback.h.
2004-02-17 19:41:58 +01:00
|
|
|
/* Copyright 2000-2001, 2003, 2004 by */
|
2003-12-24 14:37:58 +01:00
|
|
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
|
|
|
/* */
|
|
|
|
/* This file is part of the FreeType project, and may only be used, */
|
|
|
|
/* modified, and distributed under the terms of the FreeType project */
|
|
|
|
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
|
|
|
/* this file you indicate that you have read the license and */
|
|
|
|
/* understand and accept it fully. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_CACHE_H
|
|
|
|
#include FT_CACHE_INTERNAL_GLYPH_H
|
|
|
|
#include FT_ERRORS_H
|
|
|
|
#include FT_INTERNAL_OBJECTS_H
|
|
|
|
#include FT_INTERNAL_DEBUG_H
|
|
|
|
|
Fix callback functions in cache module.
* src/cache/ftccback.h: New file for callback declarations.
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Use FT_CALLBACK_DEF.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class):
Use FT_CALLBACK_TABLE_DEF and local wrapper functions.
* src/cache/ftccache.c: Include ftccback.h.
(ftc_cache_init, ftc_cache_done): New wrapper functions which use
FT_LOCAL_DEF.
* src/cache/ftccmap.c: Include ftccback.h.
(ftc_cmap_cache_class): Use local wrapper functions.
* src/cache/ftcglyph.c: Include ftccback.h.
(ftc_gnode_compare, ftc_gcache_init, ftc_gcache_done): New wrapper
functions which use FT_LOCAL_DEF.
* src/cache/ftcimage.c: Include ftccback.h.
(ftc_inode_free, ftc_inode_new, ftc_inode_weight): New wrapper
functions which use FT_LOCAL_DEF.
* src/cache/ftcmanag.c (ftc_size_list_class, ftc_face_list_class):
Use FT_CALLBACK_TABLE_DEF.
* src/cache;/ftcsbits.c: Include ftccback.h.
(ftc_snode_free, ftc_snode_new, ftc_snode_weight,
ftc_snode_compare): New wrapper functions which use FT_LOCAL_DEF.
* src/cache/rules.mk (CACHE_DRV_H): Add ftccback.h.
2004-02-17 19:41:58 +01:00
|
|
|
#include "ftccback.h"
|
2003-12-24 14:37:58 +01:00
|
|
|
#include "ftcerror.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* create a new chunk node, setting its cache index and ref count */
|
|
|
|
FT_EXPORT_DEF( void )
|
|
|
|
FTC_GNode_Init( FTC_GNode gnode,
|
|
|
|
FT_UInt gindex,
|
|
|
|
FTC_Family family )
|
|
|
|
{
|
|
|
|
gnode->family = family;
|
|
|
|
gnode->gindex = gindex;
|
|
|
|
family->num_nodes++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_EXPORT_DEF( void )
|
2003-12-26 08:26:08 +01:00
|
|
|
FTC_GNode_UnselectFamily( FTC_GNode gnode,
|
|
|
|
FTC_Cache cache )
|
2003-12-24 14:37:58 +01:00
|
|
|
{
|
|
|
|
FTC_Family family = gnode->family;
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
gnode->family = NULL;
|
|
|
|
if ( family && --family->num_nodes <= 0 )
|
2003-12-26 08:26:08 +01:00
|
|
|
FTC_MruList_Remove( &FTC_GCACHE( cache )->families,
|
|
|
|
(FTC_MruNode)family );
|
2003-12-24 14:37:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_EXPORT_DEF( void )
|
|
|
|
FTC_GNode_Done( FTC_GNode gnode,
|
|
|
|
FTC_Cache cache )
|
|
|
|
{
|
|
|
|
/* finalize the node */
|
|
|
|
gnode->gindex = 0;
|
|
|
|
|
|
|
|
FTC_GNode_UnselectFamily( gnode, cache );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_EXPORT_DEF( FT_Bool )
|
|
|
|
FTC_GNode_Compare( FTC_GNode gnode,
|
|
|
|
FTC_GQuery gquery )
|
|
|
|
{
|
|
|
|
return FT_BOOL( gnode->family == gquery->family &&
|
|
|
|
gnode->gindex == gquery->gindex );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Fix callback functions in cache module.
* src/cache/ftccback.h: New file for callback declarations.
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Use FT_CALLBACK_DEF.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class):
Use FT_CALLBACK_TABLE_DEF and local wrapper functions.
* src/cache/ftccache.c: Include ftccback.h.
(ftc_cache_init, ftc_cache_done): New wrapper functions which use
FT_LOCAL_DEF.
* src/cache/ftccmap.c: Include ftccback.h.
(ftc_cmap_cache_class): Use local wrapper functions.
* src/cache/ftcglyph.c: Include ftccback.h.
(ftc_gnode_compare, ftc_gcache_init, ftc_gcache_done): New wrapper
functions which use FT_LOCAL_DEF.
* src/cache/ftcimage.c: Include ftccback.h.
(ftc_inode_free, ftc_inode_new, ftc_inode_weight): New wrapper
functions which use FT_LOCAL_DEF.
* src/cache/ftcmanag.c (ftc_size_list_class, ftc_face_list_class):
Use FT_CALLBACK_TABLE_DEF.
* src/cache;/ftcsbits.c: Include ftccback.h.
(ftc_snode_free, ftc_snode_new, ftc_snode_weight,
ftc_snode_compare): New wrapper functions which use FT_LOCAL_DEF.
* src/cache/rules.mk (CACHE_DRV_H): Add ftccback.h.
2004-02-17 19:41:58 +01:00
|
|
|
FT_LOCAL_DEF( FT_Bool )
|
|
|
|
ftc_gnode_compare( FTC_GNode gnode,
|
|
|
|
FTC_GQuery gquery )
|
|
|
|
{
|
|
|
|
return FTC_GNode_Compare( gnode, gquery );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** CHUNK SETS *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
FT_EXPORT_DEF( void )
|
|
|
|
FTC_Family_Init( FTC_Family family,
|
|
|
|
FTC_Cache cache )
|
|
|
|
{
|
2003-12-26 08:26:08 +01:00
|
|
|
FTC_GCacheClass clazz = FTC_CACHE__GCACHE_CLASS( cache );
|
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
family->clazz = clazz->family_class;
|
|
|
|
family->num_nodes = 0;
|
|
|
|
family->cache = cache;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_EXPORT_DEF( FT_Error )
|
|
|
|
FTC_GCache_Init( FTC_GCache cache )
|
|
|
|
{
|
|
|
|
FT_Error error;
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
error = FTC_Cache_Init( FTC_CACHE( cache ) );
|
2003-12-24 14:37:58 +01:00
|
|
|
if ( !error )
|
|
|
|
{
|
2003-12-26 08:26:08 +01:00
|
|
|
FTC_GCacheClass clazz = (FTC_GCacheClass)FTC_CACHE( cache )->org_class;
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
FTC_MruList_Init( &cache->families,
|
|
|
|
clazz->family_class,
|
2003-12-26 08:26:08 +01:00
|
|
|
0, /* no maximum here! */
|
2003-12-24 14:37:58 +01:00
|
|
|
cache,
|
2003-12-26 08:26:08 +01:00
|
|
|
FTC_CACHE( cache )->memory );
|
2003-12-24 14:37:58 +01:00
|
|
|
}
|
2003-12-26 08:26:08 +01:00
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Fix callback functions in cache module.
* src/cache/ftccback.h: New file for callback declarations.
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Use FT_CALLBACK_DEF.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class):
Use FT_CALLBACK_TABLE_DEF and local wrapper functions.
* src/cache/ftccache.c: Include ftccback.h.
(ftc_cache_init, ftc_cache_done): New wrapper functions which use
FT_LOCAL_DEF.
* src/cache/ftccmap.c: Include ftccback.h.
(ftc_cmap_cache_class): Use local wrapper functions.
* src/cache/ftcglyph.c: Include ftccback.h.
(ftc_gnode_compare, ftc_gcache_init, ftc_gcache_done): New wrapper
functions which use FT_LOCAL_DEF.
* src/cache/ftcimage.c: Include ftccback.h.
(ftc_inode_free, ftc_inode_new, ftc_inode_weight): New wrapper
functions which use FT_LOCAL_DEF.
* src/cache/ftcmanag.c (ftc_size_list_class, ftc_face_list_class):
Use FT_CALLBACK_TABLE_DEF.
* src/cache;/ftcsbits.c: Include ftccback.h.
(ftc_snode_free, ftc_snode_new, ftc_snode_weight,
ftc_snode_compare): New wrapper functions which use FT_LOCAL_DEF.
* src/cache/rules.mk (CACHE_DRV_H): Add ftccback.h.
2004-02-17 19:41:58 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
|
|
|
ftc_gcache_init( FTC_GCache cache )
|
|
|
|
{
|
|
|
|
return FTC_GCache_Init( cache );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
FT_EXPORT_DEF( void )
|
|
|
|
FTC_GCache_Done( FTC_GCache cache )
|
|
|
|
{
|
|
|
|
FTC_Cache_Done( (FTC_Cache)cache );
|
|
|
|
FTC_MruList_Done( &cache->families );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Fix callback functions in cache module.
* src/cache/ftccback.h: New file for callback declarations.
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Use FT_CALLBACK_DEF.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class):
Use FT_CALLBACK_TABLE_DEF and local wrapper functions.
* src/cache/ftccache.c: Include ftccback.h.
(ftc_cache_init, ftc_cache_done): New wrapper functions which use
FT_LOCAL_DEF.
* src/cache/ftccmap.c: Include ftccback.h.
(ftc_cmap_cache_class): Use local wrapper functions.
* src/cache/ftcglyph.c: Include ftccback.h.
(ftc_gnode_compare, ftc_gcache_init, ftc_gcache_done): New wrapper
functions which use FT_LOCAL_DEF.
* src/cache/ftcimage.c: Include ftccback.h.
(ftc_inode_free, ftc_inode_new, ftc_inode_weight): New wrapper
functions which use FT_LOCAL_DEF.
* src/cache/ftcmanag.c (ftc_size_list_class, ftc_face_list_class):
Use FT_CALLBACK_TABLE_DEF.
* src/cache;/ftcsbits.c: Include ftccback.h.
(ftc_snode_free, ftc_snode_new, ftc_snode_weight,
ftc_snode_compare): New wrapper functions which use FT_LOCAL_DEF.
* src/cache/rules.mk (CACHE_DRV_H): Add ftccback.h.
2004-02-17 19:41:58 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
|
|
|
ftc_gcache_done( FTC_GCache cache )
|
|
|
|
{
|
|
|
|
FTC_GCache_Done( cache );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
FT_EXPORT_DEF( FT_Error )
|
|
|
|
FTC_GCache_New( FTC_Manager manager,
|
|
|
|
FTC_GCacheClass clazz,
|
|
|
|
FTC_GCache *acache )
|
|
|
|
{
|
2003-12-26 08:26:08 +01:00
|
|
|
return FTC_Manager_RegisterCache( manager, (FTC_CacheClass)clazz,
|
|
|
|
(FTC_Cache*)acache );
|
2003-12-24 14:37:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_EXPORT_DEF( FT_Error )
|
|
|
|
FTC_GCache_Lookup( FTC_GCache cache,
|
|
|
|
FT_UInt32 hash,
|
|
|
|
FT_UInt gindex,
|
|
|
|
FTC_GQuery query,
|
|
|
|
FTC_Node *anode )
|
|
|
|
{
|
2003-12-26 08:26:08 +01:00
|
|
|
FT_Error error;
|
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
query->gindex = gindex;
|
|
|
|
|
|
|
|
FTC_MRULIST_LOOKUP( &cache->families, query, query->family, error );
|
|
|
|
if ( !error )
|
2003-12-26 08:26:08 +01:00
|
|
|
error = FTC_Cache_Lookup( FTC_CACHE( cache ), hash, query, anode );
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* END */
|