From 468b44c444cb1117101b6b887c31034dd1dfb944 Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Fri, 11 Jan 2013 19:48:28 +0000 Subject: [PATCH] evas: Do not use an Eina_Lock for glyph array Patch by: Leandro Pereira SVN revision: 82659 --- src/lib/evas/common/evas_font_draw.c | 17 +++-------------- src/lib/evas/common/evas_text_utils.h | 1 - .../evas/engines/software_generic/evas_engine.c | 3 ++- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/lib/evas/common/evas_font_draw.c b/src/lib/evas/common/evas_font_draw.c index 74aeda092d..cdaf5877db 100644 --- a/src/lib/evas/common/evas_font_draw.c +++ b/src/lib/evas/common/evas_font_draw.c @@ -225,23 +225,13 @@ evas_common_font_rgba_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, void evas_common_font_glyphs_ref(Evas_Glyph_Array *array) { - eina_lock_take(&array->lock); array->refcount++; - eina_lock_release(&array->lock); } void evas_common_font_glyphs_unref(Evas_Glyph_Array *array) { - eina_lock_take(&array->lock); - if (--array->refcount) - { - eina_lock_release(&array->lock); - return; - } - - eina_lock_release(&array->lock); - eina_lock_free(&array->lock); + if (--array->refcount) return; eina_inarray_free(array->array); free(array); @@ -301,14 +291,13 @@ evas_common_font_draw_prepare(Evas_Text_Props *text_props) * reference is only used to use this from another thread, which is now * holding the reference. */ - if (text_props->glyphs) evas_common_font_glyphs_unref(text_props->glyphs); + if (text_props->glyphs) + evas_common_font_glyphs_unref(text_props->glyphs); text_props->glyphs = malloc(sizeof(*text_props->glyphs)); if (!text_props->glyphs) goto error; text_props->glyphs->refcount = 1; text_props->glyphs->array = glyphs; - if (!eina_lock_new(&text_props->glyphs->lock)) - CRIT("Could not create glyph array lock"); /* check if there's a request queue in fi, if so ask cserve2 to render * those glyphs diff --git a/src/lib/evas/common/evas_text_utils.h b/src/lib/evas/common/evas_text_utils.h index 7ce2526834..36a8895a37 100644 --- a/src/lib/evas/common/evas_text_utils.h +++ b/src/lib/evas/common/evas_text_utils.h @@ -25,7 +25,6 @@ struct _Evas_Glyph_Array { Eina_Inarray *array; unsigned int refcount; - Eina_Lock lock; }; struct _Evas_Text_Props diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c index 93754b6220..e3671fd411 100644 --- a/src/modules/evas/engines/software_generic/evas_engine.c +++ b/src/modules/evas/engines/software_generic/evas_engine.c @@ -1950,7 +1950,8 @@ _draw_thread_font_draw(void *data) font->ext.x, font->ext.y, font->ext.w, font->ext.h, font->im_w, font->im_h); - evas_common_font_glyphs_unref(font->glyphs); + evas_async_events_put(font->glyphs, 0, NULL, + (Evas_Async_Events_Put_Cb)evas_common_font_glyphs_unref); eina_mempool_free(_mp_command_font, font); }