evas: Add a very simple post-render job list

This will be used by the filters
This commit is contained in:
Jean-Philippe Andre 2016-12-22 20:46:49 +09:00
parent b2a4039bda
commit c2ba0939d8
3 changed files with 55 additions and 0 deletions

View File

@ -240,6 +240,7 @@ _evas_canvas_efl_object_constructor(Eo *eo_obj, Evas_Public_Data *e)
#undef EVAS_ARRAY_SET
eina_lock_new(&(e->lock_objects));
eina_spinlock_new(&(e->render.lock));
eina_spinlock_new(&(e->post_render.lock));
_evas_canvas_event_init(eo_obj, e);
@ -266,6 +267,7 @@ _evas_canvas_efl_object_destructor(Eo *eo_e, Evas_Public_Data *e)
{
Eina_Rectangle *r;
Evas_Coord_Touch_Point *touch_point;
Evas_Post_Render_Job *job;
Evas_Layer *lay;
Evas_Out *evo;
int i;
@ -383,6 +385,13 @@ _evas_canvas_efl_object_destructor(Eo *eo_e, Evas_Public_Data *e)
eina_array_flush(&e->texts_unref_queue);
eina_hash_free(e->focused_objects);
EINA_INLIST_FREE(e->post_render.jobs, job)
{
e->post_render.jobs = (Evas_Post_Render_Job *)
eina_inlist_remove(EINA_INLIST_GET(e->post_render.jobs), EINA_INLIST_GET(job));
free(job);
}
EINA_LIST_FREE(e->touch_points, touch_point)
free(touch_point);
@ -397,6 +406,7 @@ _evas_canvas_efl_object_destructor(Eo *eo_e, Evas_Public_Data *e)
eina_lock_free(&(e->lock_objects));
eina_spinlock_free(&(e->render.lock));
eina_spinlock_free(&(e->post_render.lock));
eina_hash_free(e->locks.masks);
eina_hash_free(e->modifiers.masks);

View File

@ -3440,7 +3440,9 @@ evas_render_wakeup(Evas *eo_e)
Render_Updates *ru;
Eina_Bool haveup = EINA_FALSE;
Eina_List *ret_updates = NULL;
Evas_Post_Render_Job *job;
Evas_Public_Data *evas;
Eina_Inlist *jobs_il;
evas = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
@ -3483,6 +3485,18 @@ evas_render_wakeup(Evas *eo_e)
eina_array_foreach(&evas->texts_unref_queue, _drop_texts_ref, NULL);
eina_array_clean(&evas->texts_unref_queue);
SLKL(evas->post_render.lock);
jobs_il = EINA_INLIST_GET(evas->post_render.jobs);
evas->post_render.jobs = NULL;
SLKU(evas->post_render.lock);
EINA_INLIST_FREE(jobs_il, job)
{
jobs_il = eina_inlist_remove(jobs_il, EINA_INLIST_GET(job));
if (job->func)
job->func(job->data);
free(job);
}
/* post rendering */
_rendering_evases = eina_list_remove(_rendering_evases, evas);
evas->rendering = EINA_FALSE;
@ -3864,5 +3878,23 @@ evas_unref_queue_texts_put(Evas_Public_Data *pd, void *texts)
eina_array_push(&pd->texts_unref_queue, texts);
}
void
evas_post_render_job_add(Evas_Public_Data *pd, void (*func)(void *), void *data)
{
Evas_Post_Render_Job *job;
if (!pd || pd->delete_me) return;
if (!func) return;
job = malloc(sizeof(*job));
job->func = func;
job->data = data;
SLKL(pd->post_render.lock);
pd->post_render.jobs = (Evas_Post_Render_Job *)
eina_inlist_append(EINA_INLIST_GET(pd->post_render.jobs), EINA_INLIST_GET(job));
SLKU(pd->post_render.lock);
}
/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/

View File

@ -817,6 +817,13 @@ struct _Evas_Pointer_Data
unsigned char inside : 1;
};
typedef struct _Evas_Post_Render_Job
{
EINA_INLIST;
void (*func)(void *);
void *data;
} Evas_Post_Render_Job;
struct _Evas_Public_Data
{
EINA_INLIST;
@ -889,6 +896,11 @@ struct _Evas_Public_Data
Eina_Array glyph_unref_queue;
Eina_Array texts_unref_queue;
struct {
Evas_Post_Render_Job *jobs;
Eina_Spinlock lock;
} post_render;
Eina_Clist calc_list;
Eina_Clist calc_done;
Eina_List *video_objects;
@ -1714,6 +1726,7 @@ 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_unref_queue_texts_put(Evas_Public_Data *pd, void *glyph);
void evas_post_render_job_add(Evas_Public_Data *pd, void (*func)(void *), void *data);
void evas_draw_image_map_async_check(Evas_Object_Protected_Data *obj,
void *data, void *context, void *surface,