evas: cache result of eo_data_scope_get that are heavily used.

This alone save a good 3% time to our first frame being displayed.
This commit is contained in:
Cedric BAIL 2016-05-06 16:47:07 -07:00
parent c9152d3816
commit 4bf54d993f
2 changed files with 15 additions and 6 deletions

View File

@ -257,6 +257,8 @@ _evas_object_smart_member_add(Eo *smart_obj, Evas_Smart_Data *o, Evas_Object *eo
obj->layer->usage++;
obj->smart.parent = smart_obj;
obj->smart.parent_data = o;
obj->smart.parent_object_data = smart;
o->contained = eina_inlist_append(o->contained, EINA_INLIST_GET(obj));
eo_data_ref(eo_obj, NULL);
evas_object_smart_member_cache_invalidate(eo_obj, EINA_TRUE, EINA_TRUE,
@ -1198,7 +1200,9 @@ 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);
evas_object_smart_need_bounding_box_update(obj->smart.parent,
obj->smart.parent_data,
obj->smart.parent_object_data);
}
}
else
@ -1345,19 +1349,20 @@ 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_object_smart_need_bounding_box_update(Evas_Object *eo_obj, Evas_Smart_Data *o, Evas_Object_Protected_Data *obj)
{
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
return;
MAGIC_CHECK_END();
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
Evas_Smart_Data *o = eo_data_scope_get(eo_obj, MY_CLASS);
evas_object_async_block(obj);
if (o->update_boundingbox_needed) return;
o->update_boundingbox_needed = EINA_TRUE;
if (obj->smart.parent) evas_object_smart_need_bounding_box_update(obj->smart.parent);
if (obj->smart.parent)
evas_object_smart_need_bounding_box_update(obj->smart.parent,
obj->smart.parent_data,
obj->smart.parent_object_data);
}
void

View File

@ -80,6 +80,8 @@ typedef struct _Evas_Proxy_Render_Data Evas_Proxy_Render_Data;
typedef struct _Evas_Object_3D_Data Evas_Object_3D_Data;
typedef struct _Evas_Object_Mask_Data Evas_Object_Mask_Data;
typedef struct _Evas_Smart_Data Evas_Smart_Data;
typedef struct _Evas_Object_Protected_State Evas_Object_Protected_State;
typedef struct _Evas_Object_Protected_Data Evas_Object_Protected_Data;
@ -1077,6 +1079,8 @@ struct _Evas_Object_Protected_Data
struct {
Evas_Smart *smart;
Evas_Object *parent;
Evas_Smart_Data *parent_data;
Evas_Object_Protected_Data *parent_object_data;
} smart;
// Eina_Cow pointer be careful when writing to it
@ -1584,7 +1588,7 @@ const Eina_Inlist *evas_object_smart_members_get_direct(const Evas_Object *obj);
void _evas_object_smart_members_all_del(Evas_Object *obj);
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 *obj);
void evas_object_smart_need_bounding_box_update(Evas_Object *eo_obj, Evas_Smart_Data *o, Evas_Object_Protected_Data *obj);
Eina_Bool evas_object_smart_changed_get(Evas_Object *eo_obj);
void *evas_mem_calloc(int size);
void _evas_post_event_callback_call(Evas *e, Evas_Public_Data* e_pd);