diff options
author | subhransu mohanty <sub.mohanty@samsung.com> | 2019-08-29 14:31:52 -0400 |
---|---|---|
committer | Mike Blumenkrantz <zmike@samsung.com> | 2019-08-29 14:31:52 -0400 |
commit | 5370c2e7957cfec1b4bf8eff65dfe0e7a6547263 (patch) | |
tree | d65ed99bcfbaf365ff1a55fa9dca90c0b39fe0f0 | |
parent | 35e385a1ec8d5193922ff478eb8fbf6f0cb6332e (diff) | |
download | efl-5370c2e7957cfec1b4bf8eff65dfe0e7a6547263.tar.gz |
edje/optimization: refactor edje_color_class_set() api.
Summary:
During _elm_config_color_overlay_apply() application can call this api
100's of time depending on how many overlay it wants add . As each color_class
set triggers the global color class apply chain 3 times (for color , outline and shadow)
just club them once and emit single color_class,set event.
Reviewers: Hermet, ali.alzyod, zmike
Reviewed By: zmike
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9784
-rw-r--r-- | src/lib/edje/edje_util.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index 0e74e79855..450015f8d6 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -680,13 +680,21 @@ _edje_color_class_get_internal(Edje_Color_Class *cc, Efl_Gfx_Color_Class_Layer l EAPI Eina_Bool edje_color_class_set(const char *color_class, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3) { - Eina_Bool int_ret = EINA_TRUE; + Eina_Bool result = EINA_TRUE; + Eina_Bool normal = EINA_FALSE , outline = EINA_FALSE , shadow = EINA_FALSE; - int_ret &= efl_gfx_color_class_set(_edje_global(), color_class, EFL_GFX_COLOR_CLASS_LAYER_NORMAL, r, g, b, a); - int_ret &= efl_gfx_color_class_set(_edje_global(), color_class, EFL_GFX_COLOR_CLASS_LAYER_OUTLINE, r2, g2, b2, a2); - int_ret &= efl_gfx_color_class_set(_edje_global(), color_class, EFL_GFX_COLOR_CLASS_LAYER_SHADOW, r3, g3, b3, a3); + if (!_edje_color_class_hash) + _edje_color_class_hash = eina_hash_string_superfast_new(NULL); - return int_ret; + result &= _edje_color_class_set_internal(_edje_color_class_hash, color_class, EFL_GFX_COLOR_CLASS_LAYER_NORMAL, r, g, b, a, &normal); + result &= _edje_color_class_set_internal(_edje_color_class_hash, color_class, EFL_GFX_COLOR_CLASS_LAYER_OUTLINE, r2, g2, b2, a2, &outline); + result &= _edje_color_class_set_internal(_edje_color_class_hash, color_class, EFL_GFX_COLOR_CLASS_LAYER_SHADOW, r3, g3, b3, a3, &shadow); + + // either of them changes then request an update. + if (result && (normal || outline || shadow)) + efl_observable_observers_update(_edje_color_class_member, color_class, "color_class,set"); + + return result; } EOLIAN Eina_Bool |