diff options
author | Andrea Canciani <ranma42@gmail.com> | 2011-08-01 19:01:16 +0200 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2011-08-01 19:21:48 +0200 |
commit | 400d055f3cd2eecd2cc4b91a40eac4146ec61932 (patch) | |
tree | a2e61cb2871348bd5c194e8a218c4fa063f080be /src/cairo-scaled-font.c | |
parent | 02665975d3ef0204bc512de1be55f898637f2d21 (diff) |
hash: Compare hash values before calling keys_equal
If the hash value is different, the keys cannot be equal. Testing this
beforehand can avoid a few function calls and shares this optimization
across all cairo-hash uses.
Diffstat (limited to 'src/cairo-scaled-font.c')
-rw-r--r-- | src/cairo-scaled-font.c | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c index 6dc8ed39d..cb59bce67 100644 --- a/src/cairo-scaled-font.c +++ b/src/cairo-scaled-font.c @@ -638,9 +638,6 @@ _cairo_scaled_font_keys_equal (const void *abstract_key_a, const cairo_scaled_font_t *key_a = abstract_key_a; const cairo_scaled_font_t *key_b = abstract_key_b; - if (key_a->hash_entry.hash != key_b->hash_entry.hash) - return FALSE; - return key_a->original_font_face == key_b->original_font_face && memcmp ((unsigned char *)(&key_a->font_matrix.xx), (unsigned char *)(&key_b->font_matrix.xx), @@ -668,15 +665,6 @@ _cairo_scaled_font_matches (const cairo_scaled_font_t *scaled_font, cairo_font_options_equal (&scaled_font->options, options); } -static cairo_bool_t -_cairo_scaled_glyphs_equal (const void *abstract_a, const void *abstract_b) -{ - const cairo_scaled_glyph_t *a = abstract_a; - const cairo_scaled_glyph_t *b = abstract_b; - - return a->hash_entry.hash == b->hash_entry.hash; -} - /* * Basic #cairo_scaled_font_t object management */ @@ -725,7 +713,7 @@ _cairo_scaled_font_init (cairo_scaled_font_t *scaled_font, return status; } - scaled_font->glyphs = _cairo_hash_table_create (_cairo_scaled_glyphs_equal); + scaled_font->glyphs = _cairo_hash_table_create (NULL); if (unlikely (scaled_font->glyphs == NULL)) return _cairo_error (CAIRO_STATUS_NO_MEMORY); |