evas: Optimize out some calls to data_scope_get

Within evas when we know an object is marked as is_smart, then
we know it's a smart object. :)

@optimize
This commit is contained in:
Jean-Philippe Andre 2017-02-20 19:34:58 +09:00
parent 98092224ef
commit 0d555dda7f
5 changed files with 28 additions and 39 deletions

View File

@ -146,8 +146,8 @@ _evas_event_object_list_raw_in_get(Evas *eo_e, Eina_List *in,
{
Evas_Coord_Rectangle bounding_box = { 0, 0, 0, 0 };
evas_object_smart_bounding_box_update(eo_obj, obj);
evas_object_smart_bounding_box_get(obj->object, &bounding_box, NULL);
evas_object_smart_bounding_box_update(obj);
evas_object_smart_bounding_box_get(obj, &bounding_box, NULL);
c = bounding_box;
}
else
@ -164,7 +164,7 @@ _evas_event_object_list_raw_in_get(Evas *eo_e, Eina_List *in,
{
Evas_Coord_Rectangle bounding_box = { 0, 0, 0, 0 };
evas_object_smart_bounding_box_get(obj->object, &bounding_box, NULL);
evas_object_smart_bounding_box_get(obj, &bounding_box, NULL);
DDD("___ %p g[%6i %6i %6ix%6i] c[%6i %6i %6ix%6i] b[%6i %6i %6ix%6i] %s\n",
obj->object,
obj->cur->geometry.x, obj->cur->geometry.y,
@ -200,7 +200,7 @@ _evas_event_object_list_raw_in_get(Evas *eo_e, Eina_List *in,
{
Evas_Coord_Rectangle bounding_box = { 0, 0, 0, 0 };
evas_object_smart_bounding_box_get(obj->object, &bounding_box, NULL);
evas_object_smart_bounding_box_get(obj, &bounding_box, NULL);
DDD("OBJ %p g[%6i %6i %6ix%6i] c[%6i %6i %6ix%6i] b[%6i %6i %6ix%6i] %s\n",
obj->object,
obj->cur->geometry.x, obj->cur->geometry.y,
@ -277,9 +277,9 @@ _evas_event_object_list_raw_in_get(Evas *eo_e, Eina_List *in,
Evas_Coord_Rectangle bounding_box = { 0, 0, 0, 0 };
if (!obj->child_has_map)
evas_object_smart_bounding_box_update(eo_obj, obj);
evas_object_smart_bounding_box_update(obj);
evas_object_smart_bounding_box_get(eo_obj, &bounding_box, NULL);
evas_object_smart_bounding_box_get(obj, &bounding_box, NULL);
if (obj->child_has_map ||
(bounding_box.x <= x &&

View File

@ -244,8 +244,8 @@ evas_object_clip_recalc(Evas_Object_Protected_Data *obj)
{
Evas_Coord_Rectangle bounding_box;
evas_object_smart_bounding_box_update(eo_obj, obj);
evas_object_smart_bounding_box_get(eo_obj, &bounding_box, NULL);
evas_object_smart_bounding_box_update(obj);
evas_object_smart_bounding_box_get(obj, &bounding_box, NULL);
cx = bounding_box.x;
cy = bounding_box.y;
cw = bounding_box.w;

View File

@ -1118,7 +1118,7 @@ evas_object_smart_del(Evas_Object *eo_obj)
}
void
evas_object_update_bounding_box(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Smart_Data *s)
evas_object_update_bounding_box(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Evas_Smart_Data *s)
{
Eina_Bool propagate = EINA_FALSE;
Eina_Bool computeminmax = EINA_FALSE;
@ -1135,7 +1135,7 @@ evas_object_update_bounding_box(Evas_Object *eo_obj, Evas_Object_Protected_Data
if (obj->is_smart)
{
s = s == NULL ? efl_data_scope_get(eo_obj, MY_CLASS) : s;
if (!s) s = obj->private_data;
x = s->cur.bounding_box.x;
y = s->cur.bounding_box.y;
@ -1226,8 +1226,7 @@ evas_object_update_bounding_box(Evas_Object *eo_obj, Evas_Object_Protected_Data
if (computeminmax)
{
evas_object_smart_need_bounding_box_update(obj->smart.parent,
obj->smart.parent_data,
evas_object_smart_need_bounding_box_update(obj->smart.parent_data,
obj->smart.parent_object_data);
}
}
@ -1253,11 +1252,11 @@ evas_object_update_bounding_box(Evas_Object *eo_obj, Evas_Object_Protected_Data
}
void
evas_object_smart_bounding_box_get(Evas_Object *eo_obj,
evas_object_smart_bounding_box_get(Evas_Object_Protected_Data *obj,
Evas_Coord_Rectangle *cur_bounding_box,
Evas_Coord_Rectangle *prev_bounding_box)
{
Evas_Smart_Data *s = efl_data_scope_get(eo_obj, MY_CLASS);
Evas_Smart_Data *s = obj->private_data;
if (cur_bounding_box) memcpy(cur_bounding_box,
&s->cur.bounding_box,
@ -1416,29 +1415,24 @@ evas_object_smart_member_stack_below(Evas_Object *eo_member, Evas_Object *eo_oth
}
void
evas_object_smart_need_bounding_box_update(Evas_Object *eo_obj, Evas_Smart_Data *o, Evas_Object_Protected_Data *obj)
evas_object_smart_need_bounding_box_update(Evas_Smart_Data *o, Evas_Object_Protected_Data *obj)
{
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
return;
MAGIC_CHECK_END();
evas_object_async_block(obj);
if (o->update_boundingbox_needed) return;
o->update_boundingbox_needed = EINA_TRUE;
EINA_COW_STATE_WRITE_BEGIN(obj, state_write, cur)
if (!obj->cur->cache.clip.dirty)
{
state_write->cache.clip.dirty = EINA_TRUE;
EINA_COW_STATE_WRITE_BEGIN(obj, state_write, cur)
state_write->cache.clip.dirty = EINA_TRUE;
EINA_COW_STATE_WRITE_END(obj, state_write, cur);
}
EINA_COW_STATE_WRITE_END(obj, state_write, cur);
if (obj->smart.parent)
evas_object_smart_need_bounding_box_update(obj->smart.parent,
obj->smart.parent_data,
evas_object_smart_need_bounding_box_update(obj->smart.parent_data,
obj->smart.parent_object_data);
}
void
evas_object_smart_bounding_box_update(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
evas_object_smart_bounding_box_update(Evas_Object_Protected_Data *obj)
{
Evas_Smart_Data *os;
Eina_Inlist *list;
@ -1450,12 +1444,7 @@ evas_object_smart_bounding_box_update(Evas_Object *eo_obj, Evas_Object_Protected
Evas_Coord tx1, ty1, tx2, ty2;
Eina_Bool none = EINA_TRUE;
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
return;
MAGIC_CHECK_END();
evas_object_async_block(obj);
os = efl_data_scope_get(eo_obj, MY_CLASS);
os = obj->private_data;
if (!os->update_boundingbox_needed) return;
os->update_boundingbox_needed = EINA_FALSE;
@ -1471,9 +1460,9 @@ evas_object_smart_bounding_box_update(Evas_Object *eo_obj, Evas_Object_Protected
if (o->is_smart)
{
Evas_Smart_Data *s = efl_data_scope_get(o->object, MY_CLASS);
Evas_Smart_Data *s = o->private_data;
evas_object_smart_bounding_box_update(o->object, o);
evas_object_smart_bounding_box_update(o);
tx1 = s->cur.bounding_box.x;
ty1 = s->cur.bounding_box.y;

View File

@ -1073,7 +1073,7 @@ _evas_render_phase1_object_process(Phase1_Context *p1ctx,
#ifdef INLINE_ACTIVE_GEOM
if (obj->is_smart)
evas_object_smart_bounding_box_get(eo_obj, &(ent.rect), NULL);
evas_object_smart_bounding_box_get(obj, &(ent.rect), NULL);
else
{
ent.rect.x = obj->cur->cache.clip.x;
@ -2716,7 +2716,7 @@ _is_obj_in_rect(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj,
{
Evas_Coord_Rectangle rect;
evas_object_smart_bounding_box_get(eo_obj, &rect, NULL);
evas_object_smart_bounding_box_get(obj, &rect, NULL);
if (RECTS_INTERSECT(x, y, w, h, rect.x, rect.y, rect.w, rect.h))
return EINA_TRUE;
}

View File

@ -1664,7 +1664,7 @@ void _evas_object_image_video_overlay_show(Evas_Object *obj);
void _evas_object_image_video_overlay_hide(Evas_Object *obj);
void _evas_object_image_video_overlay_do(Evas_Object *obj);
void _evas_object_image_free(Evas_Object *obj);
void evas_object_smart_bounding_box_get(Evas_Object *eo_obj,
void evas_object_smart_bounding_box_get(Evas_Object_Protected_Data *obj,
Evas_Coord_Rectangle *cur_bounding_box,
Evas_Coord_Rectangle *prev_bounding_box);
void evas_object_smart_del(Evas_Object *obj);
@ -1681,8 +1681,8 @@ 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_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);
void evas_object_smart_bounding_box_update(Evas_Object_Protected_Data *obj);
void evas_object_smart_need_bounding_box_update(Evas_Smart_Data *o, Evas_Object_Protected_Data *obj);
Eina_Bool evas_object_smart_changed_get(Evas_Object *eo_obj);
void evas_object_smart_attach(Evas_Object *eo_obj, Evas_Smart *s);
void *evas_mem_calloc(int size);