forked from enlightenment/efl
evas: Optimize out more calls to efl_isa
In relative smart move, we only need to check once that the object is indeed a valid smart object. This drops the call count from ~1.02M to ~785k. @optimization
This commit is contained in:
parent
e8acf4762b
commit
9a83113b9f
|
@ -640,17 +640,12 @@ _efl_canvas_group_efl_object_destructor(Eo *eo_obj, Evas_Smart_Data *o)
|
|||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_object_smart_move_children_relative(Eo *eo_obj, Evas_Coord dx, Evas_Coord dy)
|
||||
static inline void
|
||||
_evas_object_smart_move_relative_internal(Evas_Smart_Data *o, Evas_Coord dx, Evas_Coord dy)
|
||||
{
|
||||
Evas_Object_Protected_Data *child;
|
||||
const Eina_Inlist *lst;
|
||||
|
||||
if ((dx == 0) && (dy == 0)) return;
|
||||
if (!efl_isa(eo_obj, MY_CLASS)) return;
|
||||
|
||||
lst = evas_object_smart_members_get_direct(eo_obj);
|
||||
EINA_INLIST_FOREACH(lst, child)
|
||||
EINA_INLIST_FOREACH(o->contained, child)
|
||||
{
|
||||
Evas_Coord orig_x, orig_y;
|
||||
|
||||
|
@ -662,6 +657,30 @@ evas_object_smart_move_children_relative(Eo *eo_obj, Evas_Coord dx, Evas_Coord d
|
|||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_object_smart_move_children_relative(Eo *eo_obj, Evas_Coord dx, Evas_Coord dy)
|
||||
{
|
||||
Evas_Smart_Data *o;
|
||||
|
||||
if ((dx == 0) && (dy == 0)) return;
|
||||
if (!efl_isa(eo_obj, MY_CLASS)) return;
|
||||
o = efl_data_scope_get(eo_obj, MY_CLASS);
|
||||
_evas_object_smart_move_relative_internal(o, dx, dy);
|
||||
}
|
||||
|
||||
void
|
||||
_evas_object_smart_clipped_smart_move_internal(Evas_Object *eo_obj, Evas_Coord x, Evas_Coord y)
|
||||
{
|
||||
Evas_Smart_Data *o = efl_data_scope_get(eo_obj, EFL_CANVAS_GROUP_CLASS);
|
||||
Evas_Coord orig_x, orig_y;
|
||||
|
||||
orig_x = o->x;
|
||||
orig_y = o->y;
|
||||
o->x = x;
|
||||
o->y = y;
|
||||
_evas_object_smart_move_relative_internal(o, x - orig_x, y - orig_y);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_canvas_group_group_add(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED)
|
||||
{
|
||||
|
@ -957,17 +976,6 @@ _evas_canvas_smart_objects_calculate_count_get(Eo *eo_e EINA_UNUSED, Evas_Public
|
|||
return e->smart_calc_count;
|
||||
}
|
||||
|
||||
void
|
||||
_evas_object_smart_xy_update(Eo *eo_obj, Evas_Coord *px, Evas_Coord *py,
|
||||
Evas_Coord x, Evas_Coord y)
|
||||
{
|
||||
EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj);
|
||||
*px = o->x;
|
||||
*py = o->y;
|
||||
o->x = x;
|
||||
o->y = y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call calculate() on all smart objects that need_recalculate.
|
||||
*
|
||||
|
|
|
@ -85,10 +85,8 @@ _efl_canvas_group_clipped_efl_canvas_group_group_del(Eo *eo_obj, Evas_Object_Sma
|
|||
static void
|
||||
evas_object_smart_clipped_smart_move(Evas_Object *eo_obj, Evas_Coord x, Evas_Coord y)
|
||||
{
|
||||
Evas_Coord orig_x, orig_y;
|
||||
|
||||
_evas_object_smart_xy_update(eo_obj, &orig_x, &orig_y, x, y);
|
||||
evas_object_smart_move_children_relative(eo_obj, x - orig_x, y - orig_y);
|
||||
if (!efl_isa(eo_obj, EFL_CANVAS_GROUP_CLASS)) return;
|
||||
_evas_object_smart_clipped_smart_move_internal(eo_obj, x, y);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
@ -97,7 +95,7 @@ _efl_canvas_group_clipped_efl_gfx_position_set(Eo *eo_obj, Evas_Object_Smart_Cli
|
|||
if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y))
|
||||
return;
|
||||
|
||||
evas_object_smart_clipped_smart_move(eo_obj, x, y);
|
||||
_evas_object_smart_clipped_smart_move_internal(eo_obj, x, y);
|
||||
efl_gfx_position_set(efl_super(eo_obj, MY_CLASS), x, y);
|
||||
}
|
||||
|
||||
|
|
|
@ -1679,7 +1679,7 @@ void evas_object_smart_render_cache_set(Evas_Object *eo_obj, void *data);
|
|||
|
||||
const Eina_Inlist *evas_object_smart_members_get_direct(const Evas_Object *obj);
|
||||
void _efl_canvas_group_group_members_all_del(Evas_Object *eo_obj);
|
||||
void _evas_object_smart_xy_update(Eo *eo_obj, Evas_Coord *px, Evas_Coord *py, Evas_Coord x, Evas_Coord y);
|
||||
void _evas_object_smart_clipped_smart_move_internal(Evas_Object *eo_obj, Evas_Coord x, Evas_Coord y);
|
||||
void evas_call_smarts_calculate(Evas *e);
|
||||
void evas_object_smart_bounding_box_update(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj);
|
||||
void evas_object_smart_need_bounding_box_update(Evas_Object *eo_obj, Evas_Smart_Data *o, Evas_Object_Protected_Data *obj);
|
||||
|
|
Loading…
Reference in New Issue