evas_object_smart: Speed up some cache invalidation calls
authorDerek Foreman <derek.foreman.samsung@gmail.com>
Mon, 11 Feb 2019 19:13:33 +0000 (14:13 -0500)
committerWonki Kim <wonki_.kim@samsung.com>
Fri, 8 Mar 2019 11:49:33 +0000 (20:49 +0900)
Summary:
A large number of cache invalidation calls are doing pointer
indirection that is completely avoidable.
Depends on D7852

Reviewers: devilhorns, cedric

Reviewed By: devilhorns, cedric

Subscribers: devilhorns, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7853

src/lib/evas/canvas/evas_object_smart.c

index d4c741a..22ff034 100644 (file)
@@ -210,6 +210,26 @@ evas_object_smart_member_add(Evas_Object *eo_obj, Evas_Object *smart_obj)
    efl_canvas_group_member_add(smart_obj, eo_obj);
 }
 
+static void
+_evas_object_smart_member_cache_invalidate(Evas_Object_Protected_Data *obj, Evas_Smart_Data *sd)
+{
+   Evas_Object_Protected_Data *member;
+   Evas_Smart_Data *msd;
+
+   obj->parent_cache.pass_events_valid = EINA_FALSE;
+   obj->parent_cache.freeze_events_valid = EINA_FALSE;
+   obj->parent_cache.src_invisible_valid = EINA_FALSE;
+   if (!sd) return;
+
+   EINA_INLIST_FOREACH(sd->contained, member)
+     {
+        if (member->is_smart)
+          msd = efl_data_scope_get(member->object, MY_CLASS);
+        else msd = NULL;
+        _evas_object_smart_member_cache_invalidate(member, msd);
+     }
+}
+
 EOLIAN static void
 _efl_canvas_group_group_member_add(Eo *smart_obj, Evas_Smart_Data *o, Evas_Object *eo_obj)
 {
@@ -271,14 +291,13 @@ _efl_canvas_group_group_member_add(Eo *smart_obj, Evas_Smart_Data *o, Evas_Objec
    obj->smart.parent_data = o;
    obj->smart.parent_object_data = smart;
    o->contained = eina_inlist_append(o->contained, EINA_INLIST_GET(obj));
-   evas_object_smart_member_cache_invalidate(eo_obj, EINA_TRUE, EINA_TRUE,
-                                             EINA_TRUE);
+
+   if (obj->is_smart) member_o = efl_data_scope_get(eo_obj, MY_CLASS);
+   _evas_object_smart_member_cache_invalidate(obj, member_o);
    obj->restack = 1;
 
    if (obj->is_smart)
      {
-        member_o = efl_data_scope_get(eo_obj, MY_CLASS);
-
         if ((member_o->inherit_paragraph_direction) &&
             (member_o->paragraph_direction != o->paragraph_direction))
           {
@@ -335,7 +354,7 @@ _efl_canvas_group_group_member_del(Eo *smart_obj, Evas_Smart_Data *_pd EINA_UNUS
 {
    Evas_Object_Protected_Data *obj = efl_data_scope_safe_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
    Evas_Object_Protected_Data *smart;
-   Evas_Smart_Data *member_o, *o;
+   Evas_Smart_Data *member_o = NULL, *o;
 
    if (!obj || !obj->smart.parent) return;
 
@@ -360,7 +379,9 @@ _efl_canvas_group_group_member_del(Eo *smart_obj, Evas_Smart_Data *_pd EINA_UNUS
    o->contained = eina_inlist_remove(o->contained, EINA_INLIST_GET(obj));
    o->member_count--;
    obj->smart.parent = NULL;
-   evas_object_smart_member_cache_invalidate(eo_obj, EINA_TRUE, EINA_TRUE, EINA_TRUE);
+
+   if (obj->is_smart) member_o = efl_data_scope_get(eo_obj, MY_CLASS);
+   _evas_object_smart_member_cache_invalidate(obj, member_o);
 
    if (obj->layer->layer != obj->cur->layer)
      {
@@ -371,8 +392,6 @@ _efl_canvas_group_group_member_del(Eo *smart_obj, Evas_Smart_Data *_pd EINA_UNUS
 
    if (obj->is_smart)
      {
-        member_o = efl_data_scope_get(eo_obj, MY_CLASS);
-
         if ((member_o->inherit_paragraph_direction) &&
             (member_o->paragraph_direction != EVAS_BIDI_DIRECTION_NEUTRAL))
           {