Commit e566a961 authored by David Turner's avatar David Turner
Browse files

at last, the infamous cache bug is fixed !!

parent 687d32c0
......@@ -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
......
......@@ -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 );
......
......@@ -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:
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment