at last, the infamous cache bug is fixed !!

This commit is contained in:
David Turner 2000-10-31 10:58:23 +00:00
parent d1896124dd
commit 2909475716
4 changed files with 17 additions and 17 deletions

16
src/cache/ftcchunk.c vendored
View File

@ -44,12 +44,12 @@
FT_Error error = 0;
data->cache_index = (FT_UShort) cache->root.cache_index;
data->ref_count = (FT_Short) 0;
node->cset_index = (FT_UShort) index;
node->num_elements = (index+1 < cset->element_count)
? cset->element_count * cset->element_size
data->cache_index = (FT_UShort) cache->root.cache_index;
data->ref_count = (FT_Short) 0;
node->cset = cset;
node->cset_index = (FT_UShort) index;
node->num_elements = (index+1 < cset->num_chunks)
? cset->element_count
: cset->element_max - cset->element_count*index;
if (alloc)
{
@ -227,7 +227,7 @@
if (!node)
{
/* we didn't found the glyph image, we will now create a new one */
error = clazz->new_node( cset, glyph_index, &node );
error = clazz->new_node( cset, chunk_index, &node );
if ( error )
goto Exit;
@ -267,7 +267,7 @@
#define FTC_CSET_LRU_GET_CACHE( lru ) \
( (FTC_Chunk_Cache)(lru)->user_data )
( (FTC_Chunk_Cache)((lru)->user_data) )
#define FTC_CSET_LRU_GET_MANAGER( lru ) \
FTC_CSET_LRU_GET_CACHE( lru )->manager

View File

@ -464,6 +464,10 @@
cache->manager = manager;
cache->memory = memory;
cache->clazz = clazz;
/* THIS IS VERY IMPORTANT, THIS WILL WRECH THE MANAGER */
/* IF IT IS NOT SET CORRECTLY.. */
cache->cache_index = index;
if ( clazz->init_cache )
error = clazz->init_cache( cache );

12
src/cache/ftcsbits.c vendored
View File

@ -262,7 +262,7 @@
/* lookup the FT_Face to obtain the number of glyphs */
error = FTC_Manager_Lookup_Face( cset->manager,
&desc->font, &face );
desc->font.face_id, &face );
if (!error)
cset->element_max = face->num_glyphs;
@ -290,7 +290,7 @@
FT_CPLUSPLUS( const FTC_ChunkSet_Class ) ftc_sbit_chunk_set_class =
{
sizeof( FTC_ImageSetRec ),
sizeof( FTC_SBitSetRec ),
(FTC_ChunkSet_InitFunc) ftc_sbit_chunk_set_init,
(FTC_ChunkSet_DoneFunc) 0,
@ -381,13 +381,7 @@
FTC_ChunkNode_Unref ( node );
}
sbit = ((FTC_SBit)((FTC_ChunkNode)node)->elements) + cindex;
if (sbit->buffer == 0)
{
/* the glyph was missing, we return a NULL pointer !! */
sbit = 0;
}
sbit = ((FTC_SBit)((FTC_ChunkNode)node)->elements) + cindex;
*asbit = sbit;
Exit:

2
src/cache/rules.mk vendored
View File

@ -31,6 +31,8 @@ Cache_COMPILE := $(FT_COMPILE)
Cache_DRV_SRC := $(CACHE_DIR_)ftlru.c \
$(CACHE_DIR_)ftcmanag.c \
$(CACHE_DIR_)ftcglyph.c \
$(CACHE_DIR_)ftcchunk.c \
$(CACHE_DIR_)ftcsbits.c \
$(CACHE_DIR_)ftcimage.c
# Cache driver headers