evas: let's reuse what we know when possible to avoid more useless eo_data_scope_get.
authorCedric BAIL <cedric@osg.samsung.com>
Sat, 7 May 2016 00:01:10 +0000 (17:01 -0700)
committerCedric BAIL <cedric@osg.samsung.com>
Sat, 7 May 2016 00:01:10 +0000 (17:01 -0700)
src/lib/evas/canvas/evas_clip.c
src/lib/evas/canvas/evas_map.c
src/lib/evas/canvas/evas_object_main.c
src/lib/evas/canvas/evas_object_smart.c
src/lib/evas/canvas/evas_render.c
src/lib/evas/include/evas_private.h

index 3fda1f7..89c102a 100644 (file)
@@ -372,7 +372,7 @@ _evas_object_clip_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Object *
         EINA_COW_STATE_WRITE_END(clip, state_write, cur);
 
         if (clip->changed)
-          evas_object_update_bounding_box(eo_clip, clip);
+          evas_object_update_bounding_box(eo_clip, clip, NULL);
      }
 
    evas_object_change(eo_clip, clip);
index 53c18fc..8488644 100644 (file)
@@ -528,7 +528,7 @@ _evas_object_map_enable_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Eina_Bo
    else
      {
         if (_evas_object_map_parent_check(obj->smart.parent))
-          evas_object_update_bounding_box(eo_obj, obj);
+          evas_object_update_bounding_box(eo_obj, obj, NULL);
      }
 }
 
index 1e84571..ae8cc04 100644 (file)
@@ -904,7 +904,7 @@ _evas_object_efl_gfx_base_position_set(Eo *eo_obj, Evas_Object_Protected_Data *o
      }
    EINA_COW_STATE_WRITE_END(obj, state_write, cur);
 
-   evas_object_update_bounding_box(eo_obj, obj);
+   evas_object_update_bounding_box(eo_obj, obj, NULL);
 
 ////   obj->cur->cache.geometry.validity = 0;
    obj->changed_move = EINA_TRUE;
@@ -986,7 +986,7 @@ _evas_object_efl_gfx_base_size_set(Eo *eo_obj, Evas_Object_Protected_Data *obj,
      }
    EINA_COW_STATE_WRITE_END(obj, state_write, cur);
 
-   evas_object_update_bounding_box(eo_obj, obj);
+   evas_object_update_bounding_box(eo_obj, obj, NULL);
 
 ////   obj->cur->cache.geometry.validity = 0;
    evas_object_change(eo_obj, obj);
index 7a067d2..d8e9574 100644 (file)
@@ -213,7 +213,7 @@ _evas_object_smart_member_add(Eo *smart_obj, Evas_Smart_Data *o, Evas_Object *eo
 
    Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
    Evas_Object_Protected_Data *smart = eo_data_scope_get(smart_obj, EVAS_OBJECT_CLASS);
-   Evas_Smart_Data *member_o;
+   Evas_Smart_Data *member_o = NULL;
 
    if (obj->delete_me)
      {
@@ -281,7 +281,7 @@ _evas_object_smart_member_add(Eo *smart_obj, Evas_Smart_Data *o, Evas_Object *eo
    evas_object_mapped_clip_across_mark(eo_obj, obj);
    if (smart->smart.smart && smart->smart.smart->smart_class->member_add)
      smart->smart.smart->smart_class->member_add(smart_obj, eo_obj);
-   evas_object_update_bounding_box(eo_obj, obj);
+   evas_object_update_bounding_box(eo_obj, obj, member_o);
 }
 
 EAPI void
@@ -1090,9 +1090,8 @@ evas_object_smart_del(Evas_Object *eo_obj)
 }
 
 void
-evas_object_update_bounding_box(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
+evas_object_update_bounding_box(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Smart_Data *s)
 {
-   Evas_Smart_Data *s = NULL;
    Eina_Bool propagate = EINA_FALSE;
    Eina_Bool computeminmax = EINA_FALSE;
    Evas_Coord x, y, w, h;
@@ -1108,7 +1107,7 @@ evas_object_update_bounding_box(Evas_Object *eo_obj, Evas_Object_Protected_Data
 
    if (obj->is_smart)
      {
-        s = eo_data_scope_get(eo_obj, MY_CLASS);
+        s = s == NULL ? eo_data_scope_get(eo_obj, MY_CLASS) : s;
 
         x = s->cur.bounding_box.x;
         y = s->cur.bounding_box.y;
@@ -1134,8 +1133,8 @@ evas_object_update_bounding_box(Evas_Object *eo_obj, Evas_Object_Protected_Data
    /* We are not yet trying to find the smallest bounding box, but we want to find a good approximation quickly.
     * That's why we initialiaze min and max search to geometry of the parent object.
     */
-   Evas_Object_Protected_Data *smart_obj = eo_data_scope_get(obj->smart.parent, EVAS_OBJECT_CLASS);
-   Evas_Smart_Data *smart_parent = eo_data_scope_get(obj->smart.parent, MY_CLASS);
+   Evas_Object_Protected_Data *smart_obj = obj->smart.parent_object_data;
+   Evas_Smart_Data *smart_parent = obj->smart.parent_data;
    if (!smart_parent || !smart_obj) return;
 
    if (smart_obj->cur->valid_bounding_box)
@@ -1223,7 +1222,7 @@ evas_object_update_bounding_box(Evas_Object *eo_obj, Evas_Object_Protected_Data
      }
 
    if (propagate)
-     evas_object_update_bounding_box(obj->smart.parent, smart_obj);
+     evas_object_update_bounding_box(obj->smart.parent, smart_obj, smart_parent);
 }
 
 void
index ea32a90..95015cb 100644 (file)
@@ -578,7 +578,7 @@ _evas_render_phase1_object_process(Evas_Public_Data *e, Evas_Object *eo_obj,
              evas_object_change(obj->cur->clipper->object, obj->cur->clipper);
              evas_object_clip_dirty(obj->cur->clipper->object, obj->cur->clipper);
              evas_object_clip_recalc(obj->cur->clipper);
-             evas_object_update_bounding_box(eo_obj, obj);
+             evas_object_update_bounding_box(eo_obj, obj, NULL);
           }
         if (obj->changed)
           {
@@ -638,7 +638,7 @@ _evas_render_phase1_object_process(Evas_Public_Data *e, Evas_Object *eo_obj,
              evas_object_change(obj->cur->clipper->object, obj->cur->clipper);
              evas_object_clip_dirty(obj->cur->clipper->object, obj->cur->clipper);
              evas_object_clip_recalc(obj->cur->clipper);
-             evas_object_update_bounding_box(eo_obj, obj);
+             evas_object_update_bounding_box(eo_obj, obj, NULL);
           }
      }
 
index 983e84e..78102c4 100644 (file)
@@ -1518,7 +1518,7 @@ Evas_Object *evas_object_new(Evas *e);
 void evas_object_change_reset(Evas_Object *obj);
 void evas_object_cur_prev(Evas_Object *obj);
 void evas_object_free(Evas_Object *obj, int clean_layer);
-void evas_object_update_bounding_box(Evas_Object *obj, Evas_Object_Protected_Data *pd);
+void evas_object_update_bounding_box(Evas_Object *obj, Evas_Object_Protected_Data *pd, Evas_Smart_Data *s);
 void evas_object_inject(Evas_Object *obj, Evas_Object_Protected_Data *pd, Evas *e);
 void evas_object_release(Evas_Object *obj, Evas_Object_Protected_Data *pd, int clean_layer);
 void evas_object_change(Evas_Object *obj, Evas_Object_Protected_Data *pd);
@@ -1575,9 +1575,8 @@ 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,
-                                       Evas_Coord_Rectangle *cur_bounding_box,
-                                       Evas_Coord_Rectangle *prev_bounding_box);
-void evas_object_update_bounding_box(Evas_Object *eo_obj, 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);
 void evas_object_smart_cleanup(Evas_Object *obj);
 void evas_object_smart_member_raise(Evas_Object *member);