evas: Do not use an Eina_Lock for glyph array

Patch by: Leandro Pereira <leandro@profusion.mobi>



SVN revision: 82659
This commit is contained in:
Leandro Pereira 2013-01-11 19:48:28 +00:00 committed by Ulisses Furquim
parent 5eaba08284
commit 468b44c444
3 changed files with 5 additions and 16 deletions

View File

@ -225,23 +225,13 @@ evas_common_font_rgba_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y,
void void
evas_common_font_glyphs_ref(Evas_Glyph_Array *array) evas_common_font_glyphs_ref(Evas_Glyph_Array *array)
{ {
eina_lock_take(&array->lock);
array->refcount++; array->refcount++;
eina_lock_release(&array->lock);
} }
void void
evas_common_font_glyphs_unref(Evas_Glyph_Array *array) evas_common_font_glyphs_unref(Evas_Glyph_Array *array)
{ {
eina_lock_take(&array->lock); if (--array->refcount) return;
if (--array->refcount)
{
eina_lock_release(&array->lock);
return;
}
eina_lock_release(&array->lock);
eina_lock_free(&array->lock);
eina_inarray_free(array->array); eina_inarray_free(array->array);
free(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 * reference is only used to use this from another thread, which is now
* holding the reference. * 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)); text_props->glyphs = malloc(sizeof(*text_props->glyphs));
if (!text_props->glyphs) goto error; if (!text_props->glyphs) goto error;
text_props->glyphs->refcount = 1; text_props->glyphs->refcount = 1;
text_props->glyphs->array = glyphs; 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 /* check if there's a request queue in fi, if so ask cserve2 to render
* those glyphs * those glyphs

View File

@ -25,7 +25,6 @@ struct _Evas_Glyph_Array
{ {
Eina_Inarray *array; Eina_Inarray *array;
unsigned int refcount; unsigned int refcount;
Eina_Lock lock;
}; };
struct _Evas_Text_Props struct _Evas_Text_Props

View File

@ -1950,7 +1950,8 @@ _draw_thread_font_draw(void *data)
font->ext.x, font->ext.y, font->ext.w, font->ext.h, font->ext.x, font->ext.y, font->ext.w, font->ext.h,
font->im_w, font->im_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); eina_mempool_free(_mp_command_font, font);
} }