summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas
diff options
context:
space:
mode:
authorsubhransu mohanty <sub.mohanty@samsung.com>2017-11-08 15:49:37 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-11-08 15:55:52 +0900
commit8952c3e52444d78504a822bf95d757621891dd41 (patch)
treef9bb53fea3fe98026a91b83540c9074784497e86 /src/lib/evas/canvas
parent75a65ad41a02e2352a193b3b6cea2a99b7562591 (diff)
evas/vg: changed the efl_vg_dup api signature.
Reviewers: jpeg, cedric Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5440
Diffstat (limited to 'src/lib/evas/canvas')
-rw-r--r--src/lib/evas/canvas/efl_vg.eo6
-rw-r--r--src/lib/evas/canvas/evas_vg_container.c26
-rw-r--r--src/lib/evas/canvas/evas_vg_gradient.c21
-rw-r--r--src/lib/evas/canvas/evas_vg_gradient_linear.c18
-rw-r--r--src/lib/evas/canvas/evas_vg_gradient_radial.c20
-rw-r--r--src/lib/evas/canvas/evas_vg_node.c70
-rw-r--r--src/lib/evas/canvas/evas_vg_shape.c44
7 files changed, 74 insertions, 131 deletions
diff --git a/src/lib/evas/canvas/efl_vg.eo b/src/lib/evas/canvas/efl_vg.eo
index ecb5141..2d64ade 100644
--- a/src/lib/evas/canvas/efl_vg.eo
+++ b/src/lib/evas/canvas/efl_vg.eo
@@ -103,11 +103,9 @@ abstract Efl.VG (Efl.Object, Efl.Gfx, Efl.Gfx.Stack)
103 @in pos_map: double; [[Interpolate mapping]] 103 @in pos_map: double; [[Interpolate mapping]]
104 } 104 }
105 } 105 }
106 dup { 106 dup @const {
107 [[Duplicate vector graphics object]] 107 [[Duplicate vector graphics object]]
108 params { 108 return: Efl.VG @owned;
109 @in from: const(Efl.VG); [[Source object]]
110 }
111 } 109 }
112 } 110 }
113 implements { 111 implements {
diff --git a/src/lib/evas/canvas/evas_vg_container.c b/src/lib/evas/canvas/evas_vg_container.c
index 704d6c1..b89d702 100644
--- a/src/lib/evas/canvas/evas_vg_container.c
+++ b/src/lib/evas/canvas/evas_vg_container.c
@@ -151,28 +151,20 @@ _efl_vg_container_efl_vg_interpolate(Eo *obj,
151 return r; 151 return r;
152} 152}
153 153
154static void 154EOLIAN static Efl_VG *
155_efl_vg_container_efl_vg_dup(Eo *obj, 155_efl_vg_container_efl_vg_dup(const Eo *obj, Efl_VG_Container_Data *pd)
156 Efl_VG_Container_Data *pd,
157 const Efl_VG *from)
158{ 156{
159 Efl_VG_Container_Data *fromd;
160 Eina_List *l; 157 Eina_List *l;
161 Eo *child; 158 Efl_VG *child;
162 159 Efl_VG *cn = NULL;
163 efl_vg_dup(efl_super(obj, EFL_VG_CONTAINER_CLASS), from);
164 160
165 fromd = efl_data_scope_get(from, EFL_VG_CONTAINER_CLASS); 161 cn = efl_vg_dup(efl_super(obj, MY_CLASS));
166 162 EINA_LIST_FOREACH(pd->children, l, child)
167 EINA_LIST_FREE(pd->children, child)
168 efl_unref(child);
169
170 EINA_LIST_FOREACH(fromd->children, l, child)
171 { 163 {
172 // By setting parent, we automatically reference 164 // parent_set adds the new node to the list of children of cn
173 // this new object as a child of obj. Magic at work ! 165 efl_parent_set(efl_vg_dup(child), cn);
174 (void) efl_add(efl_class_get(child), obj, efl_vg_dup(efl_added, child));
175 } 166 }
167 return cn;
176} 168}
177 169
178EAPI Efl_VG* 170EAPI Efl_VG*
diff --git a/src/lib/evas/canvas/evas_vg_gradient.c b/src/lib/evas/canvas/evas_vg_gradient.c
index 12f8b3d..db59b1b 100644
--- a/src/lib/evas/canvas/evas_vg_gradient.c
+++ b/src/lib/evas/canvas/evas_vg_gradient.c
@@ -5,6 +5,8 @@
5 5
6#include <strings.h> 6#include <strings.h>
7 7
8#define MY_CLASS EFL_VG_GRADIENT_CLASS
9
8static void 10static void
9_efl_vg_gradient_efl_gfx_gradient_stop_set(Eo *obj EINA_UNUSED, 11_efl_vg_gradient_efl_gfx_gradient_stop_set(Eo *obj EINA_UNUSED,
10 Efl_VG_Gradient_Data *pd, 12 Efl_VG_Gradient_Data *pd,
@@ -94,19 +96,16 @@ _efl_vg_gradient_efl_vg_interpolate(Eo *obj,
94 return EINA_TRUE; 96 return EINA_TRUE;
95} 97}
96 98
97static void 99EOLIAN static Efl_VG *
98_efl_vg_gradient_efl_vg_dup(Eo *obj, 100_efl_vg_gradient_efl_vg_dup(const Eo *obj, Efl_VG_Gradient_Data *pd)
99 Efl_VG_Gradient_Data *pd EINA_UNUSED,
100 const Efl_VG *from)
101{
102 Efl_VG_Gradient_Data *fromd;
103
104 efl_vg_dup(efl_super(obj, EFL_VG_GRADIENT_CLASS), from);
105 101
106 fromd = efl_data_scope_get(from, EFL_VG_GRADIENT_CLASS); 102{
103 Efl_VG *cn = NULL;
107 104
108 efl_gfx_gradient_stop_set(obj, fromd->colors, fromd->colors_count); 105 cn = efl_vg_dup(efl_super(obj, MY_CLASS));
109 efl_gfx_gradient_spread_set(obj, fromd->s); 106 efl_gfx_gradient_stop_set(cn, pd->colors, pd->colors_count);
107 efl_gfx_gradient_spread_set(cn, pd->s);
108 return cn;
110} 109}
111 110
112EAPI void 111EAPI void
diff --git a/src/lib/evas/canvas/evas_vg_gradient_linear.c b/src/lib/evas/canvas/evas_vg_gradient_linear.c
index fcefa55..3549faf 100644
--- a/src/lib/evas/canvas/evas_vg_gradient_linear.c
+++ b/src/lib/evas/canvas/evas_vg_gradient_linear.c
@@ -153,19 +153,15 @@ _efl_vg_gradient_linear_efl_vg_interpolate(Eo *obj,
153 return EINA_TRUE; 153 return EINA_TRUE;
154} 154}
155 155
156static void 156EOLIAN static Efl_VG *
157_efl_vg_gradient_linear_efl_vg_dup(Eo *obj, 157_efl_vg_gradient_linear_efl_vg_dup(const Eo *obj, Efl_VG_Gradient_Linear_Data *pd)
158 Efl_VG_Gradient_Linear_Data *pd EINA_UNUSED,
159 const Efl_VG *from)
160{ 158{
161 Efl_VG_Gradient_Linear_Data *fromd; 159 Efl_VG *cn = NULL;
162
163 efl_vg_dup(efl_super(obj, EFL_VG_GRADIENT_LINEAR_CLASS), from);
164
165 fromd = efl_data_scope_get(from, EFL_VG_GRADIENT_LINEAR_CLASS);
166 160
167 efl_gfx_gradient_linear_start_set(obj, fromd->start.x, fromd->start.y); 161 cn = efl_vg_dup(efl_super(obj, MY_CLASS));
168 efl_gfx_gradient_linear_end_set(obj, fromd->end.x, fromd->end.y); 162 efl_gfx_gradient_linear_start_set(cn, pd->start.x, pd->start.y);
163 efl_gfx_gradient_linear_end_set(cn, pd->end.x, pd->end.y);
164 return cn;
169} 165}
170 166
171EAPI void 167EAPI void
diff --git a/src/lib/evas/canvas/evas_vg_gradient_radial.c b/src/lib/evas/canvas/evas_vg_gradient_radial.c
index 3436df2..8108e8a 100644
--- a/src/lib/evas/canvas/evas_vg_gradient_radial.c
+++ b/src/lib/evas/canvas/evas_vg_gradient_radial.c
@@ -172,20 +172,18 @@ _efl_vg_gradient_radial_efl_vg_interpolate(Eo *obj,
172 return EINA_TRUE; 172 return EINA_TRUE;
173} 173}
174 174
175static void
176_efl_vg_gradient_radial_efl_vg_dup(Eo *obj,
177 Efl_VG_Gradient_Radial_Data *pd EINA_UNUSED,
178 const Efl_VG *from)
179{
180 Efl_VG_Gradient_Radial_Data *fromd;
181 175
182 efl_vg_dup(efl_super(obj, EFL_VG_GRADIENT_RADIAL_CLASS), from); 176EOLIAN static Efl_VG *
177_efl_vg_gradient_radial_efl_vg_dup(const Eo *obj, Efl_VG_Gradient_Radial_Data *pd)
183 178
184 fromd = efl_data_scope_get(from, EFL_VG_GRADIENT_RADIAL_CLASS); 179{
180 Efl_VG *cn = NULL;
185 181
186 efl_gfx_gradient_radial_focal_set(obj, fromd->focal.x, fromd->focal.y); 182 cn = efl_vg_dup(efl_super(obj, MY_CLASS));
187 efl_gfx_gradient_radial_center_set(obj, fromd->center.x, fromd->center.y); 183 efl_gfx_gradient_radial_focal_set(cn, pd->focal.x, pd->focal.y);
188 efl_gfx_gradient_radial_radius_set(obj, fromd->radius); 184 efl_gfx_gradient_radial_center_set(cn, pd->center.x, pd->center.y);
185 efl_gfx_gradient_radial_radius_set(cn, pd->radius);
186 return cn;
189} 187}
190 188
191EAPI void 189EAPI void
diff --git a/src/lib/evas/canvas/evas_vg_node.c b/src/lib/evas/canvas/evas_vg_node.c
index 04f576e..dbe4abe 100644
--- a/src/lib/evas/canvas/evas_vg_node.c
+++ b/src/lib/evas/canvas/evas_vg_node.c
@@ -715,61 +715,35 @@ _efl_vg_interpolate(Eo *obj,
715 return r; 715 return r;
716} 716}
717 717
718static void 718EOLIAN static Efl_VG *
719_efl_vg_dup(Eo *obj, Efl_VG_Data *pd, const Efl_VG *from) 719_efl_vg_dup(const Eo *obj, Efl_VG_Data *pd)
720{ 720{
721 Efl_VG_Container_Data *cd = NULL; 721 Efl_VG *cn;
722 Efl_VG_Data *fromd; 722 Efl_VG_Data *cd;
723 Eo *parent = NULL;
724
725 fromd = efl_data_scope_get(from, EFL_VG_CLASS);
726 if (pd->name != fromd->name)
727 {
728 eina_stringshare_del(pd->name);
729 pd->name = eina_stringshare_ref(fromd->name);
730 }
731
732 _efl_vg_parent_checked_get(obj, &parent, &cd);
733 if (cd) _efl_vg_name_insert(obj, pd, cd);
734
735 if (pd->intp)
736 {
737 free(pd->intp);
738 pd->intp = NULL;
739 }
740
741 if (pd->renderer)
742 {
743 efl_del(pd->renderer);
744 pd->renderer = NULL;
745 }
746 723
747 if (fromd->m) 724 cn = efl_add(efl_class_get(obj), NULL);
748 { 725 cd = efl_data_scope_get(cn, MY_CLASS);
749 pd->m = pd->m ? pd->m : malloc(sizeof (Eina_Matrix3)) ; 726 EINA_SAFETY_ON_NULL_RETURN_VAL(cd, NULL);
750 if (pd->m) memcpy(pd->m, fromd->m, sizeof (Eina_Matrix3)); 727 if (pd->name)
751 } 728 cd->name = eina_stringshare_ref(pd->name);
752 else 729 if (pd->m)
753 { 730 {
754 free(pd->m); 731 cd->m = malloc(sizeof (Eina_Matrix3)) ;
732 if (cd->m) memcpy(cd->m, pd->m, sizeof (Eina_Matrix3));
755 } 733 }
756 734
757 // We may come from an already duped/initialized node, clean it first 735 if (pd->mask)
758 _efl_vg_clean_object(&pd->mask); 736 cd->mask = efl_vg_dup(pd->mask);
759 if (fromd->mask)
760 {
761 pd->mask = efl_add(efl_class_get(fromd->mask), obj, efl_vg_dup(efl_added, pd->mask));
762 }
763 737
764 pd->x = fromd->x; 738 cd->x = pd->x;
765 pd->y = fromd->y; 739 cd->y = pd->y;
766 pd->r = fromd->r; 740 cd->r = pd->r;
767 pd->g = fromd->g; 741 cd->g = pd->g;
768 pd->b = fromd->b; 742 cd->b = pd->b;
769 pd->a = fromd->a; 743 cd->a = pd->a;
770 pd->visibility = fromd->visibility; 744 cd->visibility = pd->visibility;
771 745
772 _efl_vg_changed(obj); 746 return cn;
773} 747}
774 748
775EAPI Eina_Bool 749EAPI Eina_Bool
diff --git a/src/lib/evas/canvas/evas_vg_shape.c b/src/lib/evas/canvas/evas_vg_shape.c
index a5f0d29..f2137b0 100644
--- a/src/lib/evas/canvas/evas_vg_shape.c
+++ b/src/lib/evas/canvas/evas_vg_shape.c
@@ -181,38 +181,24 @@ _efl_vg_shape_efl_vg_interpolate(Eo *obj,
181 return r; 181 return r;
182} 182}
183 183
184static void
185_efl_vg_shape_efl_vg_dup(Eo *obj, Efl_VG_Shape_Data *pd EINA_UNUSED, const Efl_VG *from)
186{
187 Efl_VG_Shape_Data *fromd;
188 Eo *fill = NULL, *stroke_fill = NULL, *stroke_marker = NULL;
189
190 efl_vg_dup(efl_super(obj, MY_CLASS), from);
191
192 fromd = efl_data_scope_get(from, MY_CLASS);
193
194 if (fromd->fill)
195 {
196 fill = efl_add(efl_class_get(fromd->fill), NULL, efl_vg_dup(efl_added, fromd->fill));
197 efl_vg_shape_fill_set(obj, fill);
198 efl_unref(fill);
199 }
200 184
201 if (fromd->stroke.fill) 185EOLIAN static Efl_VG *
202 { 186_efl_vg_shape_efl_vg_dup(const Eo *obj, Efl_VG_Shape_Data *pd)
203 stroke_fill = efl_add(efl_class_get(fromd->stroke.fill), NULL, efl_vg_dup(efl_added, fromd->stroke.fill)); 187{
204 efl_vg_shape_stroke_fill_set(obj, stroke_fill); 188 Efl_VG *cn = NULL;
205 efl_unref(stroke_fill); 189 Efl_VG_Shape_Data *cd = NULL;
206 }
207 190
208 if (fromd->stroke.marker) 191 cn = efl_vg_dup(efl_super(obj, MY_CLASS));
209 { 192 cd = efl_data_scope_get(cn, MY_CLASS);
210 stroke_marker = efl_add(efl_class_get(fromd->stroke.marker), NULL, efl_vg_dup(efl_added, fromd->stroke.marker)); 193 if (pd->fill)
211 efl_vg_shape_stroke_marker_set(obj, stroke_marker); 194 cd->fill = efl_vg_dup(pd->fill);
212 efl_unref(stroke_marker); 195 if (pd->stroke.fill)
213 } 196 cd->stroke.fill = efl_vg_dup(pd->stroke.fill);
197 if (pd->stroke.marker)
198 cd->stroke.marker = efl_vg_dup(pd->stroke.marker);
214 199
215 efl_gfx_shape_dup(obj, from); 200 efl_gfx_shape_dup(cn, obj);
201 return cn;
216} 202}
217 203
218EAPI double 204EAPI double