* evas: Bring back Font Kerning cache as it does improve performance

by a good margin on my 4 targets (SGX-530, Tango2, NVidia G73).



SVN revision: 46388
This commit is contained in:
Cedric BAIL 2010-02-23 13:31:10 +00:00
parent 366c893967
commit 7fcbff0e0e
2 changed files with 22 additions and 22 deletions

View File

@ -79,7 +79,7 @@ _evas_common_font_int_free(RGBA_Font_Int *fi)
// eina_hash_foreach(fi->glyphs, font_flush_free_glyph_cb, NULL); // eina_hash_foreach(fi->glyphs, font_flush_free_glyph_cb, NULL);
// eina_hash_free(fi->glyphs); // eina_hash_free(fi->glyphs);
// eina_hash_free(fi->kerning); eina_hash_free(fi->kerning);
// eina_hash_free(fi->indexes); // eina_hash_free(fi->indexes);
#ifdef HAVE_PTHREAD #ifdef HAVE_PTHREAD
@ -276,10 +276,10 @@ _evas_common_font_int_cache_init(RGBA_Font_Int *fi)
// EINA_KEY_CMP(_evas_common_font_int_cmp), // EINA_KEY_CMP(_evas_common_font_int_cmp),
// EINA_KEY_HASH(eina_hash_int32), // EINA_KEY_HASH(eina_hash_int32),
// free, 3); // free, 3);
// fi->kerning = eina_hash_new(NULL, fi->kerning = eina_hash_new(NULL,
// EINA_KEY_CMP(_evas_common_font_double_int_cmp), EINA_KEY_CMP(_evas_common_font_double_int_cmp),
// EINA_KEY_HASH(_evas_common_font_double_int_hash), EINA_KEY_HASH(_evas_common_font_double_int_hash),
// free, 3); free, 3);
#ifdef HAVE_PTHREAD #ifdef HAVE_PTHREAD
pthread_mutex_init(&fi->ft_mutex, NULL); pthread_mutex_init(&fi->ft_mutex, NULL);
#endif #endif

View File

@ -12,19 +12,19 @@ evas_common_font_query_kerning(RGBA_Font_Int* fi,
int error = 1; int error = 1;
// return 0; // return 0;
// key[0] = prev; key[0] = prev;
// key[1] = index; key[1] = index;
#ifdef HAVE_PTHREAD #ifdef HAVE_PTHREAD
// pthread_mutex_lock(&fi->ft_mutex); pthread_mutex_lock(&fi->ft_mutex);
#endif #endif
// result = eina_hash_find(fi->kerning, key); result = eina_hash_find(fi->kerning, key);
// if (result) if (result)
// { {
// *kerning = result[2]; *kerning = result[2];
// goto on_correct; goto on_correct;
// } }
/* NOTE: ft2 seems to have a bug. and sometimes returns bizarre /* NOTE: ft2 seems to have a bug. and sometimes returns bizarre
* values to kern by - given same font, same size and same * values to kern by - given same font, same size and same
@ -34,18 +34,18 @@ evas_common_font_query_kerning(RGBA_Font_Int* fi,
key[0], key[1], key[0], key[1],
ft_kerning_default, &delta) == 0) ft_kerning_default, &delta) == 0)
{ {
// int *push; int *push;
*kerning = delta.x >> 6; *kerning = delta.x >> 6;
// push = malloc(sizeof (int) * 3); push = malloc(sizeof (int) * 3);
// if (!push) return 1; if (!push) return 1;
// push[0] = key[0]; push[0] = key[0];
// push[1] = key[1]; push[1] = key[1];
// push[2] = *kerning; push[2] = *kerning;
// eina_hash_direct_add(fi->kerning, push, push); eina_hash_direct_add(fi->kerning, push, push);
goto on_correct; goto on_correct;
} }
@ -54,7 +54,7 @@ evas_common_font_query_kerning(RGBA_Font_Int* fi,
on_correct: on_correct:
#ifdef HAVE_PTHREAD #ifdef HAVE_PTHREAD
// pthread_mutex_unlock(&fi->ft_mutex); pthread_mutex_unlock(&fi->ft_mutex);
#endif #endif
return error; return error;
} }