forked from minhngoc25a/freetype2
* src/cache/ftcmanag.c (FTC_Manager_Reset): add missing cache flush
* src/cache/ftcback.h, src/cache/rules.mk: removed obsolete ftcback.h which was revived by the merge operation (blooody cvs) * src/cache/ftcsbit.c: using FTC_RETRY_LOOP ... FTC_RETRY_END
This commit is contained in:
parent
5944eff19d
commit
9876e59533
|
@ -23,6 +23,13 @@
|
|||
|
||||
* MANY FILES... Mergin with main branch (HEAD)
|
||||
|
||||
* src/cache/ftcmanag.c (FTC_Manager_Reset): add missing cache flush
|
||||
|
||||
* src/cache/ftcback.h, src/cache/rules.mk: removed obsolete ftcback.h
|
||||
which was revived by the merge operation (blooody cvs)
|
||||
|
||||
* src/cache/ftcsbit.c: using FTC_RETRY_LOOP ... FTC_RETRY_END
|
||||
|
||||
2005-09-21 David Turner <david@freetype.org>
|
||||
|
||||
* massive redesign of the cache sub-system internals.
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftccback.h */
|
||||
/* */
|
||||
/* Callback functions of the caching sub-system (specification only). */
|
||||
/* */
|
||||
/* Copyright 2004 by */
|
||||
/* 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
#ifndef __FTCCBACK_H__
|
||||
#define __FTCCBACK_H__
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_CACHE_H
|
||||
#include FT_CACHE_INTERNAL_MRU_H
|
||||
#include FT_CACHE_INTERNAL_IMAGE_H
|
||||
#include FT_CACHE_INTERNAL_MANAGER_H
|
||||
#include FT_CACHE_INTERNAL_GLYPH_H
|
||||
#include FT_CACHE_INTERNAL_SBITS_H
|
||||
|
||||
|
||||
FT_LOCAL( void )
|
||||
ftc_inode_free( FTC_Node inode,
|
||||
FTC_Cache cache );
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
ftc_inode_new( FTC_Node *pinode,
|
||||
FT_Pointer gquery,
|
||||
FTC_Cache cache );
|
||||
|
||||
FT_LOCAL( FT_ULong )
|
||||
ftc_inode_weight( FTC_Node inode,
|
||||
FTC_Cache cache );
|
||||
|
||||
|
||||
FT_LOCAL( void )
|
||||
ftc_snode_free( FTC_Node snode,
|
||||
FTC_Cache cache );
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
ftc_snode_new( FTC_Node *psnode,
|
||||
FT_Pointer gquery,
|
||||
FTC_Cache cache );
|
||||
|
||||
FT_LOCAL( FT_ULong )
|
||||
ftc_snode_weight( FTC_Node snode,
|
||||
FTC_Cache cache );
|
||||
|
||||
FT_LOCAL( FT_Bool )
|
||||
ftc_snode_compare( FTC_Node snode,
|
||||
FT_Pointer gquery,
|
||||
FTC_Cache cache );
|
||||
|
||||
|
||||
FT_LOCAL( FT_Bool )
|
||||
ftc_gnode_compare( FTC_Node gnode,
|
||||
FT_Pointer gquery,
|
||||
FTC_Cache cache );
|
||||
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
ftc_gcache_init( FTC_Cache cache );
|
||||
|
||||
FT_LOCAL( void )
|
||||
ftc_gcache_done( FTC_Cache cache );
|
||||
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
ftc_cache_init( FTC_Cache cache );
|
||||
|
||||
FT_LOCAL( void )
|
||||
ftc_cache_done( FTC_Cache cache );
|
||||
|
||||
|
||||
#endif /* __FTCCBACK_H__ */
|
||||
|
||||
/* END */
|
|
@ -444,7 +444,7 @@
|
|||
FTC_MruList_Reset( &manager->sizes );
|
||||
FTC_MruList_Reset( &manager->faces );
|
||||
}
|
||||
/* XXX: FIXME: flush the caches? */
|
||||
FTC_Manager_FlushN( manager, manager->num_nodes );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -288,38 +288,6 @@
|
|||
FTC_SBit sbit = snode->sbits + ( gindex - gnode->gindex );
|
||||
|
||||
|
||||
/*
|
||||
* The following code illustrates what to do when you want to
|
||||
* perform operations that may fail within a lookup function.
|
||||
*
|
||||
* Here, we want to load a small bitmap on-demand; we thus
|
||||
* need to call the `ftc_snode_load' function which may return
|
||||
* a non-zero error code only when we are out of memory (OOM).
|
||||
*
|
||||
* The correct thing to do is to use @FTC_CACHE_TRYLOOP and
|
||||
* @FTC_CACHE_TRYLOOP_END in order to implement a retry loop
|
||||
* that is capable of flushing the cache incrementally when
|
||||
* an OOM errors occur.
|
||||
*
|
||||
* However, we need to `lock' the node before this operation to
|
||||
* prevent it from being flushed within the loop.
|
||||
*
|
||||
* When we exit the loop, we unlock the node, then check the `error'
|
||||
* variable. If it is non-zero, this means that the cache was
|
||||
* completely flushed and that no usable memory was found to load
|
||||
* the bitmap.
|
||||
*
|
||||
* We then prefer to return a value of 0 (i.e., NO MATCH). This
|
||||
* ensures that the caller will try to allocate a new node.
|
||||
* This operation consequently _fail_ and the lookup function
|
||||
* returns the appropriate OOM error code.
|
||||
*
|
||||
* Note that `buffer == NULL && width == 255' is a hack used to
|
||||
* tag `unavailable' bitmaps in the array. We should never try
|
||||
* to load these.
|
||||
*
|
||||
*/
|
||||
|
||||
if ( sbit->buffer == NULL && sbit->width != 255 )
|
||||
{
|
||||
FT_ULong size;
|
||||
|
@ -329,11 +297,11 @@
|
|||
FTC_NODE_REF(snode); /* lock node to prevent flushing */
|
||||
/* in retry loop */
|
||||
|
||||
FTC_CACHE_TRYLOOP( cache )
|
||||
FTC_RETR_LOOP( cache->manager )
|
||||
{
|
||||
error = ftc_snode_load( snode, cache->manager, gindex, &size );
|
||||
}
|
||||
FTC_CACHE_TRYLOOP_END();
|
||||
FTC_RETRY_END( error );
|
||||
|
||||
FTC_NODE(snode)->ref_count--; /* unlock the node */
|
||||
|
||||
|
|
|
@ -42,8 +42,7 @@ CACHE_DRV_H := $(CACHE_H_DIR)/ftcmru.h \
|
|||
$(CACHE_H_DIR)/ftcimage.h \
|
||||
$(CACHE_H_DIR)/ftccmap.h \
|
||||
$(CACHE_DIR)/ftcerror.h \
|
||||
$(CACHE_DIR)/ftcint.h \
|
||||
$(CACHE_DIR)/ftccback.h
|
||||
$(CACHE_DIR)/ftcint.h
|
||||
|
||||
|
||||
# Cache driver object(s)
|
||||
|
|
Loading…
Reference in New Issue