cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=5f630e865346b9de765bf1f74aca1d8a760ce5bc

commit 5f630e865346b9de765bf1f74aca1d8a760ce5bc
Author: Cedric BAIL <ced...@efl.so>
Date:   Sun Sep 29 13:14:45 2013 +0200

    evas: let's inline data to get a little speedup when matching kerning.
---
 src/lib/evas/common/evas_font_query.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/lib/evas/common/evas_font_query.c 
b/src/lib/evas/common/evas_font_query.c
index b2a63c0..eebab70 100644
--- a/src/lib/evas/common/evas_font_query.c
+++ b/src/lib/evas/common/evas_font_query.c
@@ -175,12 +175,14 @@ evas_common_font_query_kerning(RGBA_Font_Int *fi, FT_UInt 
left, FT_UInt right,
    int *result;
    FT_Vector delta;
    int key[2];
+   int hash;
    int error = 1;
 
    key[0] = left;
    key[1] = right;
+   hash = eina_hash_int32(&left, sizeof (int)) ^ eina_hash_int32(&right, 
sizeof (int));
 
-   result = eina_hash_find(fi->kerning, key);
+   result = eina_hash_find_by_hash(fi->kerning, key, sizeof (int) * 2, hash);
    if (result)
      {
        *kerning = result[2];
@@ -194,7 +196,7 @@ evas_common_font_query_kerning(RGBA_Font_Int *fi, FT_UInt 
left, FT_UInt right,
    evas_common_font_int_reload(fi);
    FTLOCK();
    if (FT_Get_Kerning(fi->src->ft.face,
-                     key[0], key[1],
+                     left, right,
                      FT_KERNING_DEFAULT, &delta) == 0)
      {
        int *push;
@@ -205,11 +207,11 @@ evas_common_font_query_kerning(RGBA_Font_Int *fi, FT_UInt 
left, FT_UInt right,
        push = malloc(sizeof (int) * 3);
        if (!push) return 1;
 
-       push[0] = key[0];
-       push[1] = key[1];
+       push[0] = left;
+       push[1] = right;
        push[2] = *kerning;
 
-       eina_hash_direct_add(fi->kerning, push, push);
+       eina_hash_direct_add_by_hash(fi->kerning, push, sizeof(int) * 2, hash, 
push);
 
        goto on_correct;
      }

-- 


Reply via email to