cedric pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=cf94160b6bd9a1180c8a1fdcb35b8ee1e055f37f

commit cf94160b6bd9a1180c8a1fdcb35b8ee1e055f37f
Author: woochan lee <wc0917....@samsung.com>
Date:   Mon Nov 9 12:25:27 2015 -0800

    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 <ced...@osg.samsung.com>
---
 src/lib/elm_index.c | 67 ++++++++++++++++++++++++++++++-----------------------
 1 file changed, 38 insertions(+), 29 deletions(-)

diff --git a/src/lib/elm_index.c b/src/lib/elm_index.c
index 7f3cb39..c09df9e 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;

-- 


Reply via email to