summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/ector/cairo/ector_cairo_private.h26
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_base.c4
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_base.eo3
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.c97
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.c112
-rw-r--r--src/lib/ector/cairo/ector_renderer_cairo_shape.c7
-rw-r--r--src/lib/ector/software/ector_drawhelper_private.h2
7 files changed, 144 insertions, 107 deletions
diff --git a/src/lib/ector/cairo/ector_cairo_private.h b/src/lib/ector/cairo/ector_cairo_private.h
index b5782ff..5a27708 100644
--- a/src/lib/ector/cairo/ector_cairo_private.h
+++ b/src/lib/ector/cairo/ector_cairo_private.h
@@ -72,4 +72,30 @@ _ector_cairo_symbol_get(Eo *obj, const char *name)
72 return sym; 72 return sym;
73} 73}
74 74
75extern void (*cairo_pattern_add_color_stop_rgba)(cairo_pattern_t *pattern, double offset,
76 double red, double green, double blue, double alpha);
77
78static inline void
79_ector_renderer_cairo_gradient_prepare(Eo *obj,
80 cairo_pattern_t *pat,
81 Ector_Renderer_Generic_Gradient_Data *src,
82 unsigned int mul_col)
83{
84 unsigned int i;
85
86 USE(obj, cairo_pattern_add_color_stop_rgba, );
87
88 for (i = 0; i < src->colors_count; i++)
89 {
90 int r,g,b,a;
91
92 r = ((src->colors[i].r * R_VAL(&mul_col)) >> 8);
93 g = ((src->colors[i].g * G_VAL(&mul_col)) >> 8);
94 b = ((src->colors[i].b * B_VAL(&mul_col)) >> 8);
95 a = ((src->colors[i].a * A_VAL(&mul_col)) >> 8);
96 ector_color_argb_unpremul(a, &r, &g, &b);
97 cairo_pattern_add_color_stop_rgba(pat, src->colors[i].offset, r/255.0, g/255.0, b/255.0, a/255.0);
98 }
99}
100
75#endif 101#endif
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_base.c b/src/lib/ector/cairo/ector_renderer_cairo_base.c
index 4f25b9e..420ce1f 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_base.c
+++ b/src/lib/ector/cairo/ector_renderer_cairo_base.c
@@ -65,6 +65,10 @@ static void (*cairo_rectangle)(cairo_t *cr, double x, double y, double width, do
65static void (*cairo_clip)(cairo_t *cr) = NULL; 65static void (*cairo_clip)(cairo_t *cr) = NULL;
66static void (*cairo_device_to_user)(cairo_t *cr, double *x, double *y) = NULL; 66static void (*cairo_device_to_user)(cairo_t *cr, double *x, double *y) = NULL;
67 67
68// This one is used by both gradient, so sharing it here.
69void (*cairo_pattern_add_color_stop_rgba)(cairo_pattern_t *pattern, double offset,
70 double red, double green, double blue, double alpha) = NULL;
71
68static cairo_matrix_t identity; 72static cairo_matrix_t identity;
69 73
70// Cairo need unpremul color, so force unpremul here 74// Cairo need unpremul color, so force unpremul here
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_base.eo b/src/lib/ector/cairo/ector_renderer_cairo_base.eo
index c34b9a8..43efa72 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_base.eo
+++ b/src/lib/ector/cairo/ector_renderer_cairo_base.eo
@@ -4,6 +4,9 @@ abstract Ector.Renderer.Cairo.Base (Ector.Renderer.Generic.Base)
4 methods { 4 methods {
5 fill { 5 fill {
6 return: bool; 6 return: bool;
7 params {
8 @in mul_col: uint;
9 }
7 } 10 }
8 } 11 }
9 implements { 12 implements {
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 15b4e42..2eece58 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.c
+++ b/src/lib/ector/cairo/ector_renderer_cairo_gradient_linear.c
@@ -16,8 +16,6 @@ static void (*cairo_fill)(cairo_t *cr) = NULL;
16static void (*cairo_rectangle)(cairo_t *cr, 16static void (*cairo_rectangle)(cairo_t *cr,
17 double x, double y, 17 double x, double y,
18 double width, double height) = NULL; 18 double width, double height) = NULL;
19static void (*cairo_pattern_add_color_stop_rgba)(cairo_pattern_t *pattern, double offset,
20 double red, double green, double blue, double alpha) = NULL;
21static void (*cairo_pattern_destroy)(cairo_pattern_t *pattern) = NULL; 19static void (*cairo_pattern_destroy)(cairo_pattern_t *pattern) = NULL;
22 20
23static void (*cairo_pattern_set_extend)(cairo_pattern_t *pattern, cairo_extend_t extend) = NULL; 21static void (*cairo_pattern_set_extend)(cairo_pattern_t *pattern, cairo_extend_t extend) = NULL;
@@ -26,43 +24,34 @@ typedef struct _Ector_Renderer_Cairo_Gradient_Linear_Data Ector_Renderer_Cairo_G
26struct _Ector_Renderer_Cairo_Gradient_Linear_Data 24struct _Ector_Renderer_Cairo_Gradient_Linear_Data
27{ 25{
28 Ector_Cairo_Surface_Data *parent; 26 Ector_Cairo_Surface_Data *parent;
29 cairo_pattern_t *pat;
30}; 27};
31 28
32static Eina_Bool 29static cairo_pattern_t *
33_ector_renderer_cairo_gradient_linear_ector_renderer_generic_base_prepare(Eo *obj, 30_ector_renderer_cairo_gradient_linear_prepare(Eo *obj,
34 Ector_Renderer_Cairo_Gradient_Linear_Data *pd) 31 Ector_Renderer_Generic_Gradient_Linear_Data *gld,
32 Ector_Renderer_Generic_Gradient_Data *gd,
33 unsigned int mul_col)
35{ 34{
36 Ector_Renderer_Generic_Gradient_Linear_Data *gld; 35 cairo_pattern_t *pat;
37 Ector_Renderer_Generic_Gradient_Data *gd;
38 unsigned int i;
39
40 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS, ector_renderer_prepare());
41
42 if (pd->pat) return EINA_FALSE;
43
44 gld = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_LINEAR_MIXIN);
45 gd = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_MIXIN);
46 if (!gld || !gd) return EINA_FALSE;
47 36
48 USE(obj, cairo_pattern_create_linear, EINA_FALSE); 37 USE(obj, cairo_pattern_create_linear, EINA_FALSE);
49 USE(obj, cairo_pattern_add_color_stop_rgba, EINA_FALSE);
50 38
51 pd->pat = cairo_pattern_create_linear(gld->start.x, gld->start.y, 39 pat = cairo_pattern_create_linear(gld->start.x, gld->start.y,
52 gld->end.x, gld->end.y); 40 gld->end.x, gld->end.y);
53 int r,g,b,a; 41 if (!pat) return NULL;
54 for (i = 0; i < gd->colors_count; i++) 42 _ector_renderer_cairo_gradient_prepare(obj, pat, gd, mul_col);
55 {
56 r = gd->colors[i].r;
57 g = gd->colors[i].g;
58 b = gd->colors[i].b;
59 a = gd->colors[i].a;
60 ector_color_argb_unpremul(a, &r, &g, &b);
61 cairo_pattern_add_color_stop_rgba(pd->pat, gd->colors[i].offset, r/255.0, g/255.0, b/255.0, a/255.0);
62 }
63 43
64 USE(obj, cairo_pattern_set_extend, EINA_FALSE); 44 USE(obj, cairo_pattern_set_extend, EINA_FALSE);
65 cairo_pattern_set_extend(pd->pat, _ector_cairo_extent_get(gd->s)); 45 cairo_pattern_set_extend(pat, _ector_cairo_extent_get(gd->s));
46
47 return pat;
48}
49
50static Eina_Bool
51_ector_renderer_cairo_gradient_linear_ector_renderer_generic_base_prepare(Eo *obj,
52 Ector_Renderer_Cairo_Gradient_Linear_Data *pd)
53{
54 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS, ector_renderer_prepare());
66 55
67 if (!pd->parent) 56 if (!pd->parent)
68 { 57 {
@@ -81,37 +70,56 @@ _ector_renderer_cairo_gradient_linear_ector_renderer_generic_base_draw(Eo *obj,
81 Ector_Renderer_Cairo_Gradient_Linear_Data *pd, 70 Ector_Renderer_Cairo_Gradient_Linear_Data *pd,
82 Ector_Rop op, Eina_Array *clips, unsigned int mul_col) 71 Ector_Rop op, Eina_Array *clips, unsigned int mul_col)
83{ 72{
84 if (pd->pat) return EINA_FALSE;
85
86 Ector_Renderer_Generic_Gradient_Linear_Data *gld; 73 Ector_Renderer_Generic_Gradient_Linear_Data *gld;
74 Ector_Renderer_Generic_Gradient_Data *gd;
75 cairo_pattern_t *pat;
87 76
88 // FIXME: don't ignore clipping ! 77 // FIXME: don't ignore clipping !
89 gld = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_LINEAR_MIXIN); 78 gld = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_LINEAR_MIXIN);
90 if (!pd->pat || !gld) return EINA_FALSE; 79 gd = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_MIXIN);
80 if (!gd || !gld) return EINA_FALSE;
81
82 pat = _ector_renderer_cairo_gradient_linear_prepare(obj, gld, gd, mul_col);
83 if (!pat) return EINA_FALSE;
91 84
92 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS, ector_renderer_draw(op, clips, mul_col)); 85 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS, ector_renderer_draw(op, clips, mul_col));
93 86
94 USE(obj, cairo_rectangle, EINA_FALSE); 87 USE(obj, cairo_rectangle, EINA_FALSE);
95 USE(obj, cairo_fill, 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);
96 91
97 cairo_rectangle(pd->parent->cairo, gld->start.x, gld->start.y, 92 cairo_rectangle(pd->parent->cairo, gld->start.x, gld->start.y,
98 gld->end.x - gld->start.x, 93 gld->end.x - gld->start.x,
99 gld->end.y - gld->start.y); 94 gld->end.y - gld->start.y);
100 eo_do(obj, ector_renderer_cairo_base_fill()); 95 cairo_set_source(pd->parent->cairo, pat);
101 cairo_fill(pd->parent->cairo); 96 cairo_fill(pd->parent->cairo);
97 cairo_pattern_destroy(pat);
102 98
103 return EINA_TRUE; 99 return EINA_TRUE;
104} 100}
105 101
106static Eina_Bool 102static Eina_Bool
107_ector_renderer_cairo_gradient_linear_ector_renderer_cairo_base_fill(Eo *obj, 103_ector_renderer_cairo_gradient_linear_ector_renderer_cairo_base_fill(Eo *obj,
108 Ector_Renderer_Cairo_Gradient_Linear_Data *pd) 104 Ector_Renderer_Cairo_Gradient_Linear_Data *pd,
105 unsigned int mul_col)
109{ 106{
110 if (!pd->pat) return EINA_FALSE; 107 Ector_Renderer_Generic_Gradient_Linear_Data *gld;
108 Ector_Renderer_Generic_Gradient_Data *gd;
109 cairo_pattern_t *pat;
110
111 gld = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_LINEAR_MIXIN);
112 gd = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_MIXIN);
113 if (!gd || !gld) return EINA_FALSE;
114
115 pat = _ector_renderer_cairo_gradient_linear_prepare(obj, gld, gd, mul_col);
116 if (!pat) return EINA_FALSE;
111 117
112 USE(obj, cairo_set_source, EINA_FALSE); 118 USE(obj, cairo_set_source, EINA_FALSE);
119 USE(obj, cairo_pattern_destroy, EINA_FALSE);
113 120
114 cairo_set_source(pd->parent->cairo, pd->pat); 121 cairo_set_source(pd->parent->cairo, pat);
122 cairo_pattern_destroy(pat);
115 123
116 return EINA_TRUE; 124 return EINA_TRUE;
117} 125}
@@ -139,11 +147,6 @@ _ector_renderer_cairo_gradient_linear_eo_base_destructor(Eo *obj,
139{ 147{
140 Eo *parent; 148 Eo *parent;
141 149
142 USE(obj, cairo_pattern_destroy, );
143
144 if (pd->pat) cairo_pattern_destroy(pd->pat);
145 pd->pat = NULL;
146
147 eo_do(obj, parent = eo_parent_get()); 150 eo_do(obj, parent = eo_parent_get());
148 eo_data_xunref(parent, pd->parent, obj); 151 eo_data_xunref(parent, pd->parent, obj);
149 152
@@ -151,13 +154,11 @@ _ector_renderer_cairo_gradient_linear_eo_base_destructor(Eo *obj,
151} 154}
152 155
153void 156void
154_ector_renderer_cairo_gradient_linear_efl_gfx_gradient_base_stop_set(Eo *obj, Ector_Renderer_Cairo_Gradient_Linear_Data *pd, const Efl_Gfx_Gradient_Stop *colors, unsigned int length) 157_ector_renderer_cairo_gradient_linear_efl_gfx_gradient_base_stop_set(Eo *obj,
158 Ector_Renderer_Cairo_Gradient_Linear_Data *pd EINA_UNUSED,
159 const Efl_Gfx_Gradient_Stop *colors,
160 unsigned int length)
155{ 161{
156 USE(obj, cairo_pattern_destroy, );
157
158 if (pd->pat) cairo_pattern_destroy(pd->pat);
159 pd->pat = NULL;
160
161 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS, 162 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS,
162 efl_gfx_gradient_stop_set(colors, length)); 163 efl_gfx_gradient_stop_set(colors, length));
163} 164}
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 34a6d70..508632b 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.c
+++ b/src/lib/ector/cairo/ector_renderer_cairo_gradient_radial.c
@@ -19,8 +19,6 @@ static void (*cairo_arc)(cairo_t *cr,
19 double xc, double yc, 19 double xc, double yc,
20 double radius, 20 double radius,
21 double angle1, double angle2) = NULL; 21 double angle1, double angle2) = NULL;
22static void (*cairo_pattern_add_color_stop_rgba)(cairo_pattern_t *pattern, double offset,
23 double red, double green, double blue, double alpha) = NULL;
24static void (*cairo_pattern_destroy)(cairo_pattern_t *pattern) = NULL; 22static void (*cairo_pattern_destroy)(cairo_pattern_t *pattern) = NULL;
25 23
26static void (*cairo_pattern_set_extend)(cairo_pattern_t *pattern, cairo_extend_t extend) = NULL; 24static void (*cairo_pattern_set_extend)(cairo_pattern_t *pattern, cairo_extend_t extend) = NULL;
@@ -31,44 +29,13 @@ typedef struct _Ector_Renderer_Cairo_Gradient_Radial_Data Ector_Renderer_Cairo_G
31struct _Ector_Renderer_Cairo_Gradient_Radial_Data 29struct _Ector_Renderer_Cairo_Gradient_Radial_Data
32{ 30{
33 Ector_Cairo_Surface_Data *parent; 31 Ector_Cairo_Surface_Data *parent;
34 cairo_pattern_t *pat;
35}; 32};
36 33
37static Eina_Bool 34static Eina_Bool
38_ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_prepare(Eo *obj, Ector_Renderer_Cairo_Gradient_Radial_Data *pd) 35_ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_prepare(Eo *obj, Ector_Renderer_Cairo_Gradient_Radial_Data *pd)
39{ 36{
40 Ector_Renderer_Generic_Gradient_Radial_Data *grd;
41 Ector_Renderer_Generic_Gradient_Data *gd;
42 unsigned int i;
43
44 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS, ector_renderer_prepare()); 37 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS, ector_renderer_prepare());
45 38
46 if (pd->pat) return EINA_FALSE;
47
48 grd = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_RADIAL_MIXIN);
49 gd = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_MIXIN);
50 if (!grd || !gd) return EINA_FALSE;
51
52 USE(obj, cairo_pattern_create_radial, EINA_FALSE);
53 USE(obj, cairo_pattern_add_color_stop_rgba, EINA_FALSE);
54
55 pd->pat = cairo_pattern_create_radial(grd->focal.x, grd->focal.y, 0,
56 grd->radial.x, grd->radial.y, grd->radius);
57
58 int r,g,b,a;
59 for (i = 0; i < gd->colors_count; i++)
60 {
61 r = gd->colors[i].r;
62 g = gd->colors[i].g;
63 b = gd->colors[i].b;
64 a = gd->colors[i].a;
65 ector_color_argb_unpremul(a, &r, &g, &b);
66 cairo_pattern_add_color_stop_rgba(pd->pat, gd->colors[i].offset, r/255.0, g/255.0, b/255.0, a/255.0);
67 }
68
69 USE(obj, cairo_pattern_set_extend, EINA_FALSE);
70 cairo_pattern_set_extend(pd->pat, _ector_cairo_extent_get(gd->s));
71
72 if (!pd->parent) 39 if (!pd->parent)
73 { 40 {
74 Eo *parent; 41 Eo *parent;
@@ -81,42 +48,84 @@ _ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_prepare(Eo *ob
81 return EINA_FALSE; 48 return EINA_FALSE;
82} 49}
83 50
51static cairo_pattern_t *
52_ector_renderer_cairo_gradient_radial_prepare(Eo *obj,
53 Ector_Renderer_Generic_Gradient_Radial_Data *grd,
54 Ector_Renderer_Generic_Gradient_Data *gd,
55 unsigned int mul_col)
56{
57 cairo_pattern_t *pat;
58
59 USE(obj, cairo_pattern_create_radial, EINA_FALSE);
60
61 pat = cairo_pattern_create_radial(grd->focal.x, grd->focal.y, 0,
62 grd->radial.x, grd->radial.y, grd->radius);
63 if (!pat) return NULL;
64
65 _ector_renderer_cairo_gradient_prepare(obj, pat, gd, mul_col);
66
67 USE(obj, cairo_pattern_set_extend, EINA_FALSE);
68 cairo_pattern_set_extend(pat, _ector_cairo_extent_get(gd->s));
69
70 return pat;
71}
72
84// Clearly duplicated and should be in a common place... 73// Clearly duplicated and should be in a common place...
85static Eina_Bool 74static Eina_Bool
86_ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_draw(Eo *obj, Ector_Renderer_Cairo_Gradient_Radial_Data *pd, Ector_Rop op, Eina_Array *clips, unsigned int mul_col) 75_ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_draw(Eo *obj, Ector_Renderer_Cairo_Gradient_Radial_Data *pd, Ector_Rop op, Eina_Array *clips, unsigned int mul_col)
87{ 76{
88 if (pd->pat) return EINA_FALSE; 77 Ector_Renderer_Generic_Gradient_Radial_Data *grd;
78 Ector_Renderer_Generic_Gradient_Data *gd;
79 cairo_pattern_t *pat;
89 80
90 Ector_Renderer_Generic_Gradient_Radial_Data *gld; 81 // FIXME: Handle clipping and generally make it work :-)
82 grd = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_RADIAL_MIXIN);
83 gd = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_MIXIN);
84 if (!grd || !gd) return EINA_FALSE;
91 85
92 // FIXME: don't ignore clipping ! 86 pat = _ector_renderer_cairo_gradient_radial_prepare(obj, grd, gd, mul_col);
93 gld = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_RADIAL_MIXIN); 87 if (!pat) return EINA_FALSE;
94 if (!pd->pat || !gld) return EINA_FALSE;
95 88
96 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS, ector_renderer_draw(op, clips, mul_col)); 89 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS, ector_renderer_draw(op, clips, mul_col));
97 90
98 USE(obj, cairo_arc, EINA_FALSE); 91 USE(obj, cairo_arc, EINA_FALSE);
99 USE(obj, cairo_fill, 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);
100 95
101 cairo_arc(pd->parent->cairo, 96 cairo_arc(pd->parent->cairo,
102 gld->radial.x, gld->radial.y, 97 grd->radial.x, grd->radial.y,
103 gld->radius, 98 grd->radius,
104 0, 2 * M_PI); 99 0, 2 * M_PI);
105 eo_do(obj, ector_renderer_cairo_base_fill()); 100 cairo_set_source(pd->parent->cairo, pat);
106 cairo_fill(pd->parent->cairo); 101 cairo_fill(pd->parent->cairo);
102 cairo_pattern_destroy(pat);
107 103
108 return EINA_TRUE; 104 return EINA_TRUE;
109} 105}
110 106
111// Clearly duplicated and should be in a common place... 107// Clearly duplicated and should be in a common place...
112static Eina_Bool 108static Eina_Bool
113_ector_renderer_cairo_gradient_radial_ector_renderer_cairo_base_fill(Eo *obj, Ector_Renderer_Cairo_Gradient_Radial_Data *pd) 109_ector_renderer_cairo_gradient_radial_ector_renderer_cairo_base_fill(Eo *obj,
110 Ector_Renderer_Cairo_Gradient_Radial_Data *pd,
111 unsigned int mul_col)
114{ 112{
115 if (!pd->pat) return EINA_FALSE; 113 Ector_Renderer_Generic_Gradient_Radial_Data *grd;
114 Ector_Renderer_Generic_Gradient_Data *gd;
115 cairo_pattern_t *pat;
116
117 grd = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_RADIAL_MIXIN);
118 gd = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_MIXIN);
119 if (!grd || !gd) return EINA_FALSE;
120
121 pat = _ector_renderer_cairo_gradient_radial_prepare(obj, grd, gd, mul_col);
122 if (!pat) return EINA_FALSE;
116 123
117 USE(obj, cairo_set_source, EINA_FALSE); 124 USE(obj, cairo_set_source, EINA_FALSE);
125 USE(obj, cairo_pattern_destroy, EINA_FALSE);
118 126
119 cairo_set_source(pd->parent->cairo, pd->pat); 127 cairo_set_source(pd->parent->cairo, pat);
128 cairo_pattern_destroy(pat);
120 129
121 return EINA_TRUE; 130 return EINA_TRUE;
122} 131}
@@ -143,11 +152,6 @@ _ector_renderer_cairo_gradient_radial_eo_base_destructor(Eo *obj,
143{ 152{
144 Eo *parent; 153 Eo *parent;
145 154
146 USE(obj, cairo_pattern_destroy, );
147
148 if (pd->pat) cairo_pattern_destroy(pd->pat);
149 pd->pat = NULL;
150
151 eo_do(obj, parent = eo_parent_get()); 155 eo_do(obj, parent = eo_parent_get());
152 eo_data_xunref(parent, pd->parent, obj); 156 eo_data_xunref(parent, pd->parent, obj);
153 157
@@ -155,13 +159,11 @@ _ector_renderer_cairo_gradient_radial_eo_base_destructor(Eo *obj,
155} 159}
156 160
157void 161void
158_ector_renderer_cairo_gradient_radial_efl_gfx_gradient_base_stop_set(Eo *obj, Ector_Renderer_Cairo_Gradient_Radial_Data *pd, const Efl_Gfx_Gradient_Stop *colors, unsigned int length) 162_ector_renderer_cairo_gradient_radial_efl_gfx_gradient_base_stop_set(Eo *obj,
163 Ector_Renderer_Cairo_Gradient_Radial_Data *pd EINA_UNUSED,
164 const Efl_Gfx_Gradient_Stop *colors,
165 unsigned int length)
159{ 166{
160 USE(obj, cairo_pattern_destroy, );
161
162 if (pd->pat) cairo_pattern_destroy(pd->pat);
163 pd->pat = NULL;
164
165 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS, 167 eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS,
166 efl_gfx_gradient_stop_set(colors, length)); 168 efl_gfx_gradient_stop_set(colors, length));
167} 169}
diff --git a/src/lib/ector/cairo/ector_renderer_cairo_shape.c b/src/lib/ector/cairo/ector_renderer_cairo_shape.c
index c06802b..ac06da0 100644
--- a/src/lib/ector/cairo/ector_renderer_cairo_shape.c
+++ b/src/lib/ector/cairo/ector_renderer_cairo_shape.c
@@ -181,7 +181,7 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_draw(Eo *obj, Ector_Rend
181 cairo_append_path(pd->parent->cairo, pd->path); 181 cairo_append_path(pd->parent->cairo, pd->path);
182 182
183 if (pd->shape->fill) 183 if (pd->shape->fill)
184 eo_do(pd->shape->fill, ector_renderer_cairo_base_fill()); 184 eo_do(pd->shape->fill, ector_renderer_cairo_base_fill(mul_col));
185 185
186 if (pd->shape->stroke.fill || pd->shape->stroke.color.a > 0) 186 if (pd->shape->stroke.fill || pd->shape->stroke.color.a > 0)
187 { 187 {
@@ -195,7 +195,7 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_draw(Eo *obj, Ector_Rend
195 cairo_fill_preserve(pd->parent->cairo); 195 cairo_fill_preserve(pd->parent->cairo);
196 196
197 if (pd->shape->stroke.fill) 197 if (pd->shape->stroke.fill)
198 eo_do(pd->shape->stroke.fill, ector_renderer_cairo_base_fill()); 198 eo_do(pd->shape->stroke.fill, ector_renderer_cairo_base_fill(mul_col));
199 else 199 else
200 { 200 {
201 r = (((pd->shape->stroke.color.r * R_VAL(&mul_col)) + 0xff) >> 8); 201 r = (((pd->shape->stroke.color.r * R_VAL(&mul_col)) + 0xff) >> 8);
@@ -236,7 +236,8 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_draw(Eo *obj, Ector_Rend
236 236
237static Eina_Bool 237static Eina_Bool
238_ector_renderer_cairo_shape_ector_renderer_cairo_base_fill(Eo *obj EINA_UNUSED, 238_ector_renderer_cairo_shape_ector_renderer_cairo_base_fill(Eo *obj EINA_UNUSED,
239 Ector_Renderer_Cairo_Shape_Data *pd EINA_UNUSED) 239 Ector_Renderer_Cairo_Shape_Data *pd EINA_UNUSED,
240 unsigned int mul_col EINA_UNUSED)
240{ 241{
241 // FIXME: let's find out how to fill a shape with a shape later. 242 // FIXME: let's find out how to fill a shape with a shape later.
242 // I need to read SVG specification and see how to map that with cairo. 243 // I need to read SVG specification and see how to map that with cairo.
diff --git a/src/lib/ector/software/ector_drawhelper_private.h b/src/lib/ector/software/ector_drawhelper_private.h
index 007ef53..e446ed2 100644
--- a/src/lib/ector/software/ector_drawhelper_private.h
+++ b/src/lib/ector/software/ector_drawhelper_private.h
@@ -75,7 +75,7 @@ _ector_memfill(uint *dest, int length, uint value)
75 } 75 }
76} 76}
77 77
78static inline uint 78static inline uint
79INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) 79INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b)
80{ 80{
81 uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; 81 uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;