summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2018-12-20 14:42:38 +0900
committerHermet Park <hermetpark@gmail.com>2018-12-20 14:42:38 +0900
commit149dcb17cbd641a34eb36b500df4511b6bd8d297 (patch)
tree87fef12cf6b3a73d3aa724271bc7bf986eedcbd9
parentd9a222ecf59622ec9cf80a908b0a987d18f87b0f (diff)
evas vg: optimize vg object internal connections.
Dectected huge amount of unnecessray internal events triggering which were signaled via vg nodes. By events, nodes were connected with each others, and finally reaches to vg object to update its rendering properly. However GFX_PATH_CHANGE signal is too commonly triggered for scenarios, listening and response it is too burdensome. We acutally don't need to do this if all nodes could share the vg object. Nodes directly notify vg object to update it. Next patch will come to remove stupid GFX_PATH_CHANGE that's aweful in performance wise.
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_container.c39
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_container.eo1
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_gradient.c4
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c4
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c6
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_node.c160
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_object.c29
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_shape.c17
-rw-r--r--src/lib/evas/canvas/evas_vg_private.h25
9 files changed, 176 insertions, 109 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_vg_container.c b/src/lib/evas/canvas/efl_canvas_vg_container.c
index addbf0cbc9..b733db5b35 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_container.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_container.c
@@ -286,7 +286,18 @@ _efl_canvas_vg_container_efl_canvas_vg_node_mask_set(Eo *obj,
286 286
287 pd->mask.option = op; 287 pd->mask.option = op;
288 efl_replace(&pd->mask_src, mask); 288 efl_replace(&pd->mask_src, mask);
289 _efl_canvas_vg_node_changed(obj); 289 efl_canvas_vg_node_change(obj);
290}
291
292static void
293_efl_canvas_vg_container_efl_object_parent_set(Eo *obj,
294 Efl_Canvas_Vg_Container_Data *cd,
295 Eo *parent)
296{
297 efl_parent_set(efl_super(obj, MY_CLASS), parent);
298
299 Efl_Canvas_Vg_Node_Data *nd = efl_data_scope_get(obj, EFL_CANVAS_VG_NODE_CLASS);
300 efl_canvas_vg_container_vg_obj_update(obj, nd);
290} 301}
291 302
292EOLIAN static Efl_VG * 303EOLIAN static Efl_VG *
@@ -319,6 +330,32 @@ _efl_canvas_vg_container_efl_duplicate_duplicate(const Eo *obj,
319 return container; 330 return container;
320} 331}
321 332
333void
334efl_canvas_vg_container_vg_obj_update(Efl_VG *obj, Efl_Canvas_Vg_Node_Data *nd)
335{
336 if (!obj) return;
337
338 Efl_Canvas_Vg_Container_Data *cd = efl_data_scope_get(obj, MY_CLASS);
339 if (!cd) return;
340
341 Eina_List *l;
342 Efl_VG* child;
343
344 EINA_LIST_FOREACH(cd->children, l, child)
345 {
346 Efl_Canvas_Vg_Node_Data *child_nd =
347 efl_data_scope_get(child, EFL_CANVAS_VG_NODE_CLASS);
348
349 if (child_nd->vg_obj == nd->vg_obj) continue;
350
351 child_nd->vg_obj = nd->vg_obj;
352 child_nd->vd = nd->vd;
353
354 if (efl_isa(child, MY_CLASS))
355 efl_canvas_vg_container_vg_obj_update(child, child_nd);
356 }
357}
358
322EAPI Efl_VG* 359EAPI Efl_VG*
323evas_vg_container_add(Efl_VG *parent) 360evas_vg_container_add(Efl_VG *parent)
324{ 361{
diff --git a/src/lib/evas/canvas/efl_canvas_vg_container.eo b/src/lib/evas/canvas/efl_canvas_vg_container.eo
index 4060441d44..3d26efdd8e 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_container.eo
+++ b/src/lib/evas/canvas/efl_canvas_vg_container.eo
@@ -18,6 +18,7 @@ class Efl.Canvas.Vg.Container (Efl.Canvas.Vg.Node)
18 implements { 18 implements {
19 Efl.Object.constructor; 19 Efl.Object.constructor;
20 Efl.Object.destructor; 20 Efl.Object.destructor;
21 Efl.Object.parent { set; }
21 Efl.Gfx.Path.bounds_get; 22 Efl.Gfx.Path.bounds_get;
22 Efl.Gfx.Path.interpolate; 23 Efl.Gfx.Path.interpolate;
23 Efl.Duplicate.duplicate; 24 Efl.Duplicate.duplicate;
diff --git a/src/lib/evas/canvas/efl_canvas_vg_gradient.c b/src/lib/evas/canvas/efl_canvas_vg_gradient.c
index 313753eedb..3bc4ec80a8 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_gradient.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_gradient.c
@@ -23,7 +23,7 @@ _efl_canvas_vg_gradient_efl_gfx_gradient_stop_set(Eo *obj EINA_UNUSED,
23 memcpy(pd->colors, colors, length * sizeof(Efl_Gfx_Gradient_Stop)); 23 memcpy(pd->colors, colors, length * sizeof(Efl_Gfx_Gradient_Stop));
24 pd->colors_count = length; 24 pd->colors_count = length;
25 25
26 _efl_canvas_vg_node_changed(obj); 26 efl_canvas_vg_node_change(obj);
27} 27}
28 28
29static void 29static void
@@ -43,7 +43,7 @@ _efl_canvas_vg_gradient_efl_gfx_gradient_spread_set(Eo *obj EINA_UNUSED,
43{ 43{
44 pd->spread = spread; 44 pd->spread = spread;
45 45
46 _efl_canvas_vg_node_changed(obj); 46 efl_canvas_vg_node_change(obj);
47} 47}
48 48
49static Efl_Gfx_Gradient_Spread 49static Efl_Gfx_Gradient_Spread
diff --git a/src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c b/src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c
index fa35d29153..ad3118f23e 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c
@@ -23,7 +23,7 @@ _efl_canvas_vg_gradient_linear_efl_gfx_gradient_linear_start_set(Eo *obj EINA_UN
23 pd->start.x = x; 23 pd->start.x = x;
24 pd->start.y = y; 24 pd->start.y = y;
25 25
26 _efl_canvas_vg_node_changed(obj); 26 efl_canvas_vg_node_change(obj);
27} 27}
28 28
29static void 29static void
@@ -43,7 +43,7 @@ _efl_canvas_vg_gradient_linear_efl_gfx_gradient_linear_end_set(Eo *obj EINA_UNUS
43 pd->end.x = x; 43 pd->end.x = x;
44 pd->end.y = y; 44 pd->end.y = y;
45 45
46 _efl_canvas_vg_node_changed(obj); 46 efl_canvas_vg_node_change(obj);
47} 47}
48 48
49static void 49static void
diff --git a/src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c b/src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c
index 9ff537e2ed..4146cddf04 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c
@@ -22,7 +22,7 @@ _efl_canvas_vg_gradient_radial_efl_gfx_gradient_radial_center_set(Eo *obj EINA_U
22 pd->center.x = x; 22 pd->center.x = x;
23 pd->center.y = y; 23 pd->center.y = y;
24 24
25 _efl_canvas_vg_node_changed(obj); 25 efl_canvas_vg_node_change(obj);
26} 26}
27 27
28static void 28static void
@@ -41,7 +41,7 @@ _efl_canvas_vg_gradient_radial_efl_gfx_gradient_radial_radius_set(Eo *obj EINA_U
41{ 41{
42 pd->radius = r; 42 pd->radius = r;
43 43
44 _efl_canvas_vg_node_changed(obj); 44 efl_canvas_vg_node_change(obj);
45} 45}
46 46
47static double 47static double
@@ -59,7 +59,7 @@ _efl_canvas_vg_gradient_radial_efl_gfx_gradient_radial_focal_set(Eo *obj EINA_UN
59 pd->focal.x = x; 59 pd->focal.x = x;
60 pd->focal.y = y; 60 pd->focal.y = y;
61 61
62 _efl_canvas_vg_node_changed(obj); 62 efl_canvas_vg_node_change(obj);
63} 63}
64 64
65static void 65static void
diff --git a/src/lib/evas/canvas/efl_canvas_vg_node.c b/src/lib/evas/canvas/efl_canvas_vg_node.c
index dc2c4a3a09..e5cc6c9776 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_node.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_node.c
@@ -17,22 +17,26 @@ static const Efl_Canvas_Vg_Interpolation interpolation_identity = {
17}; 17};
18 18
19static void 19static void
20_efl_canvas_vg_node_property_changed(void *data, const Efl_Event *event EINA_UNUSED) 20_node_change(Efl_VG *obj, Efl_Canvas_Vg_Node_Data *nd)
21{ 21{
22 Efl_Canvas_Vg_Node_Data *pd = data; 22 if (nd->flags != EFL_GFX_CHANGE_FLAG_NONE) return;
23 Eo *parent; 23 nd->flags = EFL_GFX_CHANGE_FLAG_ALL;
24 24
25 if (!pd->flags) pd->flags = EFL_GFX_CHANGE_FLAG_ALL; 25 Eo *p = obj;
26 while ((p = efl_parent_get(p)))
27 {
28 Efl_Canvas_Vg_Node_Data *pnd = efl_data_scope_get(p, MY_CLASS);
29 if (!pnd || (pnd->flags != EFL_GFX_CHANGE_FLAG_NONE)) break;
30 pnd->flags = EFL_GFX_CHANGE_FLAG_ALL;
31 }
26 32
27 if (efl_invalidated_get(event->object)) return; 33 efl_canvas_vg_object_change(nd->vd);
28 parent = efl_parent_get(event->object);
29 efl_event_callback_call(parent, event->desc, event->info);
30} 34}
31 35
32static void 36static void
33_efl_canvas_vg_node_transformation_set(Eo *obj, 37_efl_canvas_vg_node_transformation_set(Eo *obj,
34 Efl_Canvas_Vg_Node_Data *pd, 38 Efl_Canvas_Vg_Node_Data *pd,
35 const Eina_Matrix3 *m) 39 const Eina_Matrix3 *m)
36{ 40{
37 if (pd->intp) 41 if (pd->intp)
38 { 42 {
@@ -56,7 +60,7 @@ _efl_canvas_vg_node_transformation_set(Eo *obj,
56 } 60 }
57 61
58 pd->flags |= EFL_GFX_CHANGE_FLAG_MATRIX; 62 pd->flags |= EFL_GFX_CHANGE_FLAG_MATRIX;
59 _efl_canvas_vg_node_changed(obj); 63 _node_change(obj, pd);
60} 64}
61 65
62const Eina_Matrix3 * 66const Eina_Matrix3 *
@@ -75,13 +79,13 @@ _efl_canvas_vg_node_mask_set(Eo *obj EINA_UNUSED,
75 79
76static void 80static void
77_efl_canvas_vg_node_origin_set(Eo *obj, 81_efl_canvas_vg_node_origin_set(Eo *obj,
78 Efl_Canvas_Vg_Node_Data *pd, 82 Efl_Canvas_Vg_Node_Data *pd,
79 double x, double y) 83 double x, double y)
80{ 84{
81 pd->x = x; 85 pd->x = x;
82 pd->y = y; 86 pd->y = y;
83 87
84 _efl_canvas_vg_node_changed(obj); 88 _node_change(obj, pd);
85} 89}
86 90
87static void 91static void
@@ -94,12 +98,14 @@ _efl_canvas_vg_node_origin_get(const Eo *obj EINA_UNUSED,
94} 98}
95 99
96static void 100static void
97_efl_canvas_vg_node_efl_gfx_entity_position_set(Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Node_Data *pd, Eina_Position2D pos) 101_efl_canvas_vg_node_efl_gfx_entity_position_set(Eo *obj,
102 Efl_Canvas_Vg_Node_Data *pd,
103 Eina_Position2D pos)
98{ 104{
99 pd->x = (double) pos.x; 105 pd->x = (double) pos.x;
100 pd->y = (double) pos.y; 106 pd->y = (double) pos.y;
101 107
102 _efl_canvas_vg_node_changed(obj); 108 _node_change(obj, pd);
103} 109}
104 110
105static Eina_Position2D 111static Eina_Position2D
@@ -110,12 +116,13 @@ _efl_canvas_vg_node_efl_gfx_entity_position_get(const Eo *obj EINA_UNUSED, Efl_C
110} 116}
111 117
112static void 118static void
113_efl_canvas_vg_node_efl_gfx_entity_visible_set(Eo *obj EINA_UNUSED, 119_efl_canvas_vg_node_efl_gfx_entity_visible_set(Eo *obj,
114 Efl_Canvas_Vg_Node_Data *pd, Eina_Bool v) 120 Efl_Canvas_Vg_Node_Data *pd,
121 Eina_Bool v)
115{ 122{
116 pd->visibility = v; 123 pd->visibility = v;
117 124
118 _efl_canvas_vg_node_changed(obj); 125 _node_change(obj, pd);
119} 126}
120 127
121 128
@@ -127,9 +134,9 @@ _efl_canvas_vg_node_efl_gfx_entity_visible_get(const Eo *obj EINA_UNUSED,
127} 134}
128 135
129static void 136static void
130_efl_canvas_vg_node_efl_gfx_color_color_set(Eo *obj EINA_UNUSED, 137_efl_canvas_vg_node_efl_gfx_color_color_set(Eo *obj,
131 Efl_Canvas_Vg_Node_Data *pd, 138 Efl_Canvas_Vg_Node_Data *pd,
132 int r, int g, int b, int a) 139 int r, int g, int b, int a)
133{ 140{
134 if (r > 255) r = 255; 141 if (r > 255) r = 255;
135 if (r < 0) r = 0; 142 if (r < 0) r = 0;
@@ -160,7 +167,7 @@ _efl_canvas_vg_node_efl_gfx_color_color_set(Eo *obj EINA_UNUSED,
160 pd->b = b; 167 pd->b = b;
161 pd->a = a; 168 pd->a = a;
162 169
163 _efl_canvas_vg_node_changed(obj); 170 _node_change(obj, pd);
164} 171}
165 172
166static void 173static void
@@ -217,7 +224,7 @@ _efl_canvas_vg_node_parent_checked_get(Eo *obj,
217 224
218static Eo * 225static Eo *
219_efl_canvas_vg_node_efl_object_constructor(Eo *obj, 226_efl_canvas_vg_node_efl_object_constructor(Eo *obj,
220 Efl_Canvas_Vg_Node_Data *pd) 227 Efl_Canvas_Vg_Node_Data *nd)
221{ 228{
222 Efl_Canvas_Vg_Container_Data *cd; 229 Efl_Canvas_Vg_Container_Data *cd;
223 Eo *parent; 230 Eo *parent;
@@ -230,10 +237,16 @@ _efl_canvas_vg_node_efl_object_constructor(Eo *obj,
230 return NULL; 237 return NULL;
231 } 238 }
232 239
233 efl_event_callback_add(obj, EFL_GFX_PATH_EVENT_CHANGED, 240 if (parent)
234 _efl_canvas_vg_node_property_changed, pd); 241 {
235 pd->flags = EFL_GFX_CHANGE_FLAG_ALL; 242 Efl_Canvas_Vg_Node_Data *parent_nd =
236 pd->changed = EINA_TRUE; 243 efl_data_scope_get(parent, MY_CLASS);
244 nd->vg_obj = parent_nd->vg_obj;
245 nd->vd = parent_nd->vd;
246 }
247
248 nd->flags = EFL_GFX_CHANGE_FLAG_ALL;
249 nd->changed = EINA_TRUE;
237 250
238 return obj; 251 return obj;
239} 252}
@@ -307,40 +320,31 @@ _efl_canvas_vg_node_efl_object_name_set(Eo *obj, Efl_Canvas_Vg_Node_Data *pd EIN
307 320
308static void 321static void
309_efl_canvas_vg_node_efl_object_parent_set(Eo *obj, 322_efl_canvas_vg_node_efl_object_parent_set(Eo *obj,
310 Efl_Canvas_Vg_Node_Data *pd EINA_UNUSED, 323 Efl_Canvas_Vg_Node_Data *nd,
311 Eo *parent) 324 Eo *parent)
312{ 325{
313 Efl_Canvas_Vg_Container_Data *cd = NULL; 326 Efl_Canvas_Vg_Container_Data *cd = NULL;
314 Efl_Canvas_Vg_Container_Data *old_cd; 327 Efl_Canvas_Vg_Container_Data *old_cd;
315 Efl_Canvas_Vg_Node_Data *nd;
316 Efl_VG *old_parent; 328 Efl_VG *old_parent;
317 Eina_Bool parent_container = EINA_TRUE;
318
319 nd = efl_data_scope_get(obj, MY_CLASS);
320
321 //No, prevent infinite calls parent_set() -> root_node_set() -> parent_set() -> ...
322 if (nd->parenting) return;
323
324 //Cut off root node from vg object if it does....
325 if (nd->vg_obj)
326 {
327 nd->parenting = EINA_TRUE;
328 evas_object_vg_root_node_set(nd->vg_obj, NULL);
329 nd->parenting = EINA_FALSE;
330 nd->vg_obj = NULL;
331 }
332 329
333 if (efl_isa(parent, EFL_CANVAS_VG_CONTAINER_CLASS)) 330 if (efl_isa(parent, EFL_CANVAS_VG_CONTAINER_CLASS))
334 cd = efl_data_scope_get(parent, EFL_CANVAS_VG_CONTAINER_CLASS); 331 cd = efl_data_scope_get(parent, EFL_CANVAS_VG_CONTAINER_CLASS);
335 else if (efl_isa(parent, EFL_CANVAS_VG_OBJECT_CLASS)) 332 else if (efl_isa(parent, EFL_CANVAS_VG_OBJECT_CLASS))
336 parent_container = EINA_FALSE; 333 {
334 if (nd->vg_obj != parent)
335 {
336 nd->vg_obj = parent;
337 nd->vd = efl_data_scope_get(parent, EFL_CANVAS_VG_OBJECT_CLASS);
338 efl_canvas_vg_container_vg_obj_update(obj, nd);
339 }
340
341 }
337 else if (parent) 342 else if (parent)
338 { 343 {
339 ERR("parent(%p, class = %s) is not allowed by vg node(%p).", 344 ERR("parent(%p, class = %s) is not allowed by vg node(%p).",
340 parent, efl_class_name_get(efl_class_get(parent)), obj); 345 parent, efl_class_name_get(efl_class_get(parent)), obj);
341 return; 346 return;
342 } 347 }
343 else parent_container = EINA_FALSE;
344 348
345 if (!_efl_canvas_vg_node_parent_checked_get(obj, &old_parent, &old_cd)) 349 if (!_efl_canvas_vg_node_parent_checked_get(obj, &old_parent, &old_cd))
346 return; 350 return;
@@ -350,6 +354,7 @@ _efl_canvas_vg_node_efl_object_parent_set(Eo *obj,
350 { 354 {
351 old_cd->children = eina_list_remove(old_cd->children, obj); 355 old_cd->children = eina_list_remove(old_cd->children, obj);
352 eina_hash_del(old_cd->names, efl_name_get(efl_super(obj, MY_CLASS)), obj); 356 eina_hash_del(old_cd->names, efl_name_get(efl_super(obj, MY_CLASS)), obj);
357 _node_change(old_parent, efl_data_scope_get(old_parent, MY_CLASS));
353 } 358 }
354 359
355 efl_parent_set(efl_super(obj, MY_CLASS), parent); 360 efl_parent_set(efl_super(obj, MY_CLASS), parent);
@@ -358,11 +363,19 @@ _efl_canvas_vg_node_efl_object_parent_set(Eo *obj,
358 { 363 {
359 cd->children = eina_list_append(cd->children, obj); 364 cd->children = eina_list_append(cd->children, obj);
360 _efl_canvas_vg_node_name_insert(obj, cd); 365 _efl_canvas_vg_node_name_insert(obj, cd);
366
367 Efl_Canvas_Vg_Node_Data *parent_nd = efl_data_scope_get(parent, MY_CLASS);
368 _node_change(parent, parent_nd);
369
370 if (nd->vg_obj != parent_nd->vg_obj)
371 {
372 nd->vg_obj = parent_nd->vg_obj;
373 nd->vd = parent_nd->vd;
374 efl_canvas_vg_container_vg_obj_update(obj, nd);
375 }
361 } 376 }
362 377
363 _efl_canvas_vg_node_changed(old_parent); 378 _node_change(obj, nd);
364 _efl_canvas_vg_node_changed(obj);
365 if (parent_container) _efl_canvas_vg_node_changed(parent);
366} 379}
367 380
368static void 381static void
@@ -386,8 +399,8 @@ _efl_canvas_vg_node_efl_gfx_stack_raise(Eo *obj, Efl_Canvas_Vg_Node_Data *pd EIN
386 cd->children = eina_list_remove_list(cd->children, lookup); 399 cd->children = eina_list_remove_list(cd->children, lookup);
387 cd->children = eina_list_append_relative_list(cd->children, obj, next); 400 cd->children = eina_list_append_relative_list(cd->children, obj, next);
388 401
389 _efl_canvas_vg_node_changed(parent); 402 _node_change(parent, efl_data_scope_get(parent, MY_CLASS));
390 return ; 403 return;
391 404
392 on_error: 405 on_error:
393 ERR("Err"); 406 ERR("Err");
@@ -395,8 +408,8 @@ _efl_canvas_vg_node_efl_gfx_stack_raise(Eo *obj, Efl_Canvas_Vg_Node_Data *pd EIN
395 408
396static void 409static void
397_efl_canvas_vg_node_efl_gfx_stack_stack_above(Eo *obj, 410_efl_canvas_vg_node_efl_gfx_stack_stack_above(Eo *obj,
398 Efl_Canvas_Vg_Node_Data *pd EINA_UNUSED, 411 Efl_Canvas_Vg_Node_Data *pd EINA_UNUSED,
399 Efl_Gfx_Stack *above) 412 Efl_Gfx_Stack *above)
400{ 413{
401 Efl_Canvas_Vg_Container_Data *cd; 414 Efl_Canvas_Vg_Container_Data *cd;
402 Eina_List *lookup, *ref; 415 Eina_List *lookup, *ref;
@@ -416,8 +429,8 @@ _efl_canvas_vg_node_efl_gfx_stack_stack_above(Eo *obj,
416 cd->children = eina_list_remove_list(cd->children, lookup); 429 cd->children = eina_list_remove_list(cd->children, lookup);
417 cd->children = eina_list_append_relative_list(cd->children, obj, ref); 430 cd->children = eina_list_append_relative_list(cd->children, obj, ref);
418 431
419 _efl_canvas_vg_node_changed(parent); 432 _node_change(parent, efl_data_scope_get(parent, MY_CLASS));
420 return ; 433 return;
421 434
422 on_error: 435 on_error:
423 ERR("Err"); 436 ERR("Err");
@@ -425,8 +438,8 @@ _efl_canvas_vg_node_efl_gfx_stack_stack_above(Eo *obj,
425 438
426static void 439static void
427_efl_canvas_vg_node_efl_gfx_stack_stack_below(Eo *obj, 440_efl_canvas_vg_node_efl_gfx_stack_stack_below(Eo *obj,
428 Efl_Canvas_Vg_Node_Data *pd EINA_UNUSED, 441 Efl_Canvas_Vg_Node_Data *pd EINA_UNUSED,
429 Efl_Gfx_Stack *below) 442 Efl_Gfx_Stack *below)
430{ 443{
431 Efl_Canvas_Vg_Container_Data *cd; 444 Efl_Canvas_Vg_Container_Data *cd;
432 Eina_List *lookup, *ref; 445 Eina_List *lookup, *ref;
@@ -446,8 +459,8 @@ _efl_canvas_vg_node_efl_gfx_stack_stack_below(Eo *obj,
446 cd->children = eina_list_remove_list(cd->children, lookup); 459 cd->children = eina_list_remove_list(cd->children, lookup);
447 cd->children = eina_list_prepend_relative_list(cd->children, obj, ref); 460 cd->children = eina_list_prepend_relative_list(cd->children, obj, ref);
448 461
449 _efl_canvas_vg_node_changed(parent); 462 _node_change(parent, efl_data_scope_get(parent, MY_CLASS));
450 return ; 463 return;
451 464
452 on_error: 465 on_error:
453 ERR("Err"); 466 ERR("Err");
@@ -469,13 +482,13 @@ _efl_canvas_vg_node_efl_gfx_stack_lower(Eo *obj, Efl_Canvas_Vg_Node_Data *pd EIN
469 if (!lookup) goto on_error; 482 if (!lookup) goto on_error;
470 483
471 prev = eina_list_prev(lookup); 484 prev = eina_list_prev(lookup);
472 if (!prev) return ; 485 if (!prev) return;
473 486
474 cd->children = eina_list_remove_list(cd->children, lookup); 487 cd->children = eina_list_remove_list(cd->children, lookup);
475 cd->children = eina_list_prepend_relative_list(cd->children, obj, prev); 488 cd->children = eina_list_prepend_relative_list(cd->children, obj, prev);
476 489
477 _efl_canvas_vg_node_changed(parent); 490 _node_change(parent, efl_data_scope_get(parent, MY_CLASS));
478 return ; 491 return;
479 492
480 on_error: 493 on_error:
481 ERR("Err"); 494 ERR("Err");
@@ -623,7 +636,11 @@ _efl_canvas_vg_node_interpolate_point(Eina_Point_3D *d,
623 636
624/* Warning! Node itself doesn't have any path. Don't call super class(Path)'s */ 637/* Warning! Node itself doesn't have any path. Don't call super class(Path)'s */
625static Eina_Bool 638static Eina_Bool
626_efl_canvas_vg_node_efl_gfx_path_interpolate(Eo *obj, Efl_Canvas_Vg_Node_Data *pd, const Efl_VG *from, const Efl_VG *to, double pos_map) 639_efl_canvas_vg_node_efl_gfx_path_interpolate(Eo *obj,
640 Efl_Canvas_Vg_Node_Data *pd,
641 const Efl_VG *from,
642 const Efl_VG *to,
643 double pos_map)
627{ 644{
628 Efl_Canvas_Vg_Node_Data *fromd, *tod; 645 Efl_Canvas_Vg_Node_Data *fromd, *tod;
629 double from_map; 646 double from_map;
@@ -700,18 +717,29 @@ _efl_canvas_vg_node_efl_gfx_path_interpolate(Eo *obj, Efl_Canvas_Vg_Node_Data *p
700 717
701 pd->visibility = pos_map >= 0.5 ? tod->visibility : fromd->visibility; 718 pd->visibility = pos_map >= 0.5 ? tod->visibility : fromd->visibility;
702 719
703 _efl_canvas_vg_node_changed(obj); 720 _node_change(obj, pd);
704 721
705 return EINA_TRUE; 722 return EINA_TRUE;
706} 723}
707 724
708void 725void
709efl_canvas_vg_node_root_set(Efl_VG *node, Efl_VG *vg_obj) 726efl_canvas_vg_node_vg_obj_set(Efl_VG *node, Efl_VG *vg_obj, Efl_Canvas_Vg_Object_Data *vd)
710{ 727{
711 Efl_Canvas_Vg_Node_Data *nd = efl_data_scope_get(node, MY_CLASS); 728 Efl_Canvas_Vg_Node_Data *nd = efl_data_scope_get(node, MY_CLASS);
729 if (nd->vg_obj == vg_obj) return;
712 nd->vg_obj = vg_obj; 730 nd->vg_obj = vg_obj;
731 nd->vd = vd;
732
733 //root node is always container.
734 efl_canvas_vg_container_vg_obj_update(node, nd);
713} 735}
714 736
737void
738efl_canvas_vg_node_change(Eo *obj)
739{
740 if (!obj) return;
741 _node_change(obj, efl_data_scope_get(obj, EFL_CANVAS_VG_NODE_CLASS));
742}
715 743
716EOLIAN static Efl_VG * 744EOLIAN static Efl_VG *
717_efl_canvas_vg_node_efl_duplicate_duplicate(const Eo *obj, Efl_Canvas_Vg_Node_Data *pd) 745_efl_canvas_vg_node_efl_duplicate_duplicate(const Eo *obj, Efl_Canvas_Vg_Node_Data *pd)
diff --git a/src/lib/evas/canvas/efl_canvas_vg_object.c b/src/lib/evas/canvas/efl_canvas_vg_object.c
index b2352aaebe..ffbc3016b9 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_object.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_object.c
@@ -52,19 +52,6 @@ static const Evas_Object_Func object_func =
52}; 52};
53 53
54static void 54static void
55_evas_vg_tree_changed(void *data, const Efl_Event *event EINA_UNUSED)
56{
57 Evas_Object_Protected_Data *obj = data;
58 Efl_Canvas_Vg_Object_Data *pd = efl_data_scope_get(obj->object, MY_CLASS);
59
60 if (pd->changed) return;
61
62 pd->changed = EINA_TRUE;
63
64 evas_object_change(obj->object, obj);
65}
66
67static void
68_update_vgtree_viewport(Eo *obj, Efl_Canvas_Vg_Object_Data *pd) 55_update_vgtree_viewport(Eo *obj, Efl_Canvas_Vg_Object_Data *pd)
69{ 56{
70 double vb_w, vb_h, vp_w, vp_h, scale_w, scale_h, scale; 57 double vb_w, vb_h, vp_w, vp_h, scale_w, scale_h, scale;
@@ -116,7 +103,7 @@ _evas_vg_resize(void *data, const Efl_Event *ev)
116EOLIAN static Efl_VG * 103EOLIAN static Efl_VG *
117_efl_canvas_vg_object_root_node_get(const Eo *obj, Efl_Canvas_Vg_Object_Data *pd) 104_efl_canvas_vg_object_root_node_get(const Eo *obj, Efl_Canvas_Vg_Object_Data *pd)
118{ 105{
119 Efl_VG *root = NULL; 106 Efl_VG *root;
120 107
121 if (pd->vg_entry) 108 if (pd->vg_entry)
122 { 109 {
@@ -156,7 +143,10 @@ _efl_canvas_vg_object_root_node_set(Eo *eo_obj, Efl_Canvas_Vg_Object_Data *pd, E
156 143
157 // detach/free the old root_node 144 // detach/free the old root_node
158 if (pd->user_entry && pd->user_entry->root) 145 if (pd->user_entry && pd->user_entry->root)
159 efl_parent_set(pd->user_entry->root, NULL); 146 {
147 efl_canvas_vg_node_vg_obj_set(pd->user_entry->root, NULL, NULL);
148 efl_parent_set(pd->user_entry->root, NULL);
149 }
160 150
161 if (root_node) 151 if (root_node)
162 { 152 {
@@ -174,8 +164,7 @@ _efl_canvas_vg_object_root_node_set(Eo *eo_obj, Efl_Canvas_Vg_Object_Data *pd, E
174 164
175 // set the parent so that vg canvas can render it. 165 // set the parent so that vg canvas can render it.
176 efl_parent_set(pd->user_entry->root, pd->root); 166 efl_parent_set(pd->user_entry->root, pd->root);
177 167 efl_canvas_vg_node_vg_obj_set(root_node, eo_obj, pd);
178 efl_canvas_vg_node_root_set(root_node, eo_obj);
179 } 168 }
180 else if (pd->user_entry) 169 else if (pd->user_entry)
181 { 170 {
@@ -345,14 +334,12 @@ _efl_canvas_vg_object_efl_object_constructor(Eo *eo_obj, Efl_Canvas_Vg_Object_Da
345 obj->private_data = efl_data_ref(eo_obj, MY_CLASS); 334 obj->private_data = efl_data_ref(eo_obj, MY_CLASS);
346 obj->type = o_type; 335 obj->type = o_type;
347 336
348 /* root node */ 337 /* default root node */
349 //FIXME: Well. I don't think this is necessary if user set a new root node... 338 pd->obj = obj;
350 pd->root = efl_add_ref(EFL_CANVAS_VG_CONTAINER_CLASS, NULL); 339 pd->root = efl_add_ref(EFL_CANVAS_VG_CONTAINER_CLASS, NULL);
351 340
352 eina_array_step_set(&pd->cleanup, sizeof(pd->cleanup), 8); 341 eina_array_step_set(&pd->cleanup, sizeof(pd->cleanup), 8);
353 342
354 efl_event_callback_add(pd->root, EFL_GFX_PATH_EVENT_CHANGED, _evas_vg_tree_changed, obj);
355
356 return eo_obj; 343 return eo_obj;
357} 344}
358 345
diff --git a/src/lib/evas/canvas/efl_canvas_vg_shape.c b/src/lib/evas/canvas/efl_canvas_vg_shape.c
index 106efeccfb..728afb5c4e 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_shape.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_shape.c
@@ -17,6 +17,11 @@ struct _Efl_Canvas_Vg_Shape_Data
17}; 17};
18 18
19// FIXME: Use the renderer bounding box when it has been created instead of an estimation 19// FIXME: Use the renderer bounding box when it has been created instead of an estimation
20static void
21_efl_canvas_vg_shape_path_changed(void *data, const Efl_Event *event)
22{
23 efl_canvas_vg_node_change(event->object);
24}
20 25
21static void 26static void
22_efl_canvas_vg_shape_fill_set(Eo *obj EINA_UNUSED, 27_efl_canvas_vg_shape_fill_set(Eo *obj EINA_UNUSED,
@@ -28,7 +33,7 @@ _efl_canvas_vg_shape_fill_set(Eo *obj EINA_UNUSED,
28 pd->fill = efl_ref(f); 33 pd->fill = efl_ref(f);
29 efl_unref(tmp); 34 efl_unref(tmp);
30 35
31 _efl_canvas_vg_node_changed(obj); 36 efl_canvas_vg_node_change(obj);
32} 37}
33 38
34static Efl_Canvas_Vg_Node * 39static Efl_Canvas_Vg_Node *
@@ -47,7 +52,7 @@ _efl_canvas_vg_shape_stroke_fill_set(Eo *obj EINA_UNUSED,
47 pd->stroke.fill = efl_ref(f); 52 pd->stroke.fill = efl_ref(f);
48 efl_unref(tmp); 53 efl_unref(tmp);
49 54
50 _efl_canvas_vg_node_changed(obj); 55 efl_canvas_vg_node_change(obj);
51} 56}
52 57
53static Efl_Canvas_Vg_Node * 58static Efl_Canvas_Vg_Node *
@@ -67,7 +72,7 @@ _efl_canvas_vg_shape_stroke_marker_set(Eo *obj EINA_UNUSED,
67 pd->stroke.marker = efl_ref(m); 72 pd->stroke.marker = efl_ref(m);
68 efl_unref(tmp); 73 efl_unref(tmp);
69 74
70 _efl_canvas_vg_node_changed(obj); 75 efl_canvas_vg_node_change(obj);
71} 76}
72 77
73static Efl_Canvas_Vg_Shape * 78static Efl_Canvas_Vg_Shape *
@@ -135,6 +140,9 @@ _efl_canvas_vg_shape_efl_object_constructor(Eo *obj, Efl_Canvas_Vg_Shape_Data *p
135 nd->render_pre = _efl_canvas_vg_shape_render_pre; 140 nd->render_pre = _efl_canvas_vg_shape_render_pre;
136 nd->data = pd; 141 nd->data = pd;
137 142
143 efl_event_callback_add(obj, EFL_GFX_PATH_EVENT_CHANGED,
144 _efl_canvas_vg_shape_path_changed, pd);
145
138 return obj; 146 return obj;
139} 147}
140 148
@@ -145,6 +153,9 @@ _efl_canvas_vg_shape_efl_object_destructor(Eo *obj, Efl_Canvas_Vg_Shape_Data *pd
145 if (pd->stroke.fill) efl_unref(pd->stroke.fill); 153 if (pd->stroke.fill) efl_unref(pd->stroke.fill);
146 if (pd->stroke.marker) efl_unref(pd->stroke.marker); 154 if (pd->stroke.marker) efl_unref(pd->stroke.marker);
147 155
156 efl_event_callback_del(obj, EFL_GFX_PATH_EVENT_CHANGED,
157 _efl_canvas_vg_shape_path_changed, pd);
158
148 efl_gfx_path_reset(obj); 159 efl_gfx_path_reset(obj);
149 efl_destructor(efl_super(obj, MY_CLASS)); 160 efl_destructor(efl_super(obj, MY_CLASS));
150} 161}
diff --git a/src/lib/evas/canvas/evas_vg_private.h b/src/lib/evas/canvas/evas_vg_private.h
index b2283d3c6a..fa122fa587 100644
--- a/src/lib/evas/canvas/evas_vg_private.h
+++ b/src/lib/evas/canvas/evas_vg_private.h
@@ -42,6 +42,7 @@ struct _Efl_Canvas_Vg_Object_Data
42 Efl_VG *root; 42 Efl_VG *root;
43 Vg_Cache_Entry *vg_entry; 43 Vg_Cache_Entry *vg_entry;
44 Vg_User_Entry *user_entry; //holds the user set vg tree 44 Vg_User_Entry *user_entry; //holds the user set vg tree
45 Evas_Object_Protected_Data *obj;
45 Eina_Rect fill; 46 Eina_Rect fill;
46 Eina_Rect viewbox; 47 Eina_Rect viewbox;
47 unsigned int width, height; 48 unsigned int width, height;
@@ -59,7 +60,8 @@ struct _Efl_Canvas_Vg_Node_Data
59 60
60 Ector_Renderer *renderer; 61 Ector_Renderer *renderer;
61 62
62 Efl_VG *vg_obj; //...Not necessary!! 63 Efl_VG *vg_obj;
64 Efl_Canvas_Vg_Object_Data *vd;
63 65
64 void (*render_pre)(Evas_Object_Protected_Data *vg_pd, Efl_VG *node, 66 void (*render_pre)(Evas_Object_Protected_Data *vg_pd, Efl_VG *node,
65 Efl_Canvas_Vg_Node_Data *nd, Ector_Surface *surface, 67 Efl_Canvas_Vg_Node_Data *nd, Ector_Surface *surface,
@@ -72,7 +74,6 @@ struct _Efl_Canvas_Vg_Node_Data
72 74
73 Eina_Bool visibility : 1; 75 Eina_Bool visibility : 1;
74 Eina_Bool changed : 1; 76 Eina_Bool changed : 1;
75 Eina_Bool parenting : 1;
76}; 77};
77 78
78typedef struct _Vg_Mask 79typedef struct _Vg_Mask
@@ -124,7 +125,17 @@ void evas_cache_vg_entry_del(Vg_Cache_Entry *vg_entry);
124Vg_File_Data * evas_cache_vg_file_open(const char *file, const char *key); 125Vg_File_Data * evas_cache_vg_file_open(const char *file, const char *key);
125Eina_Bool evas_cache_vg_file_save(Efl_VG *root, int w, int h, const char *file, const char *key, const char *flags); 126Eina_Bool evas_cache_vg_file_save(Efl_VG *root, int w, int h, const char *file, const char *key, const char *flags);
126Eina_Bool evas_cache_vg_entry_file_save(Vg_Cache_Entry *vg_entry, const char *file, const char *key, const char *flags); 127Eina_Bool evas_cache_vg_entry_file_save(Vg_Cache_Entry *vg_entry, const char *file, const char *key, const char *flags);
127void efl_canvas_vg_node_root_set(Efl_VG *node, Efl_VG *vg_obj); 128void efl_canvas_vg_node_vg_obj_set(Efl_VG *node, Efl_VG *vg_obj, Efl_Canvas_Vg_Object_Data *vd);
129void efl_canvas_vg_node_change(Efl_VG *node);
130void efl_canvas_vg_container_vg_obj_update(Efl_VG *obj, Efl_Canvas_Vg_Node_Data *nd);
131
132static inline void
133efl_canvas_vg_object_change(Efl_Canvas_Vg_Object_Data *vd)
134{
135 if (!vd || vd->changed) return;
136 vd->changed = EINA_TRUE;
137 evas_object_change(vd->obj->object, vd->obj);
138}
128 139
129static inline Efl_Canvas_Vg_Node_Data * 140static inline Efl_Canvas_Vg_Node_Data *
130_evas_vg_render_pre(Evas_Object_Protected_Data *vg_pd, Efl_VG *child, Ector_Surface *surface, Eina_Matrix3 *transform, Ector_Buffer *mask, int mask_op) 141_evas_vg_render_pre(Evas_Object_Protected_Data *vg_pd, Efl_VG *child, Ector_Surface *surface, Eina_Matrix3 *transform, Ector_Buffer *mask, int mask_op)
@@ -135,14 +146,6 @@ _evas_vg_render_pre(Evas_Object_Protected_Data *vg_pd, Efl_VG *child, Ector_Surf
135 return nd; 146 return nd;
136} 147}
137 148
138static inline void
139_efl_canvas_vg_node_changed(Eo *obj)
140{
141 Efl_Gfx_Path_Change_Event ev = { EFL_GFX_CHANGE_FLAG_FILL };
142
143 if (obj) efl_event_callback_call(obj, EFL_GFX_PATH_EVENT_CHANGED, &ev);
144}
145
146#define EFL_CANVAS_VG_COMPUTE_MATRIX(Current, Parent, Nd) \ 149#define EFL_CANVAS_VG_COMPUTE_MATRIX(Current, Parent, Nd) \
147 Eina_Matrix3 *Current = Nd->m; \ 150 Eina_Matrix3 *Current = Nd->m; \
148 Eina_Matrix3 _matrix_tmp; \ 151 Eina_Matrix3 _matrix_tmp; \