[xorg-commit-diffs] xc/extras/freetype2/src/cache ftccache.c,
1.1.4.1, 1.1.4.2 ftccmap.c, 1.1.4.1, 1.1.4.2 ftcsbits.c,
1.1.4.1, 1.1.4.2 ftlru.c, 1.1.4.1, 1.1.4.2 rules.mk, 1.1, 1.1.4.1
Egbert Eich
xorg-commit at pdx.freedesktop.org
Thu Apr 15 03:14:36 PDT 2004
- Previous message: [xorg-commit-diffs] xc/extras/freetype2/src/bdf bdf.h, 1.1,
1.1.4.1 bdfdrivr.c, 1.1.4.2, 1.1.4.3 bdfdrivr.h, 1.1,
1.1.4.1 bdflib.c, 1.1.4.2, 1.1.4.3 rules.mk, 1.1, 1.1.4.1
- Next message: [xorg-commit-diffs] xc/extras/freetype2/src/cff cfftypes.h, NONE,
1.1.6.1 cffcmap.c, 1.1, 1.1.4.1 cffcmap.h, 1.1,
1.1.4.1 cffdrivr.c, 1.1.4.1, 1.1.4.2 cffgload.c, 1.1.4.2,
1.1.4.3 cffgload.h, 1.1.4.1, 1.1.4.2 cffload.c, 1.1.4.1,
1.1.4.2 cffload.h, 1.1.4.1, 1.1.4.2 cffobjs.c, 1.1.4.1,
1.1.4.2 cffobjs.h, 1.1.4.1, 1.1.4.2 cffparse.c, 1.1.4.1,
1.1.4.2 cffparse.h, 1.1.4.1, 1.1.4.2 cfftoken.h, 1.1,
1.1.4.1 rules.mk, 1.1.4.1, 1.1.4.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: eich
Update of /cvs/xorg/xc/extras/freetype2/src/cache
In directory pdx:/home/eich/tstbuild/xc/extras/freetype2/src/cache
Modified Files:
Tag: XORG-CURRENT
ftccache.c ftccmap.c ftcsbits.c ftlru.c rules.mk
Log Message:
2004-04-15 Egbert Eich <eich at freedesktop.org>
Merged changes from RELEASE-1 branch
Index: ftccache.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/cache/ftccache.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/ftccache.c 26 Nov 2003 22:48:26 -0000 1.1.4.1
+++ b/ftccache.c 15 Apr 2004 10:14:33 -0000 1.1.4.2
@@ -4,7 +4,7 @@
/* */
/* The FreeType internal cache interface (body). */
/* */
-/* Copyright 2000-2001, 2002 by */
+/* Copyright 2000-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -173,7 +173,7 @@
if ( *pnode == NULL )
{
FT_ERROR(( "ftc_node_hash_unlink: unknown node!\n" ));
- return FT_Err_Ok;
+ return FTC_Err_Ok;
}
if ( *pnode == node )
@@ -196,7 +196,7 @@
FTC_Node* pold;
- if ( old_index+1 <= FTC_HASH_INITIAL_SIZE )
+ if ( old_index + 1 <= FTC_HASH_INITIAL_SIZE )
goto Exit;
if ( p == 0 )
@@ -551,7 +551,7 @@
FTC_Query query,
FTC_Node *anode )
{
- FT_Error error = FT_Err_Ok;
+ FT_Error error = FTC_Err_Ok;
FTC_Manager manager;
FT_LruNode lru;
FT_UInt free_count = 0;
@@ -567,24 +567,24 @@
manager = cache->manager;
- /* here's a small note explaining what's hapenning in the code below.
+ /* here's a small note explaining what's happening in the code below.
*
- * we need to deal intelligently with out-of-memory (OOM) conditions
+ * We need to deal intelligently with out-of-memory (OOM) conditions
* when trying to create a new family or cache node during the lookup.
*
- * when an OOM is detected, we'll try to free one or more "old" nodes
- * from the cache, then try again. it may be necessary to do that several
- * times, so a loop is needed.
+ * When an OOM is detected, we try to free one or more "old" nodes
+ * from the cache, then try again. It may be necessary to do that
+ * several times, so a loop is needed.
*
- * the local variable "free_count" holds the number of "old" nodes to
- * discard on each attempt. it starts at 1 and doubles on each iteration.
- * the loop stops when:
+ * The local variable "free_count" holds the number of "old" nodes to
+ * discard on each attempt. It starts at 1 and doubles on each
+ * iteration. The loop stops when:
*
* - a non-OOM error is detected
* - a succesful lookup is performed
* - there are no more unused nodes in the cache
*
- * for the record, remember that all used nodes appear _before_
+ * For the record, remember that all used nodes appear _before_
* unused ones in the manager's MRU node list.
*/
@@ -632,7 +632,6 @@
}
{
- FTC_Manager manager = cache->manager;
FTC_Family family = (FTC_Family) lru;
FT_UFast hash = query->hash;
FTC_Node* bucket;
@@ -744,16 +743,17 @@
}
Fail:
- if ( error != FT_Err_Out_Of_Memory )
+ if ( error != FTC_Err_Out_Of_Memory )
goto Exit;
- /* there is not enough memory, try to release some unused nodes
+ /* There is not enough memory; try to release some unused nodes
* from the cache to make room for a new one.
*/
{
- FT_UInt new_count;
+ FT_UInt new_count;
- new_count = 1 + free_count*2;
+
+ new_count = 1 + free_count * 2;
/* check overflow and bounds */
if ( new_count < free_count || free_count > manager->num_nodes )
@@ -763,22 +763,24 @@
/* try to remove "new_count" nodes from the list */
{
- FTC_Node first = manager->nodes_list;
- FTC_Node node;
+ FTC_Node first = manager->nodes_list;
+ FTC_Node node;
- if ( first == NULL ) /* empty list ! */
+
+ if ( first == NULL ) /* empty list! */
goto Exit;
- /* go to last node - it's a circular list */
+ /* go to last node - it's a circular list */
node = first->mru_prev;
for ( ; node && new_count > 0; new_count-- )
{
FTC_Node prev = node->mru_prev;
- /* used nodes always appear before unused one in the MRU
- * list. if we find one here, we'd better stop right now
- * our iteration
- */
+
+ /* Used nodes always appear before unused one in the MRU
+ * list. If we find one here, we'd better stop right now
+ * our iteration.
+ */
if ( node->ref_count > 0 )
{
/* if there are no unused nodes in the list, we'd better exit */
Index: ftccmap.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/cache/ftccmap.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/ftccmap.c 26 Nov 2003 22:48:26 -0000 1.1.4.1
+++ b/ftccmap.c 15 Apr 2004 10:14:33 -0000 1.1.4.2
@@ -4,7 +4,7 @@
/* */
/* FreeType CharMap cache (body) */
/* */
-/* Copyright 2000-2001, 2002 by */
+/* Copyright 2000-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -193,16 +193,17 @@
break;
case FTC_CMAP_BY_ENCODING:
- if (desc->u.encoding == FT_ENCODING_UNICODE)
+ if ( desc->u.encoding == FT_ENCODING_UNICODE )
{
- /* since the `interesting' table, with id's 3,10, is normally the
- * last one, we loop backwards. This looses with type1 fonts with
- * non-BMP characters (<.0001%), this wins with .ttf with non-BMP
- * chars (.01% ?), and this is the same about 99.99% of the time!
- */
+ /* Since the `interesting' table, pid/eid (3,10), is normally the
+ * last one, we loop backwards. This looses with type1 fonts with
+ * non-BMP characters (<.0001%), this wins with .ttf with non-BMP
+ * chars (.01% ?), and this is the same about 99.99% of the time!
+ */
FT_UInt unicmap_idx = count; /* some UCS-2 map, if we found it */
+
cur += count - 1;
for ( idx = 0; idx < count; idx++, cur-- )
@@ -211,15 +212,15 @@
{
unicmap_idx = idx; /* record we found a Unicode charmap */
- /* XXX If some new encodings to represent UCS-4 are added,
- * they should be added here.
- */
+ /* XXX If some new encodings to represent UCS-4 are added,
+ * they should be added here.
+ */
if ( ( cur[0]->platform_id == TT_PLATFORM_MICROSOFT &&
- cur[0]->encoding_id == TT_MS_ID_UCS_4 ) ||
+ cur[0]->encoding_id == TT_MS_ID_UCS_4 ) ||
( cur[0]->platform_id == TT_PLATFORM_APPLE_UNICODE &&
- cur[0]->encoding_id == TT_APPLE_ID_UNICODE_32 ) )
+ cur[0]->encoding_id == TT_APPLE_ID_UNICODE_32 ) )
- /* Hurray! We found a UCS-4 charmap. We can stop the scan! */
+ /* Hurray! We found a UCS-4 charmap. We can stop the scan! */
{
idx = count - 1 - idx;
goto Found_idx_for_FTC_CMAP_BY_ENCODING;
@@ -227,9 +228,9 @@
}
}
- /* We do not have any UCS-4 charmap. Sigh.
- * Let's see if we have some other kind of Unicode charmap, though.
- */
+ /* We do not have any UCS-4 charmap. Sigh.
+ * Let's see if we have some other kind of Unicode charmap, though.
+ */
if ( unicmap_idx < count )
idx = count - 1 - unicmap_idx;
}
Index: ftcsbits.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/cache/ftcsbits.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/ftcsbits.c 26 Nov 2003 22:48:26 -0000 1.1.4.1
+++ b/ftcsbits.c 15 Apr 2004 10:14:33 -0000 1.1.4.2
@@ -4,7 +4,7 @@
/* */
/* FreeType sbits manager (body). */
/* */
-/* Copyright 2000-2001, 2002 by */
+/* Copyright 2000-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -189,13 +189,13 @@
sbit->format = (FT_Byte)bitmap->pixel_mode;
sbit->max_grays = (FT_Byte)(bitmap->num_grays - 1);
-#if 0 /* this doesn't work well with embedded bitmaps !! */
+#if 0 /* this doesn't work well with embedded bitmaps */
/* grab the bitmap when possible - this is a hack! */
- if ( slot->flags & FT_GLYPH_OWN_BITMAP )
+ if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
{
- slot->flags &= ~FT_GLYPH_OWN_BITMAP;
- sbit->buffer = bitmap->buffer;
+ slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
+ sbit->buffer = bitmap->buffer;
}
else
#endif
@@ -216,7 +216,7 @@
/* we mark unloaded glyphs with `sbit.buffer == 0' */
/* and 'width == 255', 'height == 0' */
/* */
- if ( error && error != FT_Err_Out_Of_Memory )
+ if ( error && error != FTC_Err_Out_Of_Memory )
{
sbit->width = 255;
error = 0;
@@ -308,14 +308,11 @@
FT_ULong size;
- /* yes, it's safe to ignore errors here */
- ftc_sbit_node_load( snode,
- cache->manager,
- FTC_SBIT_FAMILY( FTC_QUERY( squery )->family ),
- gindex,
- &size );
-
- cache->manager->cur_weight += size;
+ if ( !ftc_sbit_node_load(
+ snode, cache->manager,
+ FTC_SBIT_FAMILY( FTC_QUERY( squery )->family ),
+ gindex, &size ) )
+ cache->manager->cur_weight += size;
}
}
Index: ftlru.c
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/cache/ftlru.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- a/ftlru.c 26 Nov 2003 22:48:26 -0000 1.1.4.1
+++ b/ftlru.c 15 Apr 2004 10:14:33 -0000 1.1.4.2
@@ -4,7 +4,7 @@
/* */
/* Simple LRU list-cache (body). */
/* */
-/* Copyright 2000-2001, 2002 by */
+/* Copyright 2000-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -130,7 +130,6 @@
FT_Error error = 0;
FT_LruNode node, *pnode;
FT_LruList_Class clazz;
- FT_LruNode* plast;
FT_LruNode result = NULL;
FT_Memory memory;
@@ -139,7 +138,6 @@
return FTC_Err_Invalid_Argument;
pnode = &list->nodes;
- plast = pnode;
node = NULL;
clazz = list->clazz;
memory = list->memory;
@@ -155,7 +153,6 @@
if ( clazz->node_compare( node, key, list->data ) )
break;
- plast = pnode;
pnode = &(*pnode)->next;
}
}
@@ -170,7 +167,6 @@
if ( node->key == key )
break;
- plast = pnode;
pnode = &(*pnode)->next;
}
}
@@ -188,40 +184,40 @@
goto Exit;
}
- /* since we haven't found the relevant element in our LRU list,
+ /* Since we haven't found the relevant element in our LRU list,
* we're going to "create" a new one.
*
- * the following code is a bit special, because it tries to handle
+ * The following code is a bit special, because it tries to handle
* out-of-memory conditions (OOM) in an intelligent way.
*
- * more precisely, if not enough memory is available to create a
+ * More precisely, if not enough memory is available to create a
* new node or "flush" an old one, we need to remove the oldest
- * elements from our list, and try again. since several tries may
- * be necessary, a loop is needed
+ * elements from our list, and try again. Since several tries may
+ * be necessary, a loop is needed.
*
- * this loop will only exit when:
+ * This loop will only exit when:
*
- * - a new node was succesfully created, or an old node flushed
- * - an error other than FT_Err_Out_Of_Memory is detected
+ * - a new node was successfully created, or an old node flushed
+ * - an error other than FTC_Err_Out_Of_Memory is detected
* - the list of nodes is empty, and it isn't possible to create
* new nodes
*
- * on each unsucesful attempt, one node will be removed from the list
+ * On each unsuccessful attempt, one node will be removed from the list.
*
*/
{
- FT_Int drop_last = ( list->max_nodes > 0 &&
- list->num_nodes >= list->max_nodes );
+ FT_Int drop_last = ( list->max_nodes > 0 &&
+ list->num_nodes >= list->max_nodes );
for (;;)
{
node = NULL;
- /* when "drop_last" is true, we should free the last node in
- * the list to make room for a new one. note that we re-use
- * its memory block to save allocation calls.
- */
+ /* If "drop_last" is true, we should free the last node in
+ * the list to make room for a new one. Note that we reuse
+ * its memory block to save allocation calls.
+ */
if ( drop_last )
{
/* find the last node in the list
@@ -231,8 +227,8 @@
if ( node == NULL )
{
- FT_ASSERT( list->nodes == 0 );
- error = FT_Err_Out_Of_Memory;
+ FT_ASSERT( list->num_nodes == 0 );
+ error = FTC_Err_Out_Of_Memory;
goto Exit;
}
@@ -244,12 +240,12 @@
node = *pnode;
}
- /* remove it from the list, and try to "flush" it. doing this will
- * save a significant number of dynamic allocations compared to
- * a classic destroy/create cycle
- */
+ /* Remove it from the list, and try to "flush" it. Doing this will
+ * save a significant number of dynamic allocations compared to
+ * a classic destroy/create cycle.
+ */
*pnode = NULL;
- list->num_nodes -= 1;
+ list->num_nodes--;
if ( clazz->node_flush )
{
@@ -257,14 +253,14 @@
if ( !error )
goto Success;
- /* note that if an error occured during the flush, we need to
+ /* Note that if an error occured during the flush, we need to
* finalize it since it is potentially in incomplete state.
*/
}
- /* we finalize, but do not destroy the last node, we
- * simply re-use its memory block !
- */
+ /* We finalize, but do not destroy the last node, we
+ * simply reuse its memory block!
+ */
if ( clazz->node_done )
clazz->node_done( node, list->data );
@@ -272,8 +268,8 @@
}
else
{
- /* try to allocate a new node when "drop_last" is not TRUE
- * this usually happens on the first pass, when the LRU list
+ /* Try to allocate a new node when "drop_last" is not TRUE.
+ * This usually happens on the first pass, when the LRU list
* is not already full.
*/
if ( FT_ALLOC( node, clazz->node_size ) )
@@ -302,7 +298,7 @@
goto Exit;
Fail:
- if ( error != FT_Err_Out_Of_Memory )
+ if ( error != FTC_Err_Out_Of_Memory )
goto Exit;
drop_last = 1;
@@ -316,7 +312,6 @@
}
-
FT_EXPORT_DEF( void )
FT_LruList_Remove( FT_LruList list,
FT_LruNode node )
@@ -384,6 +379,7 @@
clazz->node_done( node, list );
FT_FREE( node );
+ list->num_nodes--;
}
else
pnode = &(*pnode)->next;
Index: rules.mk
===================================================================
RCS file: /cvs/xorg/xc/extras/freetype2/src/cache/rules.mk,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -u -d -r1.1 -r1.1.4.1
--- a/rules.mk 14 Nov 2003 16:48:24 -0000 1.1
+++ b/rules.mk 15 Apr 2004 10:14:33 -0000 1.1.4.1
@@ -3,7 +3,7 @@
#
-# Copyright 2000, 2001 by
+# Copyright 2000, 2001, 2003 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -15,66 +15,63 @@
# Cache driver directory
#
-CACHE_DIR := $(SRC_)cache
-CACHE_DIR_ := $(CACHE_DIR)$(SEP)
-
-CACHE_H_DIR := $(PUBLIC_)cache
-CACHE_H_DIR_ := $(CACHE_H_DIR)$(SEP)
+CACHE_DIR := $(SRC_DIR)/cache
+CACHE_H_DIR := $(PUBLIC_DIR)/cache
# compilation flags for the driver
#
-Cache_COMPILE := $(FT_COMPILE) $I$(CACHE_DIR)
+CACHE_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(CACHE_DIR))
# Cache driver sources (i.e., C files)
#
-Cache_DRV_SRC := $(CACHE_DIR_)ftlru.c \
- $(CACHE_DIR_)ftcmanag.c \
- $(CACHE_DIR_)ftccache.c \
- $(CACHE_DIR_)ftcglyph.c \
- $(CACHE_DIR_)ftcsbits.c \
- $(CACHE_DIR_)ftcimage.c \
- $(CACHE_DIR_)ftccmap.c
+CACHE_DRV_SRC := $(CACHE_DIR)/ftlru.c \
+ $(CACHE_DIR)/ftcmanag.c \
+ $(CACHE_DIR)/ftccache.c \
+ $(CACHE_DIR)/ftcglyph.c \
+ $(CACHE_DIR)/ftcsbits.c \
+ $(CACHE_DIR)/ftcimage.c \
+ $(CACHE_DIR)/ftccmap.c
# Cache driver headers
#
-Cache_DRV_H := $(CACHE_H_DIR_)ftlru.h \
- $(CACHE_H_DIR_)ftcmanag.h \
- $(CACHE_H_DIR_)ftcglyph.h \
- $(CACHE_H_DIR_)ftcimage.h \
- $(CACHE_DIR_)ftcerror.h
+CACHE_DRV_H := $(CACHE_H_DIR)/ftlru.h \
+ $(CACHE_H_DIR)/ftcmanag.h \
+ $(CACHE_H_DIR)/ftcglyph.h \
+ $(CACHE_H_DIR)/ftcimage.h \
+ $(CACHE_DIR)/ftcerror.h
# Cache driver object(s)
#
-# Cache_DRV_OBJ_M is used during `multi' builds.
-# Cache_DRV_OBJ_S is used during `single' builds.
+# CACHE_DRV_OBJ_M is used during `multi' builds.
+# CACHE_DRV_OBJ_S is used during `single' builds.
#
-Cache_DRV_OBJ_M := $(Cache_DRV_SRC:$(CACHE_DIR_)%.c=$(OBJ_)%.$O)
-Cache_DRV_OBJ_S := $(OBJ_)ftcache.$O
+CACHE_DRV_OBJ_M := $(CACHE_DRV_SRC:$(CACHE_DIR)/%.c=$(OBJ_DIR)/%.$O)
+CACHE_DRV_OBJ_S := $(OBJ_DIR)/ftcache.$O
# Cache driver source file for single build
#
-Cache_DRV_SRC_S := $(CACHE_DIR_)ftcache.c
+CACHE_DRV_SRC_S := $(CACHE_DIR)/ftcache.c
# Cache driver - single object
#
-$(Cache_DRV_OBJ_S): $(Cache_DRV_SRC_S) $(Cache_DRV_SRC) \
- $(FREETYPE_H) $(Cache_DRV_H)
- $(Cache_COMPILE) $T$@ $(Cache_DRV_SRC_S)
+$(CACHE_DRV_OBJ_S): $(CACHE_DRV_SRC_S) $(CACHE_DRV_SRC) \
+ $(FREETYPE_H) $(CACHE_DRV_H)
+ $(CACHE_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(CACHE_DRV_SRC_S))
# Cache driver - multiple objects
#
-$(OBJ_)%.$O: $(CACHE_DIR_)%.c $(FREETYPE_H) $(Cache_DRV_H)
- $(Cache_COMPILE) $T$@ $<
+$(OBJ_DIR)/%.$O: $(CACHE_DIR)/%.c $(FREETYPE_H) $(CACHE_DRV_H)
+ $(CACHE_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
# update main driver object lists
#
-DRV_OBJS_S += $(Cache_DRV_OBJ_S)
-DRV_OBJS_M += $(Cache_DRV_OBJ_M)
+DRV_OBJS_S += $(CACHE_DRV_OBJ_S)
+DRV_OBJS_M += $(CACHE_DRV_OBJ_M)
# EOF
- Previous message: [xorg-commit-diffs] xc/extras/freetype2/src/bdf bdf.h, 1.1,
1.1.4.1 bdfdrivr.c, 1.1.4.2, 1.1.4.3 bdfdrivr.h, 1.1,
1.1.4.1 bdflib.c, 1.1.4.2, 1.1.4.3 rules.mk, 1.1, 1.1.4.1
- Next message: [xorg-commit-diffs] xc/extras/freetype2/src/cff cfftypes.h, NONE,
1.1.6.1 cffcmap.c, 1.1, 1.1.4.1 cffcmap.h, 1.1,
1.1.4.1 cffdrivr.c, 1.1.4.1, 1.1.4.2 cffgload.c, 1.1.4.2,
1.1.4.3 cffgload.h, 1.1.4.1, 1.1.4.2 cffload.c, 1.1.4.1,
1.1.4.2 cffload.h, 1.1.4.1, 1.1.4.2 cffobjs.c, 1.1.4.1,
1.1.4.2 cffobjs.h, 1.1.4.1, 1.1.4.2 cffparse.c, 1.1.4.1,
1.1.4.2 cffparse.h, 1.1.4.1, 1.1.4.2 cfftoken.h, 1.1,
1.1.4.1 rules.mk, 1.1.4.1, 1.1.4.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the xorg-commit-diffs
mailing list