summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHermet Park <chuneon.park@samsung.com>2020-04-06 17:14:40 +0900
committerHermet Park <chuneon.park@samsung.com>2020-04-06 17:18:21 +0900
commitdc2124aa13b5f4d13102ac302d0e57dcc6c598d9 (patch)
tree5c2c98a6aa731e3845e6928311142f81d16181f2
parente3224ead98f2bea44fc92184c33edcbca98341b4 (diff)
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.c20
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
70#ifdef EFL_UI_TEXTPATH_LINE_DEBUG 70#ifdef EFL_UI_TEXTPATH_LINE_DEBUG
71 Eina_List *lines; 71 Eina_List *lines;
72#endif 72#endif
73 Eina_Bool need_redraw : 1;
73 Eina_Bool circular : 1; //TODO: Remove this flag when elm_textpath_circle_set() is removed. 74 Eina_Bool circular : 1; //TODO: Remove this flag when elm_textpath_circle_set() is removed.
74}; 75};
75 76
@@ -329,9 +330,8 @@ _map_point_calc(Efl_Ui_Textpath_Data *pd)
329} 330}
330 331
331static void 332static void
332_text_draw(void *data) 333_text_draw(Efl_Ui_Textpath_Data *pd)
333{ 334{
334 Efl_Ui_Textpath_Data *pd = data;
335 Efl_Ui_Textpath_Segment *seg; 335 Efl_Ui_Textpath_Segment *seg;
336 Evas_Map *map; 336 Evas_Map *map;
337 int w1, w2; 337 int w1, w2;
@@ -399,7 +399,13 @@ _text_draw(void *data)
399 evas_object_map_set(pd->text_obj, map); 399 evas_object_map_set(pd->text_obj, map);
400 evas_map_free(map); 400 evas_map_free(map);
401 401
402 pd->draw_text_job = NULL; 402 pd->need_redraw = EINA_FALSE;
403}
404
405static void
406_render_pre_cb(void *data, Evas *e EINA_UNUSED, void *ev EINA_UNUSED)
407{
408 _text_draw(data);
403} 409}
404 410
405static void 411static void
@@ -523,8 +529,7 @@ _path_data_get(Eo *obj, Efl_Ui_Textpath_Data *pd)
523static void 529static void
524_sizing_eval(Efl_Ui_Textpath_Data *pd) 530_sizing_eval(Efl_Ui_Textpath_Data *pd)
525{ 531{
526 ecore_job_del(pd->draw_text_job); 532 pd->need_redraw = EINA_TRUE;
527 pd->draw_text_job = ecore_job_add(_text_draw, pd);
528} 533}
529 534
530static void 535static void
@@ -698,12 +703,16 @@ _efl_ui_textpath_efl_object_constructor(Eo *obj, Efl_Ui_Textpath_Data *pd)
698 pd->slice_no = SLICE_DEFAULT_NO; 703 pd->slice_no = SLICE_DEFAULT_NO;
699 pd->direction = EFL_UI_TEXTPATH_DIRECTION_CW; 704 pd->direction = EFL_UI_TEXTPATH_DIRECTION_CW;
700 705
706 evas_event_callback_add(evas_object_evas_get(obj), EVAS_CALLBACK_RENDER_PRE, _render_pre_cb, pd);
707
701 return obj; 708 return obj;
702} 709}
703 710
704EOLIAN static void 711EOLIAN static void
705_efl_ui_textpath_efl_object_destructor(Eo *obj, Efl_Ui_Textpath_Data *pd) 712_efl_ui_textpath_efl_object_destructor(Eo *obj, Efl_Ui_Textpath_Data *pd)
706{ 713{
714 evas_event_callback_del_full(evas_object_evas_get(obj), EVAS_CALLBACK_RENDER_PRE, _render_pre_cb, pd);
715
707 Efl_Ui_Textpath_Segment *seg; 716 Efl_Ui_Textpath_Segment *seg;
708 717
709 if (pd->text) free(pd->text); 718 if (pd->text) free(pd->text);
@@ -713,7 +722,6 @@ _efl_ui_textpath_efl_object_destructor(Eo *obj, Efl_Ui_Textpath_Data *pd)
713 pd->segments = eina_inlist_remove(pd->segments, EINA_INLIST_GET(seg)); 722 pd->segments = eina_inlist_remove(pd->segments, EINA_INLIST_GET(seg));
714 free(seg); 723 free(seg);
715 } 724 }
716 ecore_job_del(pd->draw_text_job);
717 725
718#ifdef EFL_UI_TEXTPATH_LINE_DEBUG 726#ifdef EFL_UI_TEXTPATH_LINE_DEBUG
719 Evas_Object *line; 727 Evas_Object *line;