aboutsummaryrefslogtreecommitdiff
path: root/freetype/src/cache
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-01-16 17:43:39 +0000
committermarha <marha@users.sourceforge.net>2011-01-16 17:43:39 +0000
commit2177eb8fad173f2b0fe04f188c4d6dadaa8f4441 (patch)
tree862ef4b348586f932593a7d2b599913230059cdd /freetype/src/cache
parent367c91bebcdc1f5ba4278b68eb8715218d9640ad (diff)
downloadvcxsrv-2177eb8fad173f2b0fe04f188c4d6dadaa8f4441.tar.gz
vcxsrv-2177eb8fad173f2b0fe04f188c4d6dadaa8f4441.tar.bz2
vcxsrv-2177eb8fad173f2b0fe04f188c4d6dadaa8f4441.zip
freetype 2.4.4
Diffstat (limited to 'freetype/src/cache')
-rw-r--r--freetype/src/cache/ftcbasic.c8
-rw-r--r--freetype/src/cache/ftccache.c8
-rw-r--r--freetype/src/cache/ftccache.h11
-rw-r--r--freetype/src/cache/ftccmap.c4
-rw-r--r--freetype/src/cache/ftcglyph.c2
-rw-r--r--freetype/src/cache/ftcglyph.h2
-rw-r--r--freetype/src/cache/ftcmanag.h2
-rw-r--r--freetype/src/cache/ftcsbits.c4
8 files changed, 24 insertions, 17 deletions
diff --git a/freetype/src/cache/ftcbasic.c b/freetype/src/cache/ftcbasic.c
index 9fb6ddb1e..609ff78e5 100644
--- a/freetype/src/cache/ftcbasic.c
+++ b/freetype/src/cache/ftcbasic.c
@@ -318,7 +318,7 @@
FTC_BasicQueryRec query;
FTC_Node node = 0; /* make compiler happy */
FT_Error error;
- FT_UInt32 hash;
+ FT_PtrDist hash;
/* some argument checks are delayed to FTC_Cache_Lookup */
@@ -414,7 +414,7 @@
FTC_BasicQueryRec query;
FTC_Node node = 0; /* make compiler happy */
FT_Error error;
- FT_UInt32 hash;
+ FT_PtrDist hash;
/* some argument checks are delayed to FTC_Cache_Lookup */
@@ -656,7 +656,7 @@
FT_Error error;
FTC_BasicQueryRec query;
FTC_Node node = 0; /* make compiler happy */
- FT_UInt32 hash;
+ FT_PtrDist hash;
if ( anode )
@@ -753,7 +753,7 @@
FT_Error error;
FTC_BasicQueryRec query;
FTC_Node node = 0; /* make compiler happy */
- FT_UInt32 hash;
+ FT_PtrDist hash;
if ( anode )
diff --git a/freetype/src/cache/ftccache.c b/freetype/src/cache/ftccache.c
index 67affeacb..a5a915e08 100644
--- a/freetype/src/cache/ftccache.c
+++ b/freetype/src/cache/ftccache.c
@@ -346,7 +346,7 @@
static void
FTC_Cache_Clear( FTC_Cache cache )
{
- if ( cache )
+ if ( cache && cache->buckets )
{
FTC_Manager manager = cache->manager;
FT_UFast i;
@@ -410,7 +410,7 @@
static void
ftc_cache_add( FTC_Cache cache,
- FT_UInt32 hash,
+ FT_PtrDist hash,
FTC_Node node )
{
node->hash = hash;
@@ -438,7 +438,7 @@
FT_LOCAL_DEF( FT_Error )
FTC_Cache_NewNode( FTC_Cache cache,
- FT_UInt32 hash,
+ FT_PtrDist hash,
FT_Pointer query,
FTC_Node *anode )
{
@@ -477,7 +477,7 @@
FT_LOCAL_DEF( FT_Error )
FTC_Cache_Lookup( FTC_Cache cache,
- FT_UInt32 hash,
+ FT_PtrDist hash,
FT_Pointer query,
FTC_Node *anode )
{
diff --git a/freetype/src/cache/ftccache.h b/freetype/src/cache/ftccache.h
index 1b695849c..10830a9f8 100644
--- a/freetype/src/cache/ftccache.h
+++ b/freetype/src/cache/ftccache.h
@@ -24,6 +24,9 @@
FT_BEGIN_HEADER
+#define _FTC_FACE_ID_HASH( i ) \
+ ((FT_PtrDist)(( (FT_PtrDist)(i) >> 3 ) ^ ( (FT_PtrDist)(i) << 7 )))
+
/* handle to cache object */
typedef struct FTC_CacheRec_* FTC_Cache;
@@ -56,7 +59,7 @@ FT_BEGIN_HEADER
{
FTC_MruNodeRec mru; /* circular mru list pointer */
FTC_Node link; /* used for hashing */
- FT_UInt32 hash; /* used for hashing too */
+ FT_PtrDist hash; /* used for hashing too */
FT_UShort cache_index; /* index of cache the node belongs to */
FT_Short ref_count; /* reference count for this node */
@@ -168,14 +171,14 @@ FT_BEGIN_HEADER
#ifndef FTC_INLINE
FT_LOCAL( FT_Error )
FTC_Cache_Lookup( FTC_Cache cache,
- FT_UInt32 hash,
+ FT_PtrDist hash,
FT_Pointer query,
FTC_Node *anode );
#endif
FT_LOCAL( FT_Error )
FTC_Cache_NewNode( FTC_Cache cache,
- FT_UInt32 hash,
+ FT_PtrDist hash,
FT_Pointer query,
FTC_Node *anode );
@@ -200,7 +203,7 @@ FT_BEGIN_HEADER
FT_BEGIN_STMNT \
FTC_Node *_bucket, *_pnode, _node; \
FTC_Cache _cache = FTC_CACHE(cache); \
- FT_UInt32 _hash = (FT_UInt32)(hash); \
+ FT_PtrDist _hash = (FT_PtrDist)(hash); \
FTC_Node_CompareFunc _nodcomp = (FTC_Node_CompareFunc)(nodecmp); \
FT_UFast _idx; \
\
diff --git a/freetype/src/cache/ftccmap.c b/freetype/src/cache/ftccmap.c
index 121049207..15060baf7 100644
--- a/freetype/src/cache/ftccmap.c
+++ b/freetype/src/cache/ftccmap.c
@@ -87,7 +87,7 @@
/* compute a query/node hash */
#define FTC_CMAP_HASH( faceid, index, charcode ) \
- ( FTC_FACE_ID_HASH( faceid ) + 211 * (index) + \
+ ( _FTC_FACE_ID_HASH( faceid ) + 211 * (index) + \
( (charcode) / FTC_CMAP_INDICES_MAX ) )
/* the charmap query */
@@ -287,7 +287,7 @@
FTC_Node node;
FT_Error error;
FT_UInt gindex = 0;
- FT_UInt32 hash;
+ FT_PtrDist hash;
FT_Int no_cmap_change = 0;
diff --git a/freetype/src/cache/ftcglyph.c b/freetype/src/cache/ftcglyph.c
index a9ab0c319..a73e2431e 100644
--- a/freetype/src/cache/ftcglyph.c
+++ b/freetype/src/cache/ftcglyph.c
@@ -175,7 +175,7 @@
FT_LOCAL_DEF( FT_Error )
FTC_GCache_Lookup( FTC_GCache cache,
- FT_UInt32 hash,
+ FT_PtrDist hash,
FT_UInt gindex,
FTC_GQuery query,
FTC_Node *anode )
diff --git a/freetype/src/cache/ftcglyph.h b/freetype/src/cache/ftcglyph.h
index c18f9c3af..2bc5624c6 100644
--- a/freetype/src/cache/ftcglyph.h
+++ b/freetype/src/cache/ftcglyph.h
@@ -254,7 +254,7 @@ FT_BEGIN_HEADER
#ifndef FTC_INLINE
FT_LOCAL( FT_Error )
FTC_GCache_Lookup( FTC_GCache cache,
- FT_UInt32 hash,
+ FT_PtrDist hash,
FT_UInt gindex,
FTC_GQuery query,
FTC_Node *anode );
diff --git a/freetype/src/cache/ftcmanag.h b/freetype/src/cache/ftcmanag.h
index 3fdc2c773..13f26bb10 100644
--- a/freetype/src/cache/ftcmanag.h
+++ b/freetype/src/cache/ftcmanag.h
@@ -161,7 +161,7 @@ FT_BEGIN_HEADER
(a)->y_res == (b)->y_res ) ) )
#define FTC_SCALER_HASH( q ) \
- ( FTC_FACE_ID_HASH( (q)->face_id ) + \
+ ( _FTC_FACE_ID_HASH( (q)->face_id ) + \
(q)->width + (q)->height*7 + \
( (q)->pixel ? 0 : ( (q)->x_res*33 ^ (q)->y_res*61 ) ) )
diff --git a/freetype/src/cache/ftcsbits.c b/freetype/src/cache/ftcsbits.c
index 07a4641a8..83245af1e 100644
--- a/freetype/src/cache/ftcsbits.c
+++ b/freetype/src/cache/ftcsbits.c
@@ -160,7 +160,11 @@
!CHECK_CHAR( slot->bitmap_top ) ||
!CHECK_CHAR( xadvance ) ||
!CHECK_CHAR( yadvance ) )
+ {
+ FT_TRACE2(( "ftc_snode_load:"
+ " glyph too large for small bitmap cache\n"));
goto BadGlyph;
+ }
sbit->width = (FT_Byte)bitmap->width;
sbit->height = (FT_Byte)bitmap->rows;