summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_vg_shape.c
diff options
context:
space:
mode:
authorSubhransu Mohanty <sub.mohanty@samsung.com>2015-11-18 11:13:00 +0900
committerCedric BAIL <cedric@osg.samsung.com>2015-11-24 15:42:29 -0800
commit609f74994bbb7d054fde95f7b284cebb949b2ad0 (patch)
tree45d812f3b7927a8d67765e3cf4d772004a79a6b1 /src/lib/evas/canvas/evas_vg_shape.c
parentabe21101527c7f31e8c948b9d55306ed11c65e83 (diff)
efl: make path stroke related api as non virtual.
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/lib/evas/canvas/evas_vg_shape.c')
-rw-r--r--src/lib/evas/canvas/evas_vg_shape.c170
1 files changed, 9 insertions, 161 deletions
diff --git a/src/lib/evas/canvas/evas_vg_shape.c b/src/lib/evas/canvas/evas_vg_shape.c
index 520c684..84c0d79 100644
--- a/src/lib/evas/canvas/evas_vg_shape.c
+++ b/src/lib/evas/canvas/evas_vg_shape.c
@@ -11,20 +11,8 @@ struct _Efl_VG_Shape_Data
11 Efl_VG *fill; 11 Efl_VG *fill;
12 12
13 struct { 13 struct {
14 Efl_Gfx_Dash *dash;
15 Efl_VG *fill; 14 Efl_VG *fill;
16 Efl_VG *marker; 15 Efl_VG *marker;
17
18 double scale;
19 double width;
20 double centered; // from 0 to 1
21
22 int r, g, b, a;
23
24 unsigned int dash_count;
25
26 Efl_Gfx_Cap cap;
27 Efl_Gfx_Join join;
28 } stroke; 16 } stroke;
29}; 17};
30 18
@@ -56,38 +44,8 @@ _efl_vg_shape_fill_get(Eo *obj EINA_UNUSED, Efl_VG_Shape_Data *pd)
56 return pd->fill; 44 return pd->fill;
57} 45}
58 46
59static void
60_efl_vg_shape_efl_gfx_shape_stroke_scale_set(Eo *obj EINA_UNUSED,
61 Efl_VG_Shape_Data *pd,
62 double s)
63{
64 pd->stroke.scale = s;
65
66 _efl_vg_base_changed(obj);
67}
68
69static double
70_efl_vg_shape_efl_gfx_shape_stroke_scale_get(Eo *obj EINA_UNUSED,
71 Efl_VG_Shape_Data *pd)
72{
73 return pd->stroke.scale;
74}
75
76static void
77_efl_vg_shape_efl_gfx_shape_stroke_color_set(Eo *obj EINA_UNUSED,
78 Efl_VG_Shape_Data *pd,
79 int r, int g, int b, int a)
80{
81 pd->stroke.r = r;
82 pd->stroke.g = g;
83 pd->stroke.b = b;
84 pd->stroke.a = a;
85
86 _efl_vg_base_changed(obj);
87}
88
89static Eina_Bool 47static Eina_Bool
90_efl_vg_shape_efl_gfx_base_color_part_set(Eo *obj, Efl_VG_Shape_Data *pd, 48_efl_vg_shape_efl_gfx_base_color_part_set(Eo *obj, Efl_VG_Shape_Data *pd EINA_UNUSED,
91 const char * part, 49 const char * part,
92 int r, int g, int b, int a) 50 int r, int g, int b, int a)
93{ 51{
@@ -95,7 +53,7 @@ _efl_vg_shape_efl_gfx_base_color_part_set(Eo *obj, Efl_VG_Shape_Data *pd,
95 53
96 if (part && !strcmp(part, "stroke")) 54 if (part && !strcmp(part, "stroke"))
97 { 55 {
98 _efl_vg_shape_efl_gfx_shape_stroke_color_set(obj, pd, r, g, b, a); 56 eo_do(obj, efl_gfx_shape_stroke_color_set(r, g, b, a));
99 return EINA_TRUE; 57 return EINA_TRUE;
100 } 58 }
101 59
@@ -105,19 +63,8 @@ _efl_vg_shape_efl_gfx_base_color_part_set(Eo *obj, Efl_VG_Shape_Data *pd,
105 return ret; 63 return ret;
106} 64}
107 65
108static void
109_efl_vg_shape_efl_gfx_shape_stroke_color_get(Eo *obj EINA_UNUSED,
110 Efl_VG_Shape_Data *pd,
111 int *r, int *g, int *b, int *a)
112{
113 if (r) *r = pd->stroke.r;
114 if (g) *g = pd->stroke.g;
115 if (b) *b = pd->stroke.b;
116 if (a) *a = pd->stroke.a;
117}
118
119static Eina_Bool 66static Eina_Bool
120_efl_vg_shape_efl_gfx_base_color_part_get(Eo *obj, Efl_VG_Shape_Data *pd, 67_efl_vg_shape_efl_gfx_base_color_part_get(Eo *obj, Efl_VG_Shape_Data *pd EINA_UNUSED,
121 const char * part, 68 const char * part,
122 int *r, int *g, int *b, int *a) 69 int *r, int *g, int *b, int *a)
123{ 70{
@@ -125,7 +72,7 @@ _efl_vg_shape_efl_gfx_base_color_part_get(Eo *obj, Efl_VG_Shape_Data *pd,
125 72
126 if (part && !strcmp(part, "stroke")) 73 if (part && !strcmp(part, "stroke"))
127 { 74 {
128 _efl_vg_shape_efl_gfx_shape_stroke_color_get(obj, pd, r, g, b, a); 75 eo_do(obj, efl_gfx_shape_stroke_color_get(r, g, b, a));
129 return EINA_TRUE; 76 return EINA_TRUE;
130 } 77 }
131 78
@@ -156,72 +103,6 @@ _efl_vg_shape_stroke_fill_get(Eo *obj EINA_UNUSED,
156} 103}
157 104
158static void 105static void
159_efl_vg_shape_efl_gfx_shape_stroke_width_set(Eo *obj EINA_UNUSED,
160 Efl_VG_Shape_Data *pd,
161 double w)
162{
163 pd->stroke.width = w;
164
165 _efl_vg_base_changed(obj);
166}
167
168static double
169_efl_vg_shape_efl_gfx_shape_stroke_width_get(Eo *obj EINA_UNUSED,
170 Efl_VG_Shape_Data *pd)
171{
172 return pd->stroke.width;
173}
174
175static void
176_efl_vg_shape_efl_gfx_shape_stroke_location_set(Eo *obj EINA_UNUSED,
177 Efl_VG_Shape_Data *pd,
178 double centered)
179{
180 pd->stroke.centered = centered;
181
182 _efl_vg_base_changed(obj);
183}
184
185static double
186_efl_vg_shape_efl_gfx_shape_stroke_location_get(Eo *obj EINA_UNUSED,
187 Efl_VG_Shape_Data *pd)
188{
189 return pd->stroke.centered;
190}
191
192static void
193_efl_vg_shape_efl_gfx_shape_stroke_dash_set(Eo *obj EINA_UNUSED,
194 Efl_VG_Shape_Data *pd,
195 const Efl_Gfx_Dash *dash,
196 unsigned int length)
197{
198 free(pd->stroke.dash);
199 pd->stroke.dash = NULL;
200 pd->stroke.dash_count = 0;
201
202 // check for null or empty dash
203 if (!dash || !length) return;
204
205 pd->stroke.dash = malloc(sizeof (Efl_Gfx_Dash) * length);
206 if (!pd->stroke.dash) return ;
207
208 memcpy(pd->stroke.dash, dash, sizeof (Efl_Gfx_Dash) * length);
209 pd->stroke.dash_count = length;
210
211 _efl_vg_base_changed(obj);
212}
213
214static void
215_efl_vg_shape_efl_gfx_shape_stroke_dash_get(Eo *obj EINA_UNUSED,
216 Efl_VG_Shape_Data *pd,
217 const Efl_Gfx_Dash **dash,
218 unsigned int *length)
219{
220 if (dash) *dash = pd->stroke.dash;
221 if (length) *length = pd->stroke.dash_count;
222}
223
224static void
225_efl_vg_shape_stroke_marker_set(Eo *obj EINA_UNUSED, 106_efl_vg_shape_stroke_marker_set(Eo *obj EINA_UNUSED,
226 Efl_VG_Shape_Data *pd, 107 Efl_VG_Shape_Data *pd,
227 Efl_VG_Shape *m) 108 Efl_VG_Shape *m)
@@ -242,40 +123,6 @@ _efl_vg_shape_stroke_marker_get(Eo *obj EINA_UNUSED,
242} 123}
243 124
244static void 125static void
245_efl_vg_shape_efl_gfx_shape_stroke_cap_set(Eo *obj EINA_UNUSED,
246 Efl_VG_Shape_Data *pd,
247 Efl_Gfx_Cap c)
248{
249 pd->stroke.cap = c;
250
251 _efl_vg_base_changed(obj);
252}
253
254static Efl_Gfx_Cap
255_efl_vg_shape_efl_gfx_shape_stroke_cap_get(Eo *obj EINA_UNUSED,
256 Efl_VG_Shape_Data *pd)
257{
258 return pd->stroke.cap;
259}
260
261static void
262_efl_vg_shape_efl_gfx_shape_stroke_join_set(Eo *obj EINA_UNUSED,
263 Efl_VG_Shape_Data *pd,
264 Efl_Gfx_Join j)
265{
266 pd->stroke.join = j;
267
268 _efl_vg_base_changed(obj);
269}
270
271static Efl_Gfx_Join
272_efl_vg_shape_efl_gfx_shape_stroke_join_get(Eo *obj EINA_UNUSED,
273 Efl_VG_Shape_Data *pd)
274{
275 return pd->stroke.join;
276}
277
278static void
279_efl_vg_shape_render_pre(Eo *obj EINA_UNUSED, 126_efl_vg_shape_render_pre(Eo *obj EINA_UNUSED,
280 Eina_Matrix3 *parent, 127 Eina_Matrix3 *parent,
281 Ector_Surface *s, 128 Ector_Surface *s,
@@ -323,10 +170,11 @@ _efl_vg_shape_eo_base_constructor(Eo *obj, Efl_VG_Shape_Data *pd)
323 170
324 obj = eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor()); 171 obj = eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
325 172
326 pd->stroke.cap = EFL_GFX_CAP_BUTT; 173 eo_do(obj,
327 pd->stroke.join = EFL_GFX_JOIN_MITER; 174 efl_gfx_shape_stroke_scale_set(1),
328 pd->stroke.scale = 1; 175 efl_gfx_shape_stroke_location_set(0.5),
329 pd->stroke.centered = 0.5; 176 efl_gfx_shape_stroke_cap_set(EFL_GFX_CAP_BUTT),
177 efl_gfx_shape_stroke_join_set(EFL_GFX_JOIN_MITER));
330 178
331 nd = eo_data_scope_get(obj, EFL_VG_BASE_CLASS); 179 nd = eo_data_scope_get(obj, EFL_VG_BASE_CLASS);
332 nd->render_pre = _efl_vg_shape_render_pre; 180 nd->render_pre = _efl_vg_shape_render_pre;