Split HashGlyph functionality out into HashGlyphInfoAndBits

This is in preparation for a future change that will take advantage
of being able to compute a hash for a separate xGlyphInfo and chunk
of bits without a combined Glyph object.
This commit is contained in:
Carl Worth 2007-07-30 21:43:20 -07:00
parent 363d764ea3
commit 4c6abe1c7c
2 changed files with 23 additions and 3 deletions

View File

@ -461,18 +461,35 @@ FindGlyphRef (GlyphHashPtr hash, CARD32 signature, Bool match, GlyphPtr compare)
}
CARD32
HashGlyph (GlyphPtr glyph)
HashGlyphInfoAndBits (xGlyphInfo *gi, CARD8 *data, unsigned int size)
{
CARD32 *bits = (CARD32 *) &(glyph->info);
CARD32 *bits;
CARD32 hash;
int n = glyph->size / sizeof (CARD32);
int n;
hash = 0;
bits = (CARD32 *) gi;
n = sizeof (xGlyphInfo) / sizeof (CARD32);
while (n--)
hash ^= *bits++;
bits = (CARD32 *) data;
n = size / sizeof (CARD32);
while (n--)
hash ^= *bits++;
return hash;
}
CARD32
HashGlyph (GlyphPtr glyph)
{
return HashGlyphInfoAndBits (&glyph->info,
(CARD8 *) (&glyph->info + 1),
glyph->size - sizeof (xGlyphInfo));
}
#ifdef CHECK_DUPLICATES
void
DuplicateRef (GlyphPtr glyph, char *where)

View File

@ -129,6 +129,9 @@ FindGlyphHashSet (CARD32 filled);
GlyphRefPtr
FindGlyphRef (GlyphHashPtr hash, CARD32 signature, Bool match, GlyphPtr compare);
CARD32
HashGlyphInfoAndBits (xGlyphInfo *gi, CARD8 *data, unsigned int size);
CARD32
HashGlyph (GlyphPtr glyph);