summaryrefslogtreecommitdiff
path: root/src/lib/evas/common
diff options
context:
space:
mode:
authorCedric BAIL <cedric@efl.so>2013-09-29 13:14:45 +0200
committerCedric BAIL <cedric@efl.so>2013-09-29 13:43:46 +0200
commit5f630e865346b9de765bf1f74aca1d8a760ce5bc (patch)
tree24929fb355743f2379eb4de9538271e11719c388 /src/lib/evas/common
parent5d37215d261da2cb6b42070e8608cdec702d8269 (diff)
evas: let's inline data to get a little speedup when matching kerning.
Diffstat (limited to 'src/lib/evas/common')
-rw-r--r--src/lib/evas/common/evas_font_query.c12
1 files 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 b2a63c0191..eebab7092e 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,
175 int *result; 175 int *result;
176 FT_Vector delta; 176 FT_Vector delta;
177 int key[2]; 177 int key[2];
178 int hash;
178 int error = 1; 179 int error = 1;
179 180
180 key[0] = left; 181 key[0] = left;
181 key[1] = right; 182 key[1] = right;
183 hash = eina_hash_int32(&left, sizeof (int)) ^ eina_hash_int32(&right, sizeof (int));
182 184
183 result = eina_hash_find(fi->kerning, key); 185 result = eina_hash_find_by_hash(fi->kerning, key, sizeof (int) * 2, hash);
184 if (result) 186 if (result)
185 { 187 {
186 *kerning = result[2]; 188 *kerning = result[2];
@@ -194,7 +196,7 @@ evas_common_font_query_kerning(RGBA_Font_Int *fi, FT_UInt left, FT_UInt right,
194 evas_common_font_int_reload(fi); 196 evas_common_font_int_reload(fi);
195 FTLOCK(); 197 FTLOCK();
196 if (FT_Get_Kerning(fi->src->ft.face, 198 if (FT_Get_Kerning(fi->src->ft.face,
197 key[0], key[1], 199 left, right,
198 FT_KERNING_DEFAULT, &delta) == 0) 200 FT_KERNING_DEFAULT, &delta) == 0)
199 { 201 {
200 int *push; 202 int *push;
@@ -205,11 +207,11 @@ evas_common_font_query_kerning(RGBA_Font_Int *fi, FT_UInt left, FT_UInt right,
205 push = malloc(sizeof (int) * 3); 207 push = malloc(sizeof (int) * 3);
206 if (!push) return 1; 208 if (!push) return 1;
207 209
208 push[0] = key[0]; 210 push[0] = left;
209 push[1] = key[1]; 211 push[1] = right;
210 push[2] = *kerning; 212 push[2] = *kerning;
211 213
212 eina_hash_direct_add(fi->kerning, push, push); 214 eina_hash_direct_add_by_hash(fi->kerning, push, sizeof(int) * 2, hash, push);
213 215
214 goto on_correct; 216 goto on_correct;
215 } 217 }