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 <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9639
This commit is contained in:
subhransu mohanty 2019-08-20 06:21:10 +00:00 committed by Cedric BAIL
parent bc0bd4eb3f
commit 676835458f
3 changed files with 8 additions and 5 deletions

View File

@ -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);

View File

@ -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

View File

@ -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;
}
}