diff options
author | woochan lee <wc0917.lee@samsung.com> | 2015-11-09 12:25:27 -0800 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2015-11-09 12:37:09 -0800 |
commit | cf94160b6bd9a1180c8a1fdcb35b8ee1e055f37f (patch) | |
tree | ad7ca9ff8086802a590b0dd636de1c539f4f9c0e | |
parent | 06c15035b4f6541fe9f2fc60934287cb2e413c25 (diff) | |
download | elementary-cf94160b6bd9a1180c8a1fdcb35b8ee1e055f37f.tar.gz |
index: internal item's edje object handling logic changed to improve performance.
Summary:
The box_clear, box_fill internal functions called when almost every internal chage happend.
(resize, theme apply, item append, item delete etc...)
Then those APIs delete/create item's edje object for all of the items.
It's very not good action for performance.
So, i changed this just edje object box unpack/pack instead of delete/create.
@fix
Test Plan:
Working test on elementary_test
and Call all of the index APIs for check this change.
Reviewers: Hermet, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D3268
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r-- | src/lib/elm_index.c | 67 |
1 files changed, 38 insertions, 29 deletions
diff --git a/src/lib/elm_index.c b/src/lib/elm_index.c index 7f3cb39e0..c09df9e70 100644 --- a/src/lib/elm_index.c +++ b/src/lib/elm_index.c @@ -76,7 +76,8 @@ _index_box_clear(Evas_Object *obj, { ELM_INDEX_ITEM_DATA_GET(eo_item, it); if (it->level != level) continue; - ELM_SAFE_FREE(VIEW(it), evas_object_del); + evas_object_box_remove(sd->bx[level], VIEW(it)); + evas_object_hide(VIEW(it)); } sd->level_active[level] = EINA_FALSE; @@ -314,9 +315,8 @@ _index_box_auto_fill(Evas_Object *obj, continue; } - o = edje_object_add(evas_object_evas_get(obj)); - VIEW(it) = o; edje_object_mirrored_set(VIEW(it), rtl); + o = VIEW(it); if (sd->horizontal) { @@ -637,7 +637,7 @@ _sel_eval(Evas_Object *obj, it_last = it; it->selected = EINA_FALSE; } - if (VIEW(it)) + if (evas_object_visible_get(VIEW(it))) { evas_object_geometry_get(VIEW(it), &x, &y, &w, &h); xx = x + (w / 2); @@ -1359,29 +1359,33 @@ _elm_index_selected_item_get(const Eo *obj EINA_UNUSED, Elm_Index_Data *sd, int EOLIAN static Elm_Object_Item* _elm_index_item_append(Eo *obj, Elm_Index_Data *sd, const char *letter, Evas_Smart_Cb func, const void *data) { - Elm_Object_Item *it; + Elm_Object_Item *eo_item; + + eo_item = _item_new(obj, letter, func, data); + if (!eo_item) return NULL; - it = _item_new(obj, letter, func, data); - if (!it) return NULL; + sd->items = eina_list_append(sd->items, eo_item); - sd->items = eina_list_append(sd->items, it); - _index_box_clear(obj, sd->level); + ELM_INDEX_ITEM_DATA_GET(eo_item, it); + VIEW(it) = edje_object_add(evas_object_evas_get(obj)); - return it; + return eo_item; } EOLIAN static Elm_Object_Item* _elm_index_item_prepend(Eo *obj, Elm_Index_Data *sd, const char *letter, Evas_Smart_Cb func, const void *data) { - Elm_Object_Item *it; + Elm_Object_Item *eo_item; - it = _item_new(obj, letter, func, data); - if (!it) return NULL; + eo_item = _item_new(obj, letter, func, data); + if (!eo_item) return NULL; - sd->items = eina_list_prepend(sd->items, it); - _index_box_clear(obj, sd->level); + sd->items = eina_list_prepend(sd->items, eo_item); - return it; + ELM_INDEX_ITEM_DATA_GET(eo_item, it); + VIEW(it) = edje_object_add(evas_object_evas_get(obj)); + + return eo_item; } EINA_DEPRECATED EAPI Elm_Object_Item * @@ -1397,34 +1401,38 @@ elm_index_item_prepend_relative(Evas_Object *obj, EOLIAN static Elm_Object_Item* _elm_index_item_insert_after(Eo *obj, Elm_Index_Data *sd, Elm_Object_Item *after, const char *letter, Evas_Smart_Cb func, const void *data) { - Elm_Object_Item *it; + Elm_Object_Item *eo_item; if (!after) return elm_index_item_append(obj, letter, func, data); - it = _item_new(obj, letter, func, data); - if (!it) return NULL; + eo_item = _item_new(obj, letter, func, data); + if (!eo_item) return NULL; - sd->items = eina_list_append_relative(sd->items, it, after); - _index_box_clear(obj, sd->level); + sd->items = eina_list_append_relative(sd->items, eo_item, after); + + ELM_INDEX_ITEM_DATA_GET(eo_item, it); + VIEW(it) = edje_object_add(evas_object_evas_get(obj)); - return it; + return eo_item; } EOLIAN static Elm_Object_Item* _elm_index_item_insert_before(Eo *obj, Elm_Index_Data *sd, Elm_Object_Item *before, const char *letter, Evas_Smart_Cb func, const void *data) { - Elm_Object_Item *it; + Elm_Object_Item *eo_item; if (!before) return elm_index_item_prepend(obj, letter, func, data); - it = _item_new(obj, letter, func, data); - if (!it) return NULL; + eo_item = _item_new(obj, letter, func, data); + if (!eo_item) return NULL; - sd->items = eina_list_prepend_relative(sd->items, it, before); - _index_box_clear(obj, sd->level); + sd->items = eina_list_prepend_relative(sd->items, eo_item, before); + + ELM_INDEX_ITEM_DATA_GET(eo_item, it); + VIEW(it) = edje_object_add(evas_object_evas_get(obj)); - return it; + return eo_item; } EOLIAN static Elm_Object_Item* @@ -1459,7 +1467,8 @@ _elm_index_item_sorted_insert(Eo *obj, Elm_Index_Data *sd, const char *letter, E eo_item = NULL; } } - _index_box_clear(obj, sd->level); + ELM_INDEX_ITEM_DATA_GET(eo_item, it); + VIEW(it) = edje_object_add(evas_object_evas_get(obj)); if (!eo_item) return NULL; else return eo_item; |