};
static void
-_efl_canvas_vg_node_property_changed(void *data, const Efl_Event *event EINA_UNUSED)
+_node_change(Efl_VG *obj, Efl_Canvas_Vg_Node_Data *nd)
{
- Efl_Canvas_Vg_Node_Data *pd = data;
- Eo *parent;
+ if (nd->flags != EFL_GFX_CHANGE_FLAG_NONE) return;
+ nd->flags = EFL_GFX_CHANGE_FLAG_ALL;
- if (!pd->flags) pd->flags = EFL_GFX_CHANGE_FLAG_ALL;
+ Eo *p = obj;
+ while ((p = efl_parent_get(p)))
+ {
+ Efl_Canvas_Vg_Node_Data *pnd = efl_data_scope_get(p, MY_CLASS);
+ if (!pnd || (pnd->flags != EFL_GFX_CHANGE_FLAG_NONE)) break;
+ pnd->flags = EFL_GFX_CHANGE_FLAG_ALL;
+ }
- if (efl_invalidated_get(event->object)) return;
- parent = efl_parent_get(event->object);
- efl_event_callback_call(parent, event->desc, event->info);
+ efl_canvas_vg_object_change(nd->vd);
}
static void
_efl_canvas_vg_node_transformation_set(Eo *obj,
- Efl_Canvas_Vg_Node_Data *pd,
- const Eina_Matrix3 *m)
+ Efl_Canvas_Vg_Node_Data *pd,
+ const Eina_Matrix3 *m)
{
if (pd->intp)
{
}
pd->flags |= EFL_GFX_CHANGE_FLAG_MATRIX;
- _efl_canvas_vg_node_changed(obj);
+ _node_change(obj, pd);
}
const Eina_Matrix3 *
static void
_efl_canvas_vg_node_origin_set(Eo *obj,
- Efl_Canvas_Vg_Node_Data *pd,
- double x, double y)
+ Efl_Canvas_Vg_Node_Data *pd,
+ double x, double y)
{
pd->x = x;
pd->y = y;
- _efl_canvas_vg_node_changed(obj);
+ _node_change(obj, pd);
}
static void
}
static void
-_efl_canvas_vg_node_efl_gfx_entity_position_set(Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Node_Data *pd, Eina_Position2D pos)
+_efl_canvas_vg_node_efl_gfx_entity_position_set(Eo *obj,
+ Efl_Canvas_Vg_Node_Data *pd,
+ Eina_Position2D pos)
{
pd->x = (double) pos.x;
pd->y = (double) pos.y;
- _efl_canvas_vg_node_changed(obj);
+ _node_change(obj, pd);
}
static Eina_Position2D
}
static void
-_efl_canvas_vg_node_efl_gfx_entity_visible_set(Eo *obj EINA_UNUSED,
- Efl_Canvas_Vg_Node_Data *pd, Eina_Bool v)
+_efl_canvas_vg_node_efl_gfx_entity_visible_set(Eo *obj,
+ Efl_Canvas_Vg_Node_Data *pd,
+ Eina_Bool v)
{
pd->visibility = v;
- _efl_canvas_vg_node_changed(obj);
+ _node_change(obj, pd);
}
}
static void
-_efl_canvas_vg_node_efl_gfx_color_color_set(Eo *obj EINA_UNUSED,
- Efl_Canvas_Vg_Node_Data *pd,
- int r, int g, int b, int a)
+_efl_canvas_vg_node_efl_gfx_color_color_set(Eo *obj,
+ Efl_Canvas_Vg_Node_Data *pd,
+ int r, int g, int b, int a)
{
if (r > 255) r = 255;
if (r < 0) r = 0;
pd->b = b;
pd->a = a;
- _efl_canvas_vg_node_changed(obj);
+ _node_change(obj, pd);
}
static void
static Eo *
_efl_canvas_vg_node_efl_object_constructor(Eo *obj,
- Efl_Canvas_Vg_Node_Data *pd)
+ Efl_Canvas_Vg_Node_Data *nd)
{
Efl_Canvas_Vg_Container_Data *cd;
Eo *parent;
return NULL;
}
- efl_event_callback_add(obj, EFL_GFX_PATH_EVENT_CHANGED,
- _efl_canvas_vg_node_property_changed, pd);
- pd->flags = EFL_GFX_CHANGE_FLAG_ALL;
- pd->changed = EINA_TRUE;
+ if (parent)
+ {
+ Efl_Canvas_Vg_Node_Data *parent_nd =
+ efl_data_scope_get(parent, MY_CLASS);
+ nd->vg_obj = parent_nd->vg_obj;
+ nd->vd = parent_nd->vd;
+ }
+
+ nd->flags = EFL_GFX_CHANGE_FLAG_ALL;
+ nd->changed = EINA_TRUE;
return obj;
}
static void
_efl_canvas_vg_node_efl_object_parent_set(Eo *obj,
- Efl_Canvas_Vg_Node_Data *pd EINA_UNUSED,
- Eo *parent)
+ Efl_Canvas_Vg_Node_Data *nd,
+ Eo *parent)
{
Efl_Canvas_Vg_Container_Data *cd = NULL;
Efl_Canvas_Vg_Container_Data *old_cd;
- Efl_Canvas_Vg_Node_Data *nd;
Efl_VG *old_parent;
- Eina_Bool parent_container = EINA_TRUE;
-
- nd = efl_data_scope_get(obj, MY_CLASS);
-
- //No, prevent infinite calls parent_set() -> root_node_set() -> parent_set() -> ...
- if (nd->parenting) return;
-
- //Cut off root node from vg object if it does....
- if (nd->vg_obj)
- {
- nd->parenting = EINA_TRUE;
- evas_object_vg_root_node_set(nd->vg_obj, NULL);
- nd->parenting = EINA_FALSE;
- nd->vg_obj = NULL;
- }
if (efl_isa(parent, EFL_CANVAS_VG_CONTAINER_CLASS))
cd = efl_data_scope_get(parent, EFL_CANVAS_VG_CONTAINER_CLASS);
else if (efl_isa(parent, EFL_CANVAS_VG_OBJECT_CLASS))
- parent_container = EINA_FALSE;
+ {
+ if (nd->vg_obj != parent)
+ {
+ nd->vg_obj = parent;
+ nd->vd = efl_data_scope_get(parent, EFL_CANVAS_VG_OBJECT_CLASS);
+ efl_canvas_vg_container_vg_obj_update(obj, nd);
+ }
+
+ }
else if (parent)
{
ERR("parent(%p, class = %s) is not allowed by vg node(%p).",
parent, efl_class_name_get(efl_class_get(parent)), obj);
return;
}
- else parent_container = EINA_FALSE;
if (!_efl_canvas_vg_node_parent_checked_get(obj, &old_parent, &old_cd))
return;
{
old_cd->children = eina_list_remove(old_cd->children, obj);
eina_hash_del(old_cd->names, efl_name_get(efl_super(obj, MY_CLASS)), obj);
+ _node_change(old_parent, efl_data_scope_get(old_parent, MY_CLASS));
}
efl_parent_set(efl_super(obj, MY_CLASS), parent);
{
cd->children = eina_list_append(cd->children, obj);
_efl_canvas_vg_node_name_insert(obj, cd);
+
+ Efl_Canvas_Vg_Node_Data *parent_nd = efl_data_scope_get(parent, MY_CLASS);
+ _node_change(parent, parent_nd);
+
+ if (nd->vg_obj != parent_nd->vg_obj)
+ {
+ nd->vg_obj = parent_nd->vg_obj;
+ nd->vd = parent_nd->vd;
+ efl_canvas_vg_container_vg_obj_update(obj, nd);
+ }
}
- _efl_canvas_vg_node_changed(old_parent);
- _efl_canvas_vg_node_changed(obj);
- if (parent_container) _efl_canvas_vg_node_changed(parent);
+ _node_change(obj, nd);
}
static void
cd->children = eina_list_remove_list(cd->children, lookup);
cd->children = eina_list_append_relative_list(cd->children, obj, next);
- _efl_canvas_vg_node_changed(parent);
- return ;
+ _node_change(parent, efl_data_scope_get(parent, MY_CLASS));
+ return;
on_error:
ERR("Err");
static void
_efl_canvas_vg_node_efl_gfx_stack_stack_above(Eo *obj,
- Efl_Canvas_Vg_Node_Data *pd EINA_UNUSED,
- Efl_Gfx_Stack *above)
+ Efl_Canvas_Vg_Node_Data *pd EINA_UNUSED,
+ Efl_Gfx_Stack *above)
{
Efl_Canvas_Vg_Container_Data *cd;
Eina_List *lookup, *ref;
cd->children = eina_list_remove_list(cd->children, lookup);
cd->children = eina_list_append_relative_list(cd->children, obj, ref);
- _efl_canvas_vg_node_changed(parent);
- return ;
+ _node_change(parent, efl_data_scope_get(parent, MY_CLASS));
+ return;
on_error:
ERR("Err");
static void
_efl_canvas_vg_node_efl_gfx_stack_stack_below(Eo *obj,
- Efl_Canvas_Vg_Node_Data *pd EINA_UNUSED,
- Efl_Gfx_Stack *below)
+ Efl_Canvas_Vg_Node_Data *pd EINA_UNUSED,
+ Efl_Gfx_Stack *below)
{
Efl_Canvas_Vg_Container_Data *cd;
Eina_List *lookup, *ref;
cd->children = eina_list_remove_list(cd->children, lookup);
cd->children = eina_list_prepend_relative_list(cd->children, obj, ref);
- _efl_canvas_vg_node_changed(parent);
- return ;
+ _node_change(parent, efl_data_scope_get(parent, MY_CLASS));
+ return;
on_error:
ERR("Err");
if (!lookup) goto on_error;
prev = eina_list_prev(lookup);
- if (!prev) return ;
+ if (!prev) return;
cd->children = eina_list_remove_list(cd->children, lookup);
cd->children = eina_list_prepend_relative_list(cd->children, obj, prev);
- _efl_canvas_vg_node_changed(parent);
- return ;
+ _node_change(parent, efl_data_scope_get(parent, MY_CLASS));
+ return;
on_error:
ERR("Err");
/* Warning! Node itself doesn't have any path. Don't call super class(Path)'s */
static Eina_Bool
-_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)
+_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)
{
Efl_Canvas_Vg_Node_Data *fromd, *tod;
double from_map;
pd->visibility = pos_map >= 0.5 ? tod->visibility : fromd->visibility;
- _efl_canvas_vg_node_changed(obj);
+ _node_change(obj, pd);
return EINA_TRUE;
}
void
-efl_canvas_vg_node_root_set(Efl_VG *node, Efl_VG *vg_obj)
+efl_canvas_vg_node_vg_obj_set(Efl_VG *node, Efl_VG *vg_obj, Efl_Canvas_Vg_Object_Data *vd)
{
Efl_Canvas_Vg_Node_Data *nd = efl_data_scope_get(node, MY_CLASS);
+ if (nd->vg_obj == vg_obj) return;
nd->vg_obj = vg_obj;
+ nd->vd = vd;
+
+ //root node is always container.
+ efl_canvas_vg_container_vg_obj_update(node, nd);
}
+void
+efl_canvas_vg_node_change(Eo *obj)
+{
+ if (!obj) return;
+ _node_change(obj, efl_data_scope_get(obj, EFL_CANVAS_VG_NODE_CLASS));
+}
EOLIAN static Efl_VG *
_efl_canvas_vg_node_efl_duplicate_duplicate(const Eo *obj, Efl_Canvas_Vg_Node_Data *pd)
Efl_VG *root;
Vg_Cache_Entry *vg_entry;
Vg_User_Entry *user_entry; //holds the user set vg tree
+ Evas_Object_Protected_Data *obj;
Eina_Rect fill;
Eina_Rect viewbox;
unsigned int width, height;
Ector_Renderer *renderer;
- Efl_VG *vg_obj; //...Not necessary!!
+ Efl_VG *vg_obj;
+ Efl_Canvas_Vg_Object_Data *vd;
void (*render_pre)(Evas_Object_Protected_Data *vg_pd, Efl_VG *node,
Efl_Canvas_Vg_Node_Data *nd, Ector_Surface *surface,
Eina_Bool visibility : 1;
Eina_Bool changed : 1;
- Eina_Bool parenting : 1;
};
typedef struct _Vg_Mask
double evas_cache_vg_anim_duration_get(const Vg_Cache_Entry *vg_entry);
unsigned int evas_cache_vg_anim_frame_count_get(const Vg_Cache_Entry *vg_entry);
Eina_Size2D evas_cache_vg_entry_default_size_get(const Vg_Cache_Entry *vg_entry);
-void efl_canvas_vg_node_root_set(Efl_VG *node, Efl_VG *vg_obj);
+void efl_canvas_vg_node_vg_obj_set(Efl_VG *node, Efl_VG *vg_obj, Efl_Canvas_Vg_Object_Data *vd);
+void efl_canvas_vg_node_change(Efl_VG *node);
+void efl_canvas_vg_container_vg_obj_update(Efl_VG *obj, Efl_Canvas_Vg_Node_Data *nd);
+
+static inline void
+efl_canvas_vg_object_change(Efl_Canvas_Vg_Object_Data *vd)
+{
+ if (!vd || vd->changed) return;
+ vd->changed = EINA_TRUE;
+ evas_object_change(vd->obj->object, vd->obj);
+}
static inline Efl_Canvas_Vg_Node_Data *
_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)
return nd;
}
-static inline void
-_efl_canvas_vg_node_changed(Eo *obj)
-{
- Efl_Gfx_Path_Change_Event ev = { EFL_GFX_CHANGE_FLAG_FILL };
-
- if (obj) efl_event_callback_call(obj, EFL_GFX_PATH_EVENT_CHANGED, &ev);
-}
-
#define EFL_CANVAS_VG_COMPUTE_MATRIX(Current, Parent, Nd) \
Eina_Matrix3 *Current = Nd->m; \
Eina_Matrix3 _matrix_tmp; \