evas: implement stupid bound get at container level.

This commit is contained in:
Cedric BAIL 2015-04-03 16:13:12 +02:00
parent 7f072eb607
commit 1e5c596ca3
1 changed files with 27 additions and 5 deletions

View 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;
}