evas/render: introduce evas_render_sync().

evas_render_sync() will loop through all canvases and wait for their
rendering to finish. Since this function will execute from the main
thread that will sync all of them.
This commit is contained in:
Ulisses Furquim 2013-09-02 19:38:52 -03:00
parent 932a7a00cd
commit 31b1cc6e3e
4 changed files with 28 additions and 0 deletions

View File

@ -16,8 +16,11 @@ EAPI Eina_Bool lockdebug = EINA_FALSE;
EAPI int lockmax = 0;
#endif
Eina_List *all_evases = NULL;
static int _evas_init_count = 0;
int _evas_log_dom_global = -1;
EAPI int
evas_init(void)
{
@ -108,6 +111,9 @@ evas_shutdown(void)
evas_object_image_load_opts_cow = NULL;
evas_object_image_state_cow = NULL;
eina_list_free(all_evases);
all_evases = NULL;
evas_thread_shutdown();
_evas_preload_thread_shutdown();
evas_async_events_shutdown();
@ -171,6 +177,8 @@ _constructor(Eo *eo_obj, void *class_data, va_list *list EINA_UNUSED)
EVAS_ARRAY_SET(e, texts_unref_queue);
#undef EVAS_ARRAY_SET
all_evases = eina_list_append(all_evases, e);
}
EAPI void
@ -266,6 +274,8 @@ _destructor(Eo *eo_e, void *_pd, va_list *list EINA_UNUSED)
if (e->engine.module) evas_module_unref(e->engine.module);
all_evases = eina_list_remove(all_evases, e);
eina_array_flush(&e->delete_objects);
eina_array_flush(&e->active_objects);
eina_array_flush(&e->restack_objects);

View File

@ -1473,6 +1473,21 @@ evas_render_rendering_wait(Evas_Public_Data *evas)
while (evas->rendering) evas_async_events_process_blocking();
}
/* syncs ALL async rendering canvases */
void
evas_render_sync(void)
{
Eina_List *l;
void *d;
EINA_LIST_FOREACH(all_evases, l, d)
{
Evas_Public_Data *e = d;
if (!e->rendering) continue;
evas_render_rendering_wait(e);
}
}
static Eina_Bool
_drop_scie_ref(const void *container EINA_UNUSED, void *data, void *fdata EINA_UNUSED)
{

View File

@ -1248,6 +1248,7 @@ void evas_font_dir_cache_free(void);
EAPI int evas_async_events_process_blocking(void);
void evas_render_rendering_wait(Evas_Public_Data *evas);
void evas_render_sync(void);
void evas_thread_init(void);
void evas_thread_shutdown(void);

View File

@ -443,6 +443,8 @@ struct _Evas_Public_Data
Eina_Bool rendering : 1;
};
extern Eina_List *all_evases;
struct _Evas_Layer
{
EINA_INLIST;