diff options
author | Hermet Park <chuneon.park@samsung.com> | 2020-04-06 17:14:40 +0900 |
---|---|---|
committer | Hermet Park <chuneon.park@samsung.com> | 2020-04-06 17:18:21 +0900 |
commit | dc2124aa13b5f4d13102ac302d0e57dcc6c598d9 (patch) | |
tree | 5c2c98a6aa731e3845e6928311142f81d16181f2 | |
parent | e3224ead98f2bea44fc92184c33edcbca98341b4 (diff) | |
download | efl-dc2124aa13b5f4d13102ac302d0e57dcc6c598d9.tar.gz |
ui textpath: update map before rendering begins.
previously, textpath delays the map calculation to avoid duplicated jobs.
some cases, this job could be delayed to the next frame that occured a
wrong frame result.
This render_pre event gurantees the textpath to update frames exactly.
@fix
-rw-r--r-- | src/lib/elementary/efl_ui_textpath.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/lib/elementary/efl_ui_textpath.c b/src/lib/elementary/efl_ui_textpath.c index a3bac40522..81d6cd5245 100644 --- a/src/lib/elementary/efl_ui_textpath.c +++ b/src/lib/elementary/efl_ui_textpath.c @@ -70,6 +70,7 @@ struct _Efl_Ui_Textpath_Data #ifdef EFL_UI_TEXTPATH_LINE_DEBUG Eina_List *lines; #endif + Eina_Bool need_redraw : 1; Eina_Bool circular : 1; //TODO: Remove this flag when elm_textpath_circle_set() is removed. }; @@ -329,9 +330,8 @@ _map_point_calc(Efl_Ui_Textpath_Data *pd) } static void -_text_draw(void *data) +_text_draw(Efl_Ui_Textpath_Data *pd) { - Efl_Ui_Textpath_Data *pd = data; Efl_Ui_Textpath_Segment *seg; Evas_Map *map; int w1, w2; @@ -399,7 +399,13 @@ _text_draw(void *data) evas_object_map_set(pd->text_obj, map); evas_map_free(map); - pd->draw_text_job = NULL; + pd->need_redraw = EINA_FALSE; +} + +static void +_render_pre_cb(void *data, Evas *e EINA_UNUSED, void *ev EINA_UNUSED) +{ + _text_draw(data); } static void @@ -523,8 +529,7 @@ _path_data_get(Eo *obj, Efl_Ui_Textpath_Data *pd) static void _sizing_eval(Efl_Ui_Textpath_Data *pd) { - ecore_job_del(pd->draw_text_job); - pd->draw_text_job = ecore_job_add(_text_draw, pd); + pd->need_redraw = EINA_TRUE; } static void @@ -698,12 +703,16 @@ _efl_ui_textpath_efl_object_constructor(Eo *obj, Efl_Ui_Textpath_Data *pd) pd->slice_no = SLICE_DEFAULT_NO; pd->direction = EFL_UI_TEXTPATH_DIRECTION_CW; + evas_event_callback_add(evas_object_evas_get(obj), EVAS_CALLBACK_RENDER_PRE, _render_pre_cb, pd); + return obj; } EOLIAN static void _efl_ui_textpath_efl_object_destructor(Eo *obj, Efl_Ui_Textpath_Data *pd) { + evas_event_callback_del_full(evas_object_evas_get(obj), EVAS_CALLBACK_RENDER_PRE, _render_pre_cb, pd); + Efl_Ui_Textpath_Segment *seg; if (pd->text) free(pd->text); @@ -713,7 +722,6 @@ _efl_ui_textpath_efl_object_destructor(Eo *obj, Efl_Ui_Textpath_Data *pd) pd->segments = eina_inlist_remove(pd->segments, EINA_INLIST_GET(seg)); free(seg); } - ecore_job_del(pd->draw_text_job); #ifdef EFL_UI_TEXTPATH_LINE_DEBUG Evas_Object *line; |