summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2007-07-30 21:43:20 -0700
committerCarl Worth <cworth@cworth.org>2007-08-02 22:49:56 -0700
commit4c6abe1c7c8abcf203572bbf86b21d97ea4e756f (patch)
tree22d763b7aac1e31ce6c15db0b4489f507d45ba12 /render
parent363d764ea32b938f3dff35df7cf3370363c04d5c (diff)
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.
Diffstat (limited to 'render')
-rw-r--r--render/glyph.c23
-rw-r--r--render/glyphstr.h3
2 files changed, 23 insertions, 3 deletions
diff --git a/render/glyph.c b/render/glyph.c
index 583a52ba3..53c00b326 100644
--- a/render/glyph.c
+++ b/render/glyph.c
@@ -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)
diff --git a/render/glyphstr.h b/render/glyphstr.h
index 22150deee..b941dabaf 100644
--- a/render/glyphstr.h
+++ b/render/glyphstr.h
@@ -130,6 +130,9 @@ GlyphRefPtr
FindGlyphRef (GlyphHashPtr hash, CARD32 signature, Bool match, GlyphPtr compare);
CARD32
+HashGlyphInfoAndBits (xGlyphInfo *gi, CARD8 *data, unsigned int size);
+
+CARD32
HashGlyph (GlyphPtr glyph);
void