diff options
author | Andrea Canciani <ranma42@gmail.com> | 2010-12-22 00:21:19 +0100 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2011-01-06 11:37:28 +0100 |
commit | c3f9a0cf473f3ef9fd89b2a9738e1ce61fd0b6cc (patch) | |
tree | 74b5b84b7a211168d6a6a3b70dbd43bc3fa98d4f /src/cairo-xcb-surface-render.c | |
parent | a87001c0631da31f9caccdd99f31739c6e85a4e9 (diff) |
xcb: Correct handling of index 0 glyphs
Glyph caches (with direct glyph index matching) cannot be completely
initialized with zeroes, otherwise the code will incorrectly believe
that the lookup for the 0-index glyph has already been performed.
Diffstat (limited to 'src/cairo-xcb-surface-render.c')
-rw-r--r-- | src/cairo-xcb-surface-render.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c index 760c90d9..0aaab2dc 100644 --- a/src/cairo-xcb-surface-render.c +++ b/src/cairo-xcb-surface-render.c @@ -3730,7 +3730,14 @@ _can_composite_glyphs (cairo_xcb_surface_t *dst, const int max_glyph_size = dst->connection->maximum_request_length - 64; int i; + /* We must initialize the cache with values that cannot match the + * "hash" to guarantee that when compared for the first time they + * will result in a mismatch. The hash function is simply modulus, + * so we cannot use 0 in glyph_cache[0], but we can use it in all + * other array cells. + */ memset (glyph_cache, 0, sizeof (glyph_cache)); + glyph_cache[0] = 1; /* first scan for oversized glyphs, and fallback in that case */ for (i = 0; i < num_glyphs; i++) { |