From 676835458fbdc8702deae06a69b1223db97a525b Mon Sep 17 00:00:00 2001 From: subhransu mohanty Date: Tue, 20 Aug 2019 06:21:10 +0000 Subject: [PATCH] edje/style: optimize updation of styles for a given text_style Currently we do 2 pass updation. first we scan through all the styles and check if they have text_style which matches the test_style we need to update then we mark them dirty. then we call style_all_update() to go through the list again and update those styles. By combining them both in a single function we avoid scanning through the whole list again. Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D9639 --- src/lib/edje/edje_private.h | 2 +- src/lib/edje/edje_smart.c | 3 +-- src/lib/edje/edje_textblock_styles.c | 8 ++++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index f054fa25a2..44dd3fe34c 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -2788,7 +2788,7 @@ void _edje_message_del (Edje *ed); void _edje_textblock_styles_add(Edje *ed, Edje_Real_Part *ep); void _edje_textblock_styles_del(Edje *ed, Edje_Part *pt); -void _edje_textblock_styles_cache_free(Edje *ed, const char *text_class); +void _edje_textblock_style_all_update_text_class(Edje *ed, const char *text_class); void _edje_textblock_style_all_update(Edje *ed); void _edje_textblock_style_parse_and_fix(Edje_File *edf); void _edje_textblock_style_cleanup(Edje_File *edf); diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index 977832015f..1549962109 100644 --- a/src/lib/edje/edje_smart.c +++ b/src/lib/edje/edje_smart.c @@ -481,8 +481,7 @@ _efl_canvas_layout_efl_observer_update(Eo *obj EINA_UNUSED, Edje *ed, Efl_Object } else if (obs == _edje_text_class_member) { - _edje_textblock_styles_cache_free(ed, key); - _edje_textblock_style_all_update(ed); + _edje_textblock_style_all_update_text_class(ed, key); #ifdef EDJE_CALC_CACHE ed->text_part_change = EINA_TRUE; #endif diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index 43d75a5d44..aee7f708b7 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -366,8 +366,12 @@ _edje_textblock_styles_del(Edje *ed, Edje_Part *pt) } } +/* + * Finds all the styles having text class tag as text_class and + * updates them. + */ void -_edje_textblock_styles_cache_free(Edje *ed, const char *text_class) +_edje_textblock_style_all_update_text_class(Edje *ed, const char *text_class) { Eina_List *l, *ll; Edje_Style *stl; @@ -387,7 +391,7 @@ _edje_textblock_styles_cache_free(Edje *ed, const char *text_class) if (!strcmp(tag->text_class, text_class)) { - stl->cache = EINA_FALSE; + _edje_textblock_style_update(ed, stl, EINA_TRUE); break; } }