ref: 2909475716950301bf1e098a0a2d175521ed6250
parent: d1896124dd21f6ab33049e395acc7a961e83b90b
author: David Turner <[email protected]>
date: Tue Oct 31 05:58:23 EST 2000
at last, the infamous cache bug is fixed !!
--- a/src/cache/ftcchunk.c
+++ b/src/cache/ftcchunk.c
@@ -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
--- a/src/cache/ftcmanag.c
+++ b/src/cache/ftcmanag.c
@@ -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 );
--- a/src/cache/ftcsbits.c
+++ b/src/cache/ftcsbits.c
@@ -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:
--- a/src/cache/rules.mk
+++ b/src/cache/rules.mk
@@ -31,6 +31,8 @@
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