From af6d354ce730ce81b33be10cea30dc7aa0220259 Mon Sep 17 00:00:00 2001 From: subhransu mohanty Date: Wed, 4 Sep 2019 09:51:50 +0900 Subject: [PATCH] edje/textstyle/optimization: Optimize code as textblock style handle logic changes. As tizen keeps a per object textblock style we don't need to clear the file level textstyle as we never refer it. So cleanup the logic which will be similar to opensource and performs much better than current logic. Change-Id: I73905ee2e90a4e11496f902c04cbb7de9da38bb9 --- src/lib/edje/edje_cache.c | 65 +----------------------------------- src/lib/edje/edje_private.h | 8 ----- src/lib/edje/edje_textblock_styles.c | 49 ++++++++------------------- src/lib/edje/edje_util.c | 37 -------------------- 4 files changed, 14 insertions(+), 145 deletions(-) diff --git a/src/lib/edje/edje_cache.c b/src/lib/edje/edje_cache.c index d51fc73..6353306 100644 --- a/src/lib/edje/edje_cache.c +++ b/src/lib/edje/edje_cache.c @@ -891,67 +891,4 @@ edje_collection_cache_flush(void) _edje_cache_coll_flush(edf); /* FIXME: freach in file hash too! */ _edje_collection_cache_size = ps; -} - -/*********************************************************************************** - * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * - ***********************************************************************************/ -static Eina_Bool -_textblock_styles_color_class_cache_free(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata) -{ - Edje_File *edf = data; - char *color_class = fdata; - - _edje_file_textblock_style_all_update_color_class(edf, color_class); - - return EINA_TRUE; -} - -void -_edje_global_textblock_styles_color_class_cache_free(const char *class_name) -{ - if (!class_name) return; - if (!_edje_file_hash) return; - - eina_hash_foreach(_edje_file_hash, _textblock_styles_color_class_cache_free, class_name); -} - -static Eina_Bool -_textblock_styles_text_class_cache_free(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata) -{ - Edje_File *edf = data; - char *text_class = fdata; - - _edje_file_textblock_style_all_update_text_class(edf, text_class); - - return EINA_TRUE; -} - -void -_edje_global_textblock_styles_text_class_cache_free(const char *class_name) -{ - if (!class_name) return; - if (!_edje_file_hash) return; - - eina_hash_foreach(_edje_file_hash, _textblock_styles_text_class_cache_free, class_name); -} - -static Eina_Bool -_textblock_styles_cache_update(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata EINA_UNUSED) -{ - Edje_File *edf = data; - _edje_file_textblock_style_all_update(edf); - - return EINA_TRUE; -} - -void -_edje_file_textblock_styles_cache_update(void) -{ - if (!_edje_file_hash) return; - - eina_hash_foreach(_edje_file_hash, _textblock_styles_cache_update, NULL); -} -/******* - * END * - *******/ +} \ No newline at end of file diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 84e6cfe..96178f1 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -2965,14 +2965,6 @@ void _edje_file_textblock_style_all_update(Edje_File *ed); void _edje_file_textblock_style_all_update_text_class(Edje_File *edf, const char *text_class); void _edje_file_textblock_style_parse_and_fix(Edje_File *edf); void _edje_file_textblock_style_cleanup(Edje_File *edf); -// tizen only file level style api -void _edje_file_textblock_style_all_update_color_class(Edje_File *edf, const char *color_class); -// end - -// tizen only global level (all the opend files) style api -void _edje_global_textblock_styles_color_class_cache_free(const char *color_class); -void _edje_global_textblock_styles_text_class_cache_free(const char *text_class); -// end Edje_File *_edje_cache_file_coll_open(const Eina_File *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret, Edje *ed); void _edje_cache_coll_clean(Edje_File *edf); diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index c42d7ec..c55e95b 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -572,8 +572,13 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl) * @param ed The edje containing styles which need to be updated */ void -_edje_file_textblock_style_all_update(Edje_File *edf) +_edje_file_textblock_style_all_update(Edje_File *edf EINA_UNUSED) { + //As tizen keeps a style per object we don't have to + // update the style in file level when global text class or + // color class is changed. + return; + /* TIZEN ONLY Eina_List *l; Edje_Style *stl; @@ -581,6 +586,7 @@ _edje_file_textblock_style_all_update(Edje_File *edf) EINA_LIST_FOREACH(edf->styles, l, stl) if (stl && !stl->readonly) stl->cache = EINA_FALSE; + */ } static inline Edje_Style * @@ -740,8 +746,12 @@ _edje_textblock_style_get(Edje *ed, const char *style) * updates them. */ void -_edje_file_textblock_style_all_update_text_class(Edje_File *edf, const char *text_class) +_edje_file_textblock_style_all_update_text_class(Edje_File *edf EINA_UNUSED, const char *text_class EINA_UNUSED) { + //As tizen keeps a style per object we don't have to + // update the style in file level when global text class is changed + return; + /* TIZEN ONLY Eina_List *l, *ll; Edje_Style *stl; @@ -767,40 +777,7 @@ _edje_file_textblock_style_all_update_text_class(Edje_File *edf, const char *tex } } } -} - -/* - * Finds all the styles having text class tag as text_class and - * updates them. - */ -void -_edje_file_textblock_style_all_update_color_class(Edje_File *edf, const char *color_class) -{ - Eina_List *l, *ll; - Edje_Style *stl; - - if (!edf) return; - if (!color_class) return; - - EINA_LIST_FOREACH(edf->styles, l, stl) - { - Edje_Style_Tag *tag; - - if (stl->readonly) continue; - - EINA_LIST_FOREACH(stl->tags, ll, tag) - { - if (!tag->color_class) continue; - - if (!strcmp(tag->color_class, color_class)) - { - // just mark it dirty so the next request - // for this style will trigger recomputation. - stl->cache = EINA_FALSE; - break; - } - } - } + */ } /* When we get to here the edje file had been read into memory diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index ea0f74a..9772847 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -733,21 +733,8 @@ _edje_global_efl_gfx_color_class_color_class_set(Eo *obj EINA_UNUSED, void *pd E int_ret = _edje_color_class_set_internal(_edje_color_class_hash, color_class, layer, r, g, b, a, &need_update); - /*********************************************************************************** - * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * - *********************************************************************************** if ((int_ret) && (need_update)) efl_observable_observers_update(_edje_color_class_member, color_class, "color_class,set"); - */ - if ((int_ret) && (need_update)) - { - _edje_global_textblock_styles_color_class_cache_free(color_class); - - efl_observable_observers_update(_edje_color_class_member, color_class, "color_class,set"); - } - /******* - * END * - *******/ return int_ret; } @@ -798,14 +785,6 @@ _edje_global_efl_gfx_color_class_color_class_del(Eo *obj EINA_UNUSED, void *pd E eina_stringshare_del(cc->name); free(cc); - /*********************************************************************************** - * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * - ***********************************************************************************/ - _edje_global_textblock_styles_color_class_cache_free(color_class); - /******* - * END * - *******/ - efl_observable_observers_update(_edje_color_class_member, color_class, "color_class,del"); } @@ -1271,14 +1250,6 @@ _edje_global_efl_gfx_text_class_text_class_set(Eo *obj EINA_UNUSED, void *pd EIN tc->size = size; } - /*********************************************************************************** - * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * - ***********************************************************************************/ - _edje_global_textblock_styles_text_class_cache_free(text_class); - /******* - * END * - *******/ - /* Tell all members of the text class to recalc */ efl_observable_observers_update(_edje_text_class_member, text_class, NULL); @@ -1337,14 +1308,6 @@ _edje_global_efl_gfx_text_class_text_class_del(Eo *obj EINA_UNUSED, void *pd EIN eina_stringshare_del(tc->font); free(tc); - /*********************************************************************************** - * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * - ***********************************************************************************/ - _edje_global_textblock_styles_text_class_cache_free(text_class); - /******* - * END * - *******/ - efl_observable_observers_update(_edje_text_class_member, text_class, NULL); } -- 2.7.4