evas/async_render: do not use async event to unref image maps

SVN revision: 82663
This commit is contained in:
Ulisses Furquim 2013-01-11 19:56:17 +00:00
parent d5f91fd5c2
commit d45a54a0aa
8 changed files with 65 additions and 33 deletions

View File

@ -3164,6 +3164,31 @@ _draw_image(Evas_Object_Protected_Data *obj,
}
}
void
evas_draw_image_map_async_check(Evas_Object_Protected_Data *obj,
void *data, void *context, void *surface,
void *image, RGBA_Map *m, int smooth, int level,
Eina_Bool do_async)
{
Eina_Bool async_unref;
async_unref = obj->layer->evas->engine.func->image_map_draw(data, context,
surface, image, m,
smooth, level,
do_async);
if (do_async && async_unref)
{
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
evas_cache2_image_ref((Image_Entry *)image);
else
#endif
evas_cache_image_ref((Image_Entry *)image);
evas_unref_queue_image_put(obj->layer->evas, image);
}
}
static void
evas_object_image_render(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, void *output, void *context, void *surface, int x, int y, Eina_Bool do_async)
{
@ -3312,10 +3337,9 @@ evas_object_image_render(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, v
{
evas_object_map_update(eo_obj, x, y, imagew, imageh, uvw, uvh);
obj->layer->evas->engine.func->image_map_draw
(output, context, surface, pixels, obj->spans,
o->cur.smooth_scale | obj->cur.map->smooth, 0,
do_async);
evas_draw_image_map_async_check(
obj, output, context, surface, pixels, obj->spans,
o->cur.smooth_scale | obj->cur.map->smooth, 0, do_async);
}
else
{

View File

@ -1113,10 +1113,10 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
{
obj->layer->evas->engine.func->context_multiplier_unset
(e->engine.data.output, context);
obj->layer->evas->engine.func->image_map_draw
(e->engine.data.output, context, surface,
obj->map.surface, obj->spans,
obj->cur.map->smooth, 0, do_async);
evas_draw_image_map_async_check
(obj, e->engine.data.output, context, surface,
obj->map.surface, obj->spans,
obj->cur.map->smooth, 0, do_async);
}
// FIXME: needs to cache these maps and
// keep them only rendering updates

View File

@ -864,7 +864,7 @@ struct _Evas_Func
int (*image_scale_hint_get) (void *data, void *image);
int (*font_last_up_to_pos) (void *data, Evas_Font_Set *font, const Evas_Text_Props *intl_props, int x, int y);
void (*image_map_draw) (void *data, void *context, void *surface, void *image, RGBA_Map *m, int smooth, int level, Eina_Bool do_async);
Eina_Bool (*image_map_draw) (void *data, void *context, void *surface, void *image, RGBA_Map *m, int smooth, int level, Eina_Bool do_async);
void *(*image_map_surface_new) (void *data, int w, int h, int alpha);
void (*image_map_surface_free) (void *data, void *surface);
void (*image_map_clean) (void *data, RGBA_Map *m);
@ -1052,6 +1052,10 @@ void _evas_object_textblock_rehint(Evas_Object *obj);
void evas_unref_queue_image_put(Evas_Public_Data *pd, void *image);
void evas_unref_queue_glyph_put(Evas_Public_Data *pd, void *glyph);
void evas_draw_image_map_async_check(Evas_Object_Protected_Data *obj,
void *data, void *context, void *surface,
void *image, RGBA_Map *m, int smooth,
int level, Eina_Bool do_async);
void evas_font_draw_async_check(Evas_Object_Protected_Data *obj,
void *data, void *context, void *surface,
Evas_Font_Set *font,

View File

@ -900,14 +900,14 @@ eng_image_scale_hint_get(void *data EINA_UNUSED, void *image)
return gim->scale_hint;
}
static void
static Eina_Bool
eng_image_map_draw(void *data EINA_UNUSED, void *context, void *surface, void *image, RGBA_Map *m, int smooth, int level)
{
Evas_GL_Image *gim = image;
Render_Engine *re;
re = (Render_Engine *)data;
if (!image) return;
if (!image) return EINA_FALSE;
eng_window_use(re->win);
evas_gl_common_context_target_surface_set(re->win->gl_context, surface);
re->win->gl_context->dc = context;
@ -949,6 +949,8 @@ eng_image_map_draw(void *data EINA_UNUSED, void *context, void *surface, void *i
evas_gl_common_image_map_draw(re->win->gl_context, image, m->count, &m->pts[0],
smooth, level);
}
return EINA_FALSE;
}
static void *

View File

@ -830,7 +830,7 @@ eng_image_scale_hint_set(void *data EINA_UNUSED, void *image, int hint)
if (image) evas_gl_common_image_scale_hint_set(image, hint);
}
static void
static Eina_Bool
eng_image_map_draw(void *data EINA_UNUSED, void *context, void *surface, void *image, RGBA_Map *m, int smooth, int level)
{
Evas_GL_Image *gim = image;
@ -877,6 +877,8 @@ eng_image_map_draw(void *data EINA_UNUSED, void *context, void *surface, void *i
evas_gl_common_image_map_draw(re->gl_context, image, m->count, &m->pts[0],
smooth, level);
}
return EINA_FALSE;
}
static void *

View File

@ -2479,14 +2479,14 @@ eng_image_scale_hint_get(void *data EINA_UNUSED, void *image)
return gim->scale_hint;
}
static void
static Eina_Bool
eng_image_map_draw(void *data, void *context, void *surface, void *image, RGBA_Map *m, int smooth, int level, Eina_Bool do_async)
{
Evas_GL_Image *gim = image;
Render_Engine *re;
re = (Render_Engine *)data;
if (!image) return;
if (!image) return EINA_FALSE;
eng_window_use(re->win);
evas_gl_common_context_target_surface_set(re->win->gl_context, surface);
re->win->gl_context->dc = context;
@ -2528,6 +2528,8 @@ eng_image_map_draw(void *data, void *context, void *surface, void *image, RGBA_M
evas_gl_common_image_map_draw(re->win->gl_context, image, m->count, &m->pts[0],
smooth, level);
}
return EINA_FALSE;
}
static void

View File

@ -1473,7 +1473,6 @@ _draw_thread_map_draw(void *data)
free_out:
free(m); // FIXME: allocating and destroying map do have perf impact... ref counting would be better
evas_async_events_put(map->image, 0, NULL, _drop_cache_ref);
eina_mempool_free(_mp_command_map, map);
}
@ -1483,15 +1482,8 @@ _map_draw_thread_cmd(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, RG
Evas_Thread_Command_Map *cm;
int clip_x, clip_y, clip_w, clip_h;
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
evas_cache2_image_ref((Image_Entry *)src);
else
#endif
evas_cache_image_ref((Image_Entry *)src);
cm = eina_mempool_malloc(_mp_command_map, sizeof (Evas_Thread_Command_Map));
if (!cm) return ;
if (!cm) return;
cm->image = src;
memcpy(&cm->image_ctx, dc, sizeof(*dc));
@ -1536,7 +1528,7 @@ _map_draw_thread_cmd(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, RG
}
static void
evas_software_image_map_draw(void *data, void *context, RGBA_Image *surface, RGBA_Image *im, RGBA_Map *m, int smooth, int level, int offset, Eina_Bool do_async)
evas_software_image_map_draw(void *data, void *context, RGBA_Image *surface, RGBA_Image *im, RGBA_Map *m, int smooth, int level, int offset)
{
if (m->count - offset < 3) return;
@ -1569,7 +1561,7 @@ evas_software_image_map_draw(void *data, void *context, RGBA_Image *surface, RGB
(data, context, surface, im,
0, 0, im->cache_entry.w, im->cache_entry.h,
dx, dy, dw, dh, smooth,
do_async);
EINA_FALSE);
}
else
{
@ -1589,17 +1581,17 @@ evas_software_image_map_draw(void *data, void *context, RGBA_Image *surface, RGB
if (m->count > 4)
{
evas_software_image_map_draw(data, context, surface, im, m, smooth, level, offset + 2, do_async);
evas_software_image_map_draw(data, context, surface, im, m, smooth, level, offset + 2);
}
}
static void
static Eina_Bool
eng_image_map_draw(void *data, void *context, void *surface, void *image, RGBA_Map *m, int smooth, int level, Eina_Bool do_async)
{
RGBA_Image *im = image;
if (!im) return;
if (m->count < 3) return;
if (!im) return EINA_FALSE;
if (m->count < 3) return EINA_FALSE;
if (do_async)
{
@ -1616,16 +1608,20 @@ eng_image_map_draw(void *data, void *context, void *surface, void *image, RGBA_M
#endif
evas_cache_image_load_data(&im->cache_entry);
if (!im->cache_entry.flags.loaded) return;
if (!im->cache_entry.flags.loaded) return EINA_FALSE;
}
evas_common_map_thread_rgba_cb(im, surface, context,
m, smooth, level, 0,
_map_draw_thread_cmd);
return EINA_TRUE;
}
else
evas_software_image_map_draw(data, context, surface, im, m,
smooth, level, 0, do_async);
smooth, level, 0);
return EINA_FALSE;
}
static void

View File

@ -1923,14 +1923,14 @@ eng_image_scale_hint_get(void *data EINA_UNUSED, void *image)
return gim->scale_hint;
}
static void
static Eina_Bool
eng_image_map_draw(void *data, void *context, void *surface, void *image, RGBA_Map *m, int smooth, int level)
{
Evas_GL_Image *gim = image;
Render_Engine *re;
re = (Render_Engine *)data;
if (!image) return;
if (!image) return EINA_FALSE;
eng_window_use(re->win);
evas_gl_common_context_target_surface_set(re->win->gl_context, surface);
re->win->gl_context->dc = context;
@ -1972,6 +1972,8 @@ eng_image_map_draw(void *data, void *context, void *surface, void *image, RGBA_M
evas_gl_common_image_map_draw(re->win->gl_context, image, m->count,
&m->pts[0], smooth, level);
}
return EINA_FALSE;
}
static void *