evas: Assume object is valid and avoid call to efl_isa

In an internal function we should be able to safely assume an
object is indeed a smart object.

@optimization
This commit is contained in:
Jean-Philippe Andre 2017-02-20 18:07:00 +09:00
parent 9a83113b9f
commit d150cdfd9d
7 changed files with 14 additions and 15 deletions

View File

@ -252,7 +252,7 @@ _efl_canvas_object_efl_gfx_stack_layer_set(Eo *eo_obj, Evas_Object_Protected_Dat
1, 1, EINA_TRUE,
NULL);
}
else
else if (obj->is_smart)
{
Eina_Inlist *contained;
Evas_Object_Protected_Data *member;

View File

@ -2402,6 +2402,7 @@ _is_frame_flag_set(Evas_Object_Protected_Data *obj, Eina_Bool is_frame)
obj->is_frame = is_frame;
if (!obj->is_smart) return;
l = evas_object_smart_members_get_direct(obj->object);
EINA_INLIST_FOREACH(l, child)

View File

@ -508,10 +508,6 @@ evas_object_smart_render_cache_set(Evas_Object *eo_obj, void *data)
const Eina_Inlist *
evas_object_smart_members_get_direct(const Evas_Object *eo_obj)
{
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
return NULL;
MAGIC_CHECK_END();
if (!efl_isa(eo_obj, MY_CLASS)) return NULL;
Evas_Smart_Data *o = efl_data_scope_get(eo_obj, MY_CLASS);
if (!o) return NULL;
return o->contained;
@ -1040,7 +1036,6 @@ Eina_Bool
evas_object_smart_changed_get(Evas_Object *eo_obj)
{
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
Evas_Object_Protected_Data *o2;
Eina_Bool has_map = EINA_FALSE;
/* If object is invisible, it's meaningless to figure out changed state
@ -1072,8 +1067,13 @@ evas_object_smart_changed_get(Evas_Object *eo_obj)
}
}
EINA_INLIST_FOREACH(evas_object_smart_members_get_direct(eo_obj), o2)
if (evas_object_smart_changed_get(o2->object)) return EINA_TRUE;
if (obj->is_smart)
{
Evas_Object_Protected_Data *o2;
EINA_INLIST_FOREACH(evas_object_smart_members_get_direct(eo_obj), o2)
if (evas_object_smart_changed_get(o2->object)) return EINA_TRUE;
}
return EINA_FALSE;
}

View File

@ -472,7 +472,7 @@ _evas_render_phase1_direct(Evas_Public_Data *e,
RD(0, " pre-render-done smart:%p|%p [%p, %i] | [%p, %i] has_map:%i had_map:%i\n",
obj->smart.smart,
evas_object_smart_members_get_direct(eo_obj),
obj->is_smart ? evas_object_smart_members_get_direct(eo_obj) : NULL,
obj->map->cur.map, obj->map->cur.usemap,
obj->map->prev.map, obj->map->prev.usemap,
_evas_render_has_map(obj),

View File

@ -230,14 +230,12 @@ _evas_render2_object_render(Evas_Public_Data *e, Evas_Object_Protected_Data *obj
{
Evas_Object_Protected_Data *obj2;
Evas_Object *eo_obj = obj->object;
const Eina_Inlist *il;
if ((!evas_object_is_visible(eo_obj, obj)) ||
(obj->clip.clipees) || (obj->cur->have_clipees)) return;
il = evas_object_smart_members_get_direct(eo_obj);
if (il)
if (obj->is_smart)
{
EINA_INLIST_FOREACH(il, obj2)
EINA_INLIST_FOREACH(evas_object_smart_members_get_direct(eo_obj), obj2)
_evas_render2_object_render(e, obj2, uinf, l + 1);
}
else

View File

@ -142,7 +142,7 @@ _evas_render2_th_main_obj_walk_process(Evas_Public_Data *e,
Evas_Object *eo_obj = obj->object;
const Eina_Inlist *il;
il = evas_object_smart_members_get_direct(eo_obj);
il = obj->is_smart ? evas_object_smart_members_get_direct(eo_obj) : NULL;
if (il)
{
if (!_evas_render2_th_main_obj_del_handle(e, obj)) return;

View File

@ -32,7 +32,7 @@ _obj_process(Evas_Public_Data *e,
const Eina_Inlist *il;
if (!obj->changed) return;
il = evas_object_smart_members_get_direct(eo_obj);
il = obj->is_smart ? evas_object_smart_members_get_direct(eo_obj) : NULL;
if (il)
{
obj->rect_del = EINA_FALSE;