evas: implement render_pre due to our hack over Evas_VG_Container.
authorCedric BAIL <cedric@osg.samsung.com>
Fri, 3 Apr 2015 14:30:53 +0000 (16:30 +0200)
committerCedric BAIL <cedric@osg.samsung.com>
Fri, 3 Apr 2015 14:30:53 +0000 (16:30 +0200)
src/lib/evas/canvas/evas_vg_root_node.c

index 1566a18cfaf7a3d2fcc9ea50c0c544becb2ae94c..09834b418fff5a3ca6898255191f8dee5900197b 100644 (file)
@@ -1,6 +1,7 @@
 #include "evas_common_private.h"
 #include "evas_private.h"
 
+#include "evas_vg_private.h"
 #include "evas_vg_root_node.eo.h"
 
 #include <string.h>
@@ -14,6 +15,26 @@ struct _Evas_VG_Root_Node_Data
    Evas_Object_Protected_Data *data;
 };
 
+static void
+_evas_vg_root_node_render_pre(Eo *obj EINA_UNUSED,
+                              Eina_Matrix3 *parent,
+                              Ector_Surface *s,
+                              void *data,
+                              Evas_VG_Node_Data *nd)
+{
+   Evas_VG_Container_Data *pd = data;
+   Eina_List *l;
+   Eo *child;
+
+   if (!nd->changed) return ;
+   nd->changed = EINA_FALSE;
+
+   EVAS_VG_COMPUTE_MATRIX(current, parent, nd);
+
+   EINA_LIST_FOREACH(pd->children, l, child)
+     _evas_vg_render_pre(child, s, current);
+}
+
 static Eina_Bool
 _evas_vg_root_node_changed(void *data, Eo *obj EINA_UNUSED,
                            const Eo_Event_Description *desc EINA_UNUSED,
@@ -47,6 +68,8 @@ void
 _evas_vg_root_node_eo_base_constructor(Eo *obj,
                                        Evas_VG_Root_Node_Data *pd)
 {
+   Evas_VG_Container_Data *cd;
+   Evas_VG_Node_Data *nd;
    Eo *parent;
 
    // Nice little hack, jump over parent constructor in Efl_VG_Root
@@ -55,6 +78,13 @@ _evas_vg_root_node_eo_base_constructor(Eo *obj,
    if (!eo_isa(parent, EVAS_VG_CLASS))
      eo_error_set(obj);
 
+   cd = eo_data_scope_get(obj, EVAS_VG_CONTAINER_CLASS);
+   cd->children = NULL;
+
+   nd = eo_data_scope_get(obj, EVAS_VG_NODE_CLASS);
+   nd->render_pre = _evas_vg_root_node_render_pre;
+   nd->data = cd;
+
    eo_do(obj, eo_event_callback_add(EFL_GFX_CHANGED, _evas_vg_root_node_changed, pd));
 }