evas: implement stupid bound get at container level. 39/43139/1
authorCedric BAIL <cedric@osg.samsung.com>
Wed, 10 Dec 2014 10:08:43 +0000 (11:08 +0100)
committerSubhransu Mohanty <sub.mohanty@samsung.com>
Wed, 8 Jul 2015 01:55:27 +0000 (10:55 +0900)
Change-Id: I3ce421fa57162c63de9ec7bbedb0293a4ec6dcb0

src/lib/evas/canvas/evas_vg_container.c

index 4bedd86..3459f4a 100644 (file)
@@ -6,19 +6,41 @@
 #define MY_CLASS EVAS_VG_CONTAINER_CLASS
 
 void
-_evas_vg_container_eo_base_constructor(Eo *obj, Evas_VG_Container_Data *pd)
+_evas_vg_container_eo_base_constructor(Eo *obj,
+                                       Evas_VG_Container_Data *pd EINA_UNUSED)
 {
-   Eo *parent;
-
    eo_do_super(obj, MY_CLASS, eo_constructor());
 }
 
 Eina_Bool
-_evas_vg_container_evas_vg_node_bound_get(Eo *obj,
+_evas_vg_container_evas_vg_node_bound_get(Eo *obj EINA_UNUSED,
                                           Evas_VG_Container_Data *pd,
                                           Eina_Rectangle *r)
 {
-   // FIXME: iterate children and get their boundary to
+   Eina_Rectangle s;
+   Eina_Bool first = EINA_TRUE;
+   Eina_List *l;
+   Eo *child;
+
+   if (!r) return EINA_FALSE;
+
+   EINA_RECTANGLE_SET(&s, -1, -1, 0, 0);
+
+   EINA_LIST_FOREACH(pd->children, l, child)
+     {
+        if (first)
+          {
+             eo_do(child, evas_vg_node_bound_get(r));
+             first = EINA_FALSE;
+          }
+        else
+          {
+             eo_do(child, evas_vg_node_bound_get(&s));
+             eina_rectangle_union(r, &s);
+          }
+     }
+   // returning EINA_FALSE if no bouding box was found
+   return first ? EINA_FALSE : EINA_TRUE;
 }