summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-11-11 16:08:17 -0800
committerCedric BAIL <cedric@osg.samsung.com>2015-11-12 15:53:01 -0800
commit1ed7ebaa0b6fa0100c816fb9525484edf258d72a (patch)
treeea2988ef38a83552614ed0383a55053106430283
parente6e104ee731e3b5856fe36ee11908f64ab5c49cf (diff)
ector: do get symbol at object construction time.
This make it part of the object initialization and will prevent the construction of the object if the needed cairo function are not fund. So if Ector can create the object, it can display them.
-rw-r--r--src/lib/ector/cairo/ector_cairo_surface.c17
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_base.c30
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.c32
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.eo1
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.c32
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.eo1
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_shape.c55
7 files changed, 86 insertions, 82 deletions
diff --git a/src/lib/ector/cairo/ector_cairo_surface.c b/src/lib/ector/cairo/ector_cairo_surface.c
index bd44405f81..c073adb4d1 100644
--- a/src/lib/ector/cairo/ector_cairo_surface.c
+++ b/src/lib/ector/cairo/ector_cairo_surface.c
@@ -82,18 +82,13 @@ static cairo_t *(*cairo_create)(cairo_surface_t *target) = NULL;
82static cairo_surface_t *internal = NULL; 82static cairo_surface_t *internal = NULL;
83 83
84static void 84static void
85_ector_cairo_surface_context_set(Eo *obj, 85_ector_cairo_surface_context_set(Eo *obj EINA_UNUSED,
86 Ector_Cairo_Surface_Data *pd, 86 Ector_Cairo_Surface_Data *pd,
87 cairo_t *ctx) 87 cairo_t *ctx)
88{ 88{
89 USE(obj, cairo_destroy, );
90
91 if (pd->cairo) cairo_destroy(pd->cairo); 89 if (pd->cairo) cairo_destroy(pd->cairo);
92 if (!ctx) 90 if (!ctx)
93 { 91 {
94 USE(obj, cairo_image_surface_create, );
95 USE(obj, cairo_create, );
96
97 if (!internal) internal = cairo_image_surface_create(0, 1, 1); 92 if (!internal) internal = cairo_image_surface_create(0, 1, 1);
98 ctx = cairo_create(internal); 93 ctx = cairo_create(internal);
99 } 94 }
@@ -121,7 +116,13 @@ static Eo *
121_ector_cairo_surface_eo_base_constructor(Eo *obj, 116_ector_cairo_surface_eo_base_constructor(Eo *obj,
122 Ector_Cairo_Surface_Data *pd) 117 Ector_Cairo_Surface_Data *pd)
123{ 118{
124 obj = eo_do_super_ret(obj, ECTOR_CAIRO_SURFACE_CLASS, obj, eo_constructor()); 119 USE(obj, cairo_destroy, NULL);
120 USE(obj, cairo_image_surface_create, NULL);
121 USE(obj, cairo_create, NULL);
122
123 eo_do_super(obj, ECTOR_CAIRO_SURFACE_CLASS, obj = eo_constructor());
124 if (!obj) return NULL;
125
125 _cairo_count++; 126 _cairo_count++;
126 127
127 _ector_cairo_surface_context_set(obj, pd, NULL); 128 _ector_cairo_surface_context_set(obj, pd, NULL);
@@ -135,8 +136,6 @@ _ector_cairo_surface_eo_base_destructor(Eo *obj EINA_UNUSED,
135{ 136{
136 eo_do_super(obj, ECTOR_CAIRO_SURFACE_CLASS, eo_destructor()); 137 eo_do_super(obj, ECTOR_CAIRO_SURFACE_CLASS, eo_destructor());
137 138
138
139
140 if (--_cairo_count) return ; 139 if (--_cairo_count) return ;
141 if (_cairo_so) eina_module_free(_cairo_so); 140 if (_cairo_so) eina_module_free(_cairo_so);
142 _cairo_so = NULL; 141 _cairo_so = NULL;
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_base.c b/src/lib/ector/cairo/ector_renderer_cairo_base.c
index 420ce1f908..973648b6bc 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_base.c
+++ b/src/lib/ector/cairo/ector_renderer_cairo_base.c
@@ -107,8 +107,6 @@ _ector_renderer_cairo_base_ector_renderer_generic_base_prepare(Eo *obj, Ector_Re
107 } 107 }
108 if (pd->generic->m) 108 if (pd->generic->m)
109 { 109 {
110 USE(obj, cairo_matrix_init, EINA_FALSE);
111
112 if (!pd->m) pd->m = malloc(sizeof (cairo_matrix_t)); 110 if (!pd->m) pd->m = malloc(sizeof (cairo_matrix_t));
113 cairo_matrix_init(pd->m, 111 cairo_matrix_init(pd->m,
114 pd->generic->m->xx, pd->generic->m->yx, 112 pd->generic->m->xx, pd->generic->m->yx,
@@ -125,7 +123,7 @@ _ector_renderer_cairo_base_ector_renderer_generic_base_prepare(Eo *obj, Ector_Re
125} 123}
126 124
127static Eina_Bool 125static Eina_Bool
128_ector_renderer_cairo_base_ector_renderer_generic_base_draw(Eo *obj, 126_ector_renderer_cairo_base_ector_renderer_generic_base_draw(Eo *obj EINA_UNUSED,
129 Ector_Renderer_Cairo_Base_Data *pd, 127 Ector_Renderer_Cairo_Base_Data *pd,
130 Ector_Rop op, 128 Ector_Rop op,
131 Eina_Array *clips EINA_UNUSED, 129 Eina_Array *clips EINA_UNUSED,
@@ -135,11 +133,6 @@ _ector_renderer_cairo_base_ector_renderer_generic_base_draw(Eo *obj,
135 cairo_operator_t cop; 133 cairo_operator_t cop;
136 double cx, cy; 134 double cx, cy;
137 135
138 USE(obj, cairo_translate, EINA_FALSE);
139 USE(obj, cairo_set_source_rgba, EINA_FALSE);
140 USE(obj, cairo_transform, EINA_FALSE);
141 USE(obj, cairo_set_operator, EINA_FALSE);
142
143 switch (op) 136 switch (op)
144 { 137 {
145 case ECTOR_ROP_BLEND: 138 case ECTOR_ROP_BLEND:
@@ -159,11 +152,6 @@ _ector_renderer_cairo_base_ector_renderer_generic_base_draw(Eo *obj,
159 152
160 cairo_set_operator(pd->parent->cairo, cop); 153 cairo_set_operator(pd->parent->cairo, cop);
161 154
162
163 USE(obj, cairo_new_path, EINA_FALSE);
164 USE(obj, cairo_rectangle, EINA_FALSE);
165 USE(obj, cairo_clip, EINA_FALSE);
166 USE(obj, cairo_device_to_user, EINA_FALSE);
167 if (clips) 155 if (clips)
168 { 156 {
169 int clip_count = eina_array_count(clips); 157 int clip_count = eina_array_count(clips);
@@ -198,11 +186,21 @@ _ector_renderer_cairo_base_ector_renderer_generic_base_draw(Eo *obj,
198static Eo * 186static Eo *
199_ector_renderer_cairo_base_eo_base_constructor(Eo *obj, Ector_Renderer_Cairo_Base_Data *pd EINA_UNUSED) 187_ector_renderer_cairo_base_eo_base_constructor(Eo *obj, Ector_Renderer_Cairo_Base_Data *pd EINA_UNUSED)
200{ 188{
201 obj = eo_do_super_ret(obj, ECTOR_RENDERER_CAIRO_BASE_CLASS, obj, eo_constructor()); 189 USE(obj, cairo_matrix_init, NULL);
190 USE(obj, cairo_translate, NULL);
191 USE(obj, cairo_set_source_rgba, NULL);
192 USE(obj, cairo_transform, NULL);
193 USE(obj, cairo_set_operator, NULL);
194 USE(obj, cairo_new_path, NULL);
195 USE(obj, cairo_rectangle, NULL);
196 USE(obj, cairo_clip, NULL);
197 USE(obj, cairo_device_to_user, NULL);
198 USE(obj, cairo_matrix_init_identity, NULL);
202 199
203 pd->generic = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS, obj); 200 eo_do_super(obj, ECTOR_RENDERER_CAIRO_BASE_CLASS, obj = eo_constructor());
201 if (!obj) return NULL;
204 202
205 USE(obj, cairo_matrix_init_identity, NULL); 203 pd->generic = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS, obj);
206 204
207 cairo_matrix_init_identity(&identity); 205 cairo_matrix_init_identity(&identity);
208 206
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.c b/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.c
index 21ba87861d..a105d2c3fa 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.c
+++ b/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.c
@@ -34,14 +34,11 @@ _ector_renderer_cairo_gradient_linear_prepare(Eo *obj,
34{ 34{
35 cairo_pattern_t *pat; 35 cairo_pattern_t *pat;
36 36
37 USE(obj, cairo_pattern_create_linear, NULL);
38
39 pat = cairo_pattern_create_linear(gld->start.x, gld->start.y, 37 pat = cairo_pattern_create_linear(gld->start.x, gld->start.y,
40 gld->end.x, gld->end.y); 38 gld->end.x, gld->end.y);
41 if (!pat) return NULL; 39 if (!pat) return NULL;
42 _ector_renderer_cairo_gradient_prepare(obj, pat, gd, mul_col); 40 _ector_renderer_cairo_gradient_prepare(obj, pat, gd, mul_col);
43 41
44 USE(obj, cairo_pattern_set_extend, NULL);
45 cairo_pattern_set_extend(pat, _ector_cairo_extent_get(gd->s)); 42 cairo_pattern_set_extend(pat, _ector_cairo_extent_get(gd->s));
46 43
47 return pat; 44 return pat;
@@ -84,11 +81,6 @@ _ector_renderer_cairo_gradient_linear_ector_renderer_generic_base_draw(Eo *obj,
84 81
85 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS, ector_renderer_draw(op, clips, mul_col)); 82 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS, ector_renderer_draw(op, clips, mul_col));
86 83
87 USE(obj, cairo_rectangle, EINA_FALSE);
88 USE(obj, cairo_fill, EINA_FALSE);
89 USE(obj, cairo_pattern_destroy, EINA_FALSE);
90 USE(obj, cairo_set_source, EINA_FALSE);
91
92 cairo_rectangle(pd->parent->cairo, gld->start.x, gld->start.y, 84 cairo_rectangle(pd->parent->cairo, gld->start.x, gld->start.y,
93 gld->end.x - gld->start.x, 85 gld->end.x - gld->start.x,
94 gld->end.y - gld->start.y); 86 gld->end.y - gld->start.y);
@@ -115,9 +107,6 @@ _ector_renderer_cairo_gradient_linear_ector_renderer_cairo_base_fill(Eo *obj,
115 pat = _ector_renderer_cairo_gradient_linear_prepare(obj, gld, gd, mul_col); 107 pat = _ector_renderer_cairo_gradient_linear_prepare(obj, gld, gd, mul_col);
116 if (!pat) return EINA_FALSE; 108 if (!pat) return EINA_FALSE;
117 109
118 USE(obj, cairo_set_source, EINA_FALSE);
119 USE(obj, cairo_pattern_destroy, EINA_FALSE);
120
121 cairo_set_source(pd->parent->cairo, pat); 110 cairo_set_source(pd->parent->cairo, pat);
122 cairo_pattern_destroy(pat); 111 cairo_pattern_destroy(pat);
123 112
@@ -141,7 +130,24 @@ _ector_renderer_cairo_gradient_linear_ector_renderer_generic_base_bounds_get(Eo
141 gld->end.y - gld->start.x); 130 gld->end.y - gld->start.x);
142} 131}
143 132
144void 133static Eo_Base *
134_ector_renderer_cairo_gradient_linear_eo_base_constructor(Eo *obj,
135 Ector_Renderer_Cairo_Gradient_Linear_Data *pd EINA_UNUSED)
136{
137 USE(obj, cairo_set_source, NULL);
138 USE(obj, cairo_pattern_destroy, NULL);
139 USE(obj, cairo_rectangle, NULL);
140 USE(obj, cairo_fill, NULL);
141 USE(obj, cairo_pattern_destroy, NULL);
142 USE(obj, cairo_set_source, NULL);
143 USE(obj, cairo_pattern_set_extend, NULL);
144 USE(obj, cairo_pattern_create_linear, NULL);
145
146 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS, obj = eo_constructor());
147 return obj;
148}
149
150static void
145_ector_renderer_cairo_gradient_linear_eo_base_destructor(Eo *obj, 151_ector_renderer_cairo_gradient_linear_eo_base_destructor(Eo *obj,
146 Ector_Renderer_Cairo_Gradient_Linear_Data *pd) 152 Ector_Renderer_Cairo_Gradient_Linear_Data *pd)
147{ 153{
@@ -153,7 +159,7 @@ _ector_renderer_cairo_gradient_linear_eo_base_destructor(Eo *obj,
153 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS, eo_destructor()); 159 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS, eo_destructor());
154} 160}
155 161
156void 162static void
157_ector_renderer_cairo_gradient_linear_efl_gfx_gradient_base_stop_set(Eo *obj, 163_ector_renderer_cairo_gradient_linear_efl_gfx_gradient_base_stop_set(Eo *obj,
158 Ector_Renderer_Cairo_Gradient_Linear_Data *pd EINA_UNUSED, 164 Ector_Renderer_Cairo_Gradient_Linear_Data *pd EINA_UNUSED,
159 const Efl_Gfx_Gradient_Stop *colors, 165 const Efl_Gfx_Gradient_Stop *colors,
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.eo b/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.eo
index 2085f697f1..308cc295a1 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.eo
+++ b/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.eo
@@ -8,6 +8,7 @@ class Ector.Renderer.Cairo.Gradient_Linear (Ector.Renderer.Cairo.Base, Ector.Ren
8 Ector.Renderer.Generic.Base.bounds_get; 8 Ector.Renderer.Generic.Base.bounds_get;
9 Ector.Renderer.Generic.Base.crc.get; 9 Ector.Renderer.Generic.Base.crc.get;
10 Ector.Renderer.Cairo.Base.fill; 10 Ector.Renderer.Cairo.Base.fill;
11 Eo.Base.constructor;
11 Eo.Base.destructor; 12 Eo.Base.destructor;
12 Efl.Gfx.Gradient.Base.stop.set; 13 Efl.Gfx.Gradient.Base.stop.set;
13 } 14 }
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.c b/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.c
index 4f8754f79e..bd89e15a6e 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.c
+++ b/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.c
@@ -56,15 +56,12 @@ _ector_renderer_cairo_gradient_radial_prepare(Eo *obj,
56{ 56{
57 cairo_pattern_t *pat; 57 cairo_pattern_t *pat;
58 58
59 USE(obj, cairo_pattern_create_radial, NULL);
60
61 pat = cairo_pattern_create_radial(grd->focal.x, grd->focal.y, 0, 59 pat = cairo_pattern_create_radial(grd->focal.x, grd->focal.y, 0,
62 grd->radial.x, grd->radial.y, grd->radius); 60 grd->radial.x, grd->radial.y, grd->radius);
63 if (!pat) return NULL; 61 if (!pat) return NULL;
64 62
65 _ector_renderer_cairo_gradient_prepare(obj, pat, gd, mul_col); 63 _ector_renderer_cairo_gradient_prepare(obj, pat, gd, mul_col);
66 64
67 USE(obj, cairo_pattern_set_extend, NULL);
68 cairo_pattern_set_extend(pat, _ector_cairo_extent_get(gd->s)); 65 cairo_pattern_set_extend(pat, _ector_cairo_extent_get(gd->s));
69 66
70 return pat; 67 return pat;
@@ -88,11 +85,6 @@ _ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_draw(Eo *obj,
88 85
89 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS, ector_renderer_draw(op, clips, mul_col)); 86 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS, ector_renderer_draw(op, clips, mul_col));
90 87
91 USE(obj, cairo_arc, EINA_FALSE);
92 USE(obj, cairo_fill, EINA_FALSE);
93 USE(obj, cairo_set_source, EINA_FALSE);
94 USE(obj, cairo_pattern_destroy, EINA_FALSE);
95
96 cairo_arc(pd->parent->cairo, 88 cairo_arc(pd->parent->cairo,
97 grd->radial.x, grd->radial.y, 89 grd->radial.x, grd->radial.y,
98 grd->radius, 90 grd->radius,
@@ -121,9 +113,6 @@ _ector_renderer_cairo_gradient_radial_ector_renderer_cairo_base_fill(Eo *obj,
121 pat = _ector_renderer_cairo_gradient_radial_prepare(obj, grd, gd, mul_col); 113 pat = _ector_renderer_cairo_gradient_radial_prepare(obj, grd, gd, mul_col);
122 if (!pat) return EINA_FALSE; 114 if (!pat) return EINA_FALSE;
123 115
124 USE(obj, cairo_set_source, EINA_FALSE);
125 USE(obj, cairo_pattern_destroy, EINA_FALSE);
126
127 cairo_set_source(pd->parent->cairo, pat); 116 cairo_set_source(pd->parent->cairo, pat);
128 cairo_pattern_destroy(pat); 117 cairo_pattern_destroy(pat);
129 118
@@ -146,7 +135,24 @@ _ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_bounds_get(Eo
146 gld->radius * 2, gld->radius * 2); 135 gld->radius * 2, gld->radius * 2);
147} 136}
148 137
149void 138static Eo_Base *
139_ector_renderer_cairo_gradient_radial_eo_base_constructor(Eo *obj,
140 Ector_Renderer_Cairo_Gradient_Radial_Data *pd EINA_UNUSED)
141{
142 USE(obj, cairo_set_source, NULL);
143 USE(obj, cairo_pattern_destroy, NULL);
144 USE(obj, cairo_arc, NULL);
145 USE(obj, cairo_fill, NULL);
146 USE(obj, cairo_set_source, NULL);
147 USE(obj, cairo_pattern_destroy, NULL);
148 USE(obj, cairo_pattern_set_extend, NULL);
149 USE(obj, cairo_pattern_create_radial, NULL);
150
151 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS, obj = eo_constructor());
152 return obj;
153}
154
155static void
150_ector_renderer_cairo_gradient_radial_eo_base_destructor(Eo *obj, 156_ector_renderer_cairo_gradient_radial_eo_base_destructor(Eo *obj,
151 Ector_Renderer_Cairo_Gradient_Radial_Data *pd) 157 Ector_Renderer_Cairo_Gradient_Radial_Data *pd)
152{ 158{
@@ -158,7 +164,7 @@ _ector_renderer_cairo_gradient_radial_eo_base_destructor(Eo *obj,
158 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS, eo_destructor()); 164 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS, eo_destructor());
159} 165}
160 166
161void 167static void
162_ector_renderer_cairo_gradient_radial_efl_gfx_gradient_base_stop_set(Eo *obj, 168_ector_renderer_cairo_gradient_radial_efl_gfx_gradient_base_stop_set(Eo *obj,
163 Ector_Renderer_Cairo_Gradient_Radial_Data *pd EINA_UNUSED, 169 Ector_Renderer_Cairo_Gradient_Radial_Data *pd EINA_UNUSED,
164 const Efl_Gfx_Gradient_Stop *colors, 170 const Efl_Gfx_Gradient_Stop *colors,
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.eo b/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.eo
index 0b3ae92d9f..b38ed03230 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.eo
+++ b/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.eo
@@ -9,6 +9,7 @@ class Ector.Renderer.Cairo.Gradient_Radial (Ector.Renderer.Cairo.Base, Ector.Ren
9 Ector.Renderer.Generic.Base.crc.get; 9 Ector.Renderer.Generic.Base.crc.get;
10 Ector.Renderer.Cairo.Base.fill; 10 Ector.Renderer.Cairo.Base.fill;
11 Eo.Base.destructor; 11 Eo.Base.destructor;
12 Eo.Base.constructor;
12 Efl.Gfx.Gradient.Base.stop.set; 13 Efl.Gfx.Gradient.Base.stop.set;
13 } 14 }
14} 15}
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_shape.c b/src/lib/ector/cairo/ector_renderer_cairo_shape.c
index edee785558..2c7a93e663 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_shape.c
+++ b/src/lib/ector/cairo/ector_renderer_cairo_shape.c
@@ -71,8 +71,6 @@ _ector_renderer_cairo_shape_path_changed(void *data, Eo *obj, const Eo_Event_Des
71{ 71{
72 Ector_Renderer_Cairo_Shape_Data *pd = data; 72 Ector_Renderer_Cairo_Shape_Data *pd = data;
73 73
74 USE(obj, cairo_path_destroy, EINA_TRUE);
75
76 if (pd->path) cairo_path_destroy(pd->path); 74 if (pd->path) cairo_path_destroy(pd->path);
77 pd->path = NULL; 75 pd->path = NULL;
78 76
@@ -108,8 +106,6 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_prepare(Eo *obj, Ector_R
108 eo_do(obj, efl_gfx_shape_path_get(&cmds, &pts)); 106 eo_do(obj, efl_gfx_shape_path_get(&cmds, &pts));
109 if (!pd->path && cmds) 107 if (!pd->path && cmds)
110 { 108 {
111 USE(obj, cairo_new_path, EINA_FALSE);
112
113 cairo_new_path(pd->parent->cairo); 109 cairo_new_path(pd->parent->cairo);
114 110
115 for (; *cmds != EFL_GFX_PATH_COMMAND_TYPE_END; cmds++) 111 for (; *cmds != EFL_GFX_PATH_COMMAND_TYPE_END; cmds++)
@@ -117,22 +113,16 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_prepare(Eo *obj, Ector_R
117 switch (*cmds) 113 switch (*cmds)
118 { 114 {
119 case EFL_GFX_PATH_COMMAND_TYPE_MOVE_TO: 115 case EFL_GFX_PATH_COMMAND_TYPE_MOVE_TO:
120 USE(obj, cairo_move_to, EINA_FALSE);
121
122 cairo_move_to(pd->parent->cairo, pts[0], pts[1]); 116 cairo_move_to(pd->parent->cairo, pts[0], pts[1]);
123 117
124 pts += 2; 118 pts += 2;
125 break; 119 break;
126 case EFL_GFX_PATH_COMMAND_TYPE_LINE_TO: 120 case EFL_GFX_PATH_COMMAND_TYPE_LINE_TO:
127 USE(obj, cairo_line_to, EINA_FALSE);
128
129 cairo_line_to(pd->parent->cairo, pts[0], pts[1]); 121 cairo_line_to(pd->parent->cairo, pts[0], pts[1]);
130 122
131 pts += 2; 123 pts += 2;
132 break; 124 break;
133 case EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO: 125 case EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO:
134 USE(obj, cairo_curve_to, EINA_FALSE);
135
136 // Be careful, we do have a different order than 126 // Be careful, we do have a different order than
137 // cairo, first is destination point, followed by 127 // cairo, first is destination point, followed by
138 // the control point. The opposite of cairo. 128 // the control point. The opposite of cairo.
@@ -143,8 +133,6 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_prepare(Eo *obj, Ector_R
143 pts += 6; 133 pts += 6;
144 break; 134 break;
145 case EFL_GFX_PATH_COMMAND_TYPE_CLOSE: 135 case EFL_GFX_PATH_COMMAND_TYPE_CLOSE:
146 USE(obj, cairo_close_path, EINA_FALSE);
147
148 cairo_close_path(pd->parent->cairo); 136 cairo_close_path(pd->parent->cairo);
149 break; 137 break;
150 case EFL_GFX_PATH_COMMAND_TYPE_LAST: 138 case EFL_GFX_PATH_COMMAND_TYPE_LAST:
@@ -153,8 +141,6 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_prepare(Eo *obj, Ector_R
153 } 141 }
154 } 142 }
155 143
156 USE(obj, cairo_copy_path, EINA_FALSE);
157
158 pd->path = cairo_copy_path(pd->parent->cairo); 144 pd->path = cairo_copy_path(pd->parent->cairo);
159 } 145 }
160 146
@@ -169,14 +155,10 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_draw(Eo *obj, Ector_Rend
169 155
170 if (pd->path == NULL) return EINA_FALSE; 156 if (pd->path == NULL) return EINA_FALSE;
171 157
172 USE(obj, cairo_save, EINA_FALSE);
173 cairo_save(pd->parent->cairo); 158 cairo_save(pd->parent->cairo);
174 159
175 eo_do_super(obj, ECTOR_RENDERER_CAIRO_SHAPE_CLASS, ector_renderer_draw(op, clips, mul_col)); 160 eo_do_super(obj, ECTOR_RENDERER_CAIRO_SHAPE_CLASS, ector_renderer_draw(op, clips, mul_col));
176 161
177 USE(obj, cairo_new_path, EINA_FALSE);
178 USE(obj, cairo_append_path, EINA_FALSE);
179
180 cairo_new_path(pd->parent->cairo); 162 cairo_new_path(pd->parent->cairo);
181 cairo_append_path(pd->parent->cairo, pd->path); 163 cairo_append_path(pd->parent->cairo, pd->path);
182 164
@@ -185,13 +167,6 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_draw(Eo *obj, Ector_Rend
185 167
186 if (pd->shape->stroke.fill || pd->shape->stroke.color.a > 0) 168 if (pd->shape->stroke.fill || pd->shape->stroke.color.a > 0)
187 { 169 {
188 USE(obj, cairo_fill_preserve, EINA_FALSE);
189 USE(obj, cairo_set_source_rgba, EINA_FALSE);
190 USE(obj, cairo_stroke, EINA_FALSE);
191 USE(obj, cairo_set_line_width, EINA_FALSE);
192 USE(obj, cairo_set_line_cap, EINA_FALSE);
193 USE(obj, cairo_set_line_join, EINA_FALSE);
194
195 cairo_fill_preserve(pd->parent->cairo); 170 cairo_fill_preserve(pd->parent->cairo);
196 171
197 if (pd->shape->stroke.fill) 172 if (pd->shape->stroke.fill)
@@ -208,8 +183,6 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_draw(Eo *obj, Ector_Rend
208 { 183 {
209 double *dashinfo; 184 double *dashinfo;
210 185
211 USE(obj, cairo_set_dash, EINA_FALSE);
212
213 dashinfo = (double *) malloc(2 * pd->shape->stroke.dash_length * sizeof(double)); 186 dashinfo = (double *) malloc(2 * pd->shape->stroke.dash_length * sizeof(double));
214 for (i = 0; i < pd->shape->stroke.dash_length; i++) 187 for (i = 0; i < pd->shape->stroke.dash_length; i++)
215 { 188 {
@@ -229,11 +202,9 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_draw(Eo *obj, Ector_Rend
229 } 202 }
230 else 203 else
231 { 204 {
232 USE(obj, cairo_fill, EINA_FALSE);
233 cairo_fill(pd->parent->cairo); 205 cairo_fill(pd->parent->cairo);
234 } 206 }
235 207
236 USE(obj, cairo_restore, EINA_FALSE);
237 cairo_restore(pd->parent->cairo); 208 cairo_restore(pd->parent->cairo);
238 return EINA_TRUE; 209 return EINA_TRUE;
239} 210}
@@ -267,7 +238,30 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_bounds_get(Eo *obj,
267Eo * 238Eo *
268_ector_renderer_cairo_shape_eo_base_constructor(Eo *obj, Ector_Renderer_Cairo_Shape_Data *pd) 239_ector_renderer_cairo_shape_eo_base_constructor(Eo *obj, Ector_Renderer_Cairo_Shape_Data *pd)
269{ 240{
270 obj = eo_do_super_ret(obj, ECTOR_RENDERER_CAIRO_SHAPE_CLASS, obj, eo_constructor()); 241 USE(obj, cairo_path_destroy, NULL);
242 USE(obj, cairo_restore, NULL);
243 USE(obj, cairo_fill, NULL);
244 USE(obj, cairo_set_dash, NULL);
245 USE(obj, cairo_fill_preserve, NULL);
246 USE(obj, cairo_set_source_rgba, NULL);
247 USE(obj, cairo_stroke, NULL);
248 USE(obj, cairo_set_line_width, NULL);
249 USE(obj, cairo_set_line_cap, NULL);
250 USE(obj, cairo_set_line_join, NULL);
251 USE(obj, cairo_new_path, NULL);
252 USE(obj, cairo_append_path, NULL);
253 USE(obj, cairo_save, NULL);
254 USE(obj, cairo_copy_path, NULL);
255 USE(obj, cairo_close_path, NULL);
256 USE(obj, cairo_curve_to, NULL);
257 USE(obj, cairo_line_to, NULL);
258 USE(obj, cairo_new_path, NULL);
259 USE(obj, cairo_path_destroy, NULL);
260 USE(obj, cairo_move_to, NULL);
261
262 obj = eo_do_super_ret(obj, ECTOR_RENDERER_CAIRO_SHAPE_CLASS, obj, obj = eo_constructor());
263 if (!obj) return NULL;
264
271 pd->shape = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_SHAPE_MIXIN, obj); 265 pd->shape = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_SHAPE_MIXIN, obj);
272 pd->base = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS, obj); 266 pd->base = eo_data_xref(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS, obj);
273 267
@@ -293,7 +287,6 @@ _ector_renderer_cairo_shape_eo_base_destructor(Eo *obj, Ector_Renderer_Cairo_Sha
293 287
294 eo_do_super(obj, ECTOR_RENDERER_CAIRO_SHAPE_CLASS, eo_destructor()); 288 eo_do_super(obj, ECTOR_RENDERER_CAIRO_SHAPE_CLASS, eo_destructor());
295 289
296 USE(obj, cairo_path_destroy, );
297 if (pd->path) cairo_path_destroy(pd->path); 290 if (pd->path) cairo_path_destroy(pd->path);
298} 291}
299 292