From e31df3372cc6f4afb526afb1688ec86220c85873 Mon Sep 17 00:00:00 2001 From: Daniel Juyung Seo Date: Tue, 25 Nov 2014 21:55:12 +0900 Subject: [PATCH] gengrid, genlist: Optimize eo item usage. Remove unnecessary pointer reference. --- legacy/elementary/src/lib/elm_gengrid.c | 46 +++++++++++---------- legacy/elementary/src/lib/elm_genlist.c | 54 +++++++++++++------------ 2 files changed, 54 insertions(+), 46 deletions(-) diff --git a/legacy/elementary/src/lib/elm_gengrid.c b/legacy/elementary/src/lib/elm_gengrid.c index 5c7df87fce..6eff425977 100644 --- a/legacy/elementary/src/lib/elm_gengrid.c +++ b/legacy/elementary/src/lib/elm_gengrid.c @@ -348,12 +348,13 @@ _item_unselect(Elm_Gen_Item *it) { Elm_Gen_Item_Type *item = GG_IT(it); Elm_Gengrid_Data *sd = item->wsd; + Elm_Object_Item *eo_it = EO_OBJ(it); if ((it->generation < sd->generation) || (!it->selected)) return; edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm"); - evas_object_smart_callback_call(WIDGET(it), SIG_UNHIGHLIGHTED, EO_OBJ(it)); + evas_object_smart_callback_call(WIDGET(it), SIG_UNHIGHLIGHTED, eo_it); evas_object_stack_below(VIEW(it), sd->stack); @@ -361,8 +362,8 @@ _item_unselect(Elm_Gen_Item *it) if (it->selected) { it->selected = EINA_FALSE; - sd->selected = eina_list_remove(sd->selected, EO_OBJ(it)); - evas_object_smart_callback_call(WIDGET(it), SIG_UNSELECTED, EO_OBJ(it)); + sd->selected = eina_list_remove(sd->selected, eo_it); + evas_object_smart_callback_call(WIDGET(it), SIG_UNSELECTED, eo_it); } } @@ -389,6 +390,7 @@ _item_mouse_move_cb(void *data, Evas_Coord ox, oy, ow, oh, it_scrl_x, it_scrl_y; Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady; ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd); + Elm_Object_Item *eo_it = EO_OBJ(it); if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) { @@ -403,7 +405,7 @@ _item_mouse_move_cb(void *data, if ((it->dragging) && (it->down)) { ELM_SAFE_FREE(it->long_timer, ecore_timer_del); - evas_object_smart_callback_call(WIDGET(it), SIG_DRAG, EO_OBJ(it)); + evas_object_smart_callback_call(WIDGET(it), SIG_DRAG, eo_it); return; } @@ -475,25 +477,25 @@ _item_mouse_move_cb(void *data, { if (ady > adx) evas_object_smart_callback_call - (WIDGET(it), SIG_DRAG_START_UP, EO_OBJ(it)); + (WIDGET(it), SIG_DRAG_START_UP, eo_it); else { if (dx < 0) - evas_object_smart_callback_call(WIDGET(it), left_drag, EO_OBJ(it)); + evas_object_smart_callback_call(WIDGET(it), left_drag, eo_it); } } else { if (ady > adx) evas_object_smart_callback_call - (WIDGET(it), SIG_DRAG_START_DOWN, EO_OBJ(it)); + (WIDGET(it), SIG_DRAG_START_DOWN, eo_it); else { if (dx < 0) - evas_object_smart_callback_call(WIDGET(it), left_drag, EO_OBJ(it)); + evas_object_smart_callback_call(WIDGET(it), left_drag, eo_it); else evas_object_smart_callback_call - (WIDGET(it), right_drag, EO_OBJ(it)); + (WIDGET(it), right_drag, eo_it); } } } @@ -821,6 +823,7 @@ _item_realize(Elm_Gen_Item *it) char buf[1024]; char style[1024]; ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd); + Elm_Object_Item *eo_it = EO_OBJ(it); if ((it->realized) || (it->generation < sd->generation)) @@ -868,7 +871,7 @@ _item_realize(Elm_Gen_Item *it) EINA_LIST_FOREACH(it->texts, l, key) { char *s = it->itc->func.text_get - ((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key); + ((void *)WIDGET_ITEM_DATA_GET(eo_it), WIDGET(it), key); if (s) { edje_object_part_text_escaped_set(VIEW(it), key, s); @@ -887,7 +890,7 @@ _item_realize(Elm_Gen_Item *it) (edje_object_data_get(VIEW(it), "contents")); EINA_LIST_FOREACH(it->contents, l, key) { - ic = it->itc->func.content_get((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key); + ic = it->itc->func.content_get((void *)WIDGET_ITEM_DATA_GET(eo_it), WIDGET(it), key); if (ic) { it->content_objs = eina_list_append(it->content_objs, ic); @@ -908,7 +911,7 @@ _item_realize(Elm_Gen_Item *it) EINA_LIST_FOREACH(it->states, l, key) { Eina_Bool on = it->itc->func.state_get - ((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), l->data); + ((void *)WIDGET_ITEM_DATA_GET(eo_it), WIDGET(it), l->data); if (on) { snprintf(buf, sizeof(buf), "elm,state,%s,active", key); @@ -957,7 +960,7 @@ _item_realize(Elm_Gen_Item *it) if (it->selected) edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm"); - if (eo_do(EO_OBJ(it), elm_wdg_item_disabled_get())) + if (eo_do(eo_it, elm_wdg_item_disabled_get())) edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm"); } edje_object_message_signal_process(VIEW(it)); @@ -965,7 +968,7 @@ _item_realize(Elm_Gen_Item *it) if (it->tooltip.content_cb) { - eo_do(EO_OBJ(it), + eo_do(eo_it, elm_wdg_item_tooltip_content_cb_set( it->tooltip.content_cb, it->tooltip.data, NULL), elm_wdg_item_tooltip_style_set(it->tooltip.style), @@ -973,7 +976,7 @@ _item_realize(Elm_Gen_Item *it) } if (it->mouse_cursor) - eo_do(EO_OBJ(it), elm_wdg_item_cursor_set(it->mouse_cursor)); + eo_do(eo_it, elm_wdg_item_cursor_set(it->mouse_cursor)); it->realized = EINA_TRUE; it->want_unrealize = EINA_FALSE; @@ -3443,6 +3446,7 @@ _item_select(Elm_Gen_Item *it) { Evas_Object *obj = WIDGET(it); ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd); + Elm_Object_Item *eo_it = EO_OBJ(it); if (_is_no_select(it) || (it->generation < sd->generation) || @@ -3452,7 +3456,7 @@ _item_select(Elm_Gen_Item *it) if (!it->selected) { it->selected = EINA_TRUE; - sd->selected = eina_list_append(sd->selected, EO_OBJ(it)); + sd->selected = eina_list_append(sd->selected, eo_it); } else if ((sd->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS) && (it->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS)) @@ -3461,11 +3465,11 @@ _item_select(Elm_Gen_Item *it) evas_object_ref(obj); it->walking++; sd->walking++; - if (it->func.func) it->func.func((void *)it->func.data, WIDGET(it), EO_OBJ(it)); + if (it->func.func) it->func.func((void *)it->func.data, WIDGET(it), eo_it); if (it->generation == sd->generation) { - evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, EO_OBJ(it)); - elm_object_item_focus_set(EO_OBJ(it), EINA_TRUE); + evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, eo_it); + elm_object_item_focus_set(eo_it, EINA_TRUE); } it->walking--; @@ -3477,10 +3481,10 @@ _item_select(Elm_Gen_Item *it) if ((!it->walking) && (it->generation < sd->generation)) { it->del_cb(it); - eo_del(EO_OBJ(it)); + eo_del(eo_it); } else - sd->last_selected_item = EO_OBJ(it); + sd->last_selected_item = eo_it; } evas_object_unref(obj); } diff --git a/legacy/elementary/src/lib/elm_genlist.c b/legacy/elementary/src/lib/elm_genlist.c index 39a813a867..99130ae695 100644 --- a/legacy/elementary/src/lib/elm_genlist.c +++ b/legacy/elementary/src/lib/elm_genlist.c @@ -3515,6 +3515,7 @@ _item_mouse_move_cb(void *data, Evas_Coord ox, oy, ow, oh, it_scrl_y, y_pos; Evas_Coord minw = 0, minh = 0, x, y, w, h, dx, dy, adx, ady; ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd); + Elm_Object_Item *eo_it = EO_OBJ(it); if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) { @@ -3546,7 +3547,7 @@ _item_mouse_move_cb(void *data, sd->movements++; } ELM_SAFE_FREE(it->long_timer, ecore_timer_del); - evas_object_smart_callback_call(WIDGET(it), SIG_DRAG, EO_OBJ(it)); + evas_object_smart_callback_call(WIDGET(it), SIG_DRAG, eo_it); return; } if ((!it->down) || (sd->longpressed)) @@ -3625,30 +3626,30 @@ _item_mouse_move_cb(void *data, { if (ady > adx) evas_object_smart_callback_call - (WIDGET(it), SIG_DRAG_START_UP, EO_OBJ(it)); + (WIDGET(it), SIG_DRAG_START_UP, eo_it); else { if (dx < 0) evas_object_smart_callback_call - (WIDGET(it), SIG_DRAG_START_LEFT, EO_OBJ(it)); + (WIDGET(it), SIG_DRAG_START_LEFT, eo_it); else evas_object_smart_callback_call - (WIDGET(it), SIG_DRAG_START_RIGHT, EO_OBJ(it)); + (WIDGET(it), SIG_DRAG_START_RIGHT, eo_it); } } else { if (ady > adx) evas_object_smart_callback_call - (WIDGET(it), SIG_DRAG_START_DOWN, EO_OBJ(it)); + (WIDGET(it), SIG_DRAG_START_DOWN, eo_it); else { if (dx < 0) evas_object_smart_callback_call - (WIDGET(it), SIG_DRAG_START_LEFT, EO_OBJ(it)); + (WIDGET(it), SIG_DRAG_START_LEFT, eo_it); else evas_object_smart_callback_call - (WIDGET(it), SIG_DRAG_START_RIGHT, EO_OBJ(it)); + (WIDGET(it), SIG_DRAG_START_RIGHT, eo_it); } } } @@ -3756,6 +3757,7 @@ _multi_touch_gesture_eval(Elm_Gen_Item *it) Evas_Coord minw = 0, minh = 0; Evas_Coord off_x, off_y, off_mx, off_my; ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd); + Elm_Object_Item *eo_it = EO_OBJ(it); sd->multi_touched = EINA_FALSE; ELM_SAFE_FREE(sd->multi_timer, ecore_timer_del); @@ -3778,33 +3780,33 @@ _multi_touch_gesture_eval(Elm_Gen_Item *it) { if ((sd->cur_x > sd->prev_x) && (sd->cur_mx > sd->prev_mx)) evas_object_smart_callback_call - (WIDGET(it), SIG_MULTI_SWIPE_RIGHT, EO_OBJ(it)); + (WIDGET(it), SIG_MULTI_SWIPE_RIGHT, eo_it); else if ((sd->cur_x < sd->prev_x) && (sd->cur_mx < sd->prev_mx)) evas_object_smart_callback_call - (WIDGET(it), SIG_MULTI_SWIPE_LEFT, EO_OBJ(it)); + (WIDGET(it), SIG_MULTI_SWIPE_LEFT, eo_it); else if (abs(sd->cur_x - sd->cur_mx) > abs(sd->prev_x - sd->prev_mx)) evas_object_smart_callback_call - (WIDGET(it), SIG_MULTI_PINCH_OUT, EO_OBJ(it)); + (WIDGET(it), SIG_MULTI_PINCH_OUT, eo_it); else evas_object_smart_callback_call - (WIDGET(it), SIG_MULTI_PINCH_IN, EO_OBJ(it)); + (WIDGET(it), SIG_MULTI_PINCH_IN, eo_it); } else { if ((sd->cur_y > sd->prev_y) && (sd->cur_my > sd->prev_my)) evas_object_smart_callback_call - (WIDGET(it), SIG_MULTI_SWIPE_DOWN, EO_OBJ(it)); + (WIDGET(it), SIG_MULTI_SWIPE_DOWN, eo_it); else if ((sd->cur_y < sd->prev_y) && (sd->cur_my < sd->prev_my)) evas_object_smart_callback_call - (WIDGET(it), SIG_MULTI_SWIPE_UP, EO_OBJ(it)); + (WIDGET(it), SIG_MULTI_SWIPE_UP, eo_it); else if (abs(sd->cur_y - sd->cur_my) > abs(sd->prev_y - sd->prev_my)) evas_object_smart_callback_call - (WIDGET(it), SIG_MULTI_PINCH_OUT, EO_OBJ(it)); + (WIDGET(it), SIG_MULTI_PINCH_OUT, eo_it); else evas_object_smart_callback_call - (WIDGET(it), SIG_MULTI_PINCH_IN, EO_OBJ(it)); + (WIDGET(it), SIG_MULTI_PINCH_IN, eo_it); } } @@ -3891,6 +3893,7 @@ _item_mouse_down_cb(void *data, Elm_Gen_Item *it = data; Evas_Coord x, y; ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd); + Elm_Object_Item *eo_it = EO_OBJ(it); if (ev->button != 1) return; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) @@ -3930,7 +3933,7 @@ _item_mouse_down_cb(void *data, sd->movements = 0; if (_is_no_select(it) || - eo_do((Eo *)EO_OBJ(it), elm_wdg_item_disabled_get())) + eo_do((Eo *)eo_it, elm_wdg_item_disabled_get())) return; // and finally call the user callbacks. @@ -3939,10 +3942,10 @@ _item_mouse_down_cb(void *data, it->highlight_cb(it); if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) { - evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, EO_OBJ(it)); - evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, EO_OBJ(it)); + evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, eo_it); + evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, eo_it); } - evas_object_smart_callback_call(WIDGET(it), SIG_PRESSED, EO_OBJ(it)); + evas_object_smart_callback_call(WIDGET(it), SIG_PRESSED, eo_it); } static Item_Block * @@ -5561,6 +5564,7 @@ _item_select(Elm_Gen_Item *it) { Evas_Object *obj = WIDGET(it); ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd); + Elm_Object_Item *eo_it = EO_OBJ(it); if (_is_no_select(it) || (it->generation < sd->generation) || @@ -5571,7 +5575,7 @@ _item_select(Elm_Gen_Item *it) { it->selected = EINA_TRUE; sd->selected = - eina_list_append(sd->selected, EO_OBJ(it)); + eina_list_append(sd->selected, eo_it); } else if ((sd->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS) && (it->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS)) @@ -5580,11 +5584,11 @@ _item_select(Elm_Gen_Item *it) evas_object_ref(obj); it->walking++; sd->walking++; - if (it->func.func) it->func.func((void *)it->func.data, WIDGET(it), EO_OBJ(it)); + if (it->func.func) it->func.func((void *)it->func.data, WIDGET(it), eo_it); if (it->generation == sd->generation) { - evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, EO_OBJ(it)); - elm_object_item_focus_set(EO_OBJ(it), EINA_TRUE); + evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, eo_it); + elm_object_item_focus_set(eo_it, EINA_TRUE); _elm_genlist_item_content_focus_set(it, ELM_FOCUS_PREVIOUS); } @@ -5612,10 +5616,10 @@ _item_select(Elm_Gen_Item *it) if ((!it->walking) && (it->generation < sd->generation)) { it->del_cb(it); - eo_del(EO_OBJ(it)); + eo_del(eo_it); } else - sd->last_selected_item = EO_OBJ(it); + sd->last_selected_item = eo_it; } evas_object_unref(obj);