summaryrefslogtreecommitdiff
path: root/src/lib/ector/software
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2019-08-20 18:18:31 +0900
committerHermet Park <hermetpark@gmail.com>2019-08-20 18:23:41 +0900
commitdad166f84a02cfffc2a07bc804e7b7e35ed4a40d (patch)
treeb52d551fa4fdb4adda62059f59f0ada461246cb4 /src/lib/ector/software
parentead8a280570baded69686487a6dd27a8843fc95f (diff)
ector: code refactoring.
Current vector drawing requires several methods for compositing, it's shouldnt have only masking but other blending functions such as matte in lottie, porter&duff in android, etc. Previously we didn't specify this method name, just reserved the options and now we started to define the methods with ector_renderer_composite_method() instead of mask_set().
Diffstat (limited to 'src/lib/ector/software')
-rw-r--r--src/lib/ector/software/ector_renderer_software_image.c28
-rw-r--r--src/lib/ector/software/ector_renderer_software_image.eo2
-rw-r--r--src/lib/ector/software/ector_renderer_software_shape.c32
-rw-r--r--src/lib/ector/software/ector_renderer_software_shape.eo2
-rw-r--r--src/lib/ector/software/ector_software_private.h8
-rw-r--r--src/lib/ector/software/ector_software_rasterizer.c137
6 files changed, 97 insertions, 112 deletions
diff --git a/src/lib/ector/software/ector_renderer_software_image.c b/src/lib/ector/software/ector_renderer_software_image.c
index cb8d93ad6c..bc45c387f4 100644
--- a/src/lib/ector/software/ector_renderer_software_image.c
+++ b/src/lib/ector/software/ector_renderer_software_image.c
@@ -21,10 +21,10 @@ struct _Ector_Renderer_Software_Image_Data
21 Ector_Software_Surface_Data *surface; 21 Ector_Software_Surface_Data *surface;
22 Ector_Renderer_Image_Data *image; 22 Ector_Renderer_Image_Data *image;
23 Ector_Renderer_Data *base; 23 Ector_Renderer_Data *base;
24 Ector_Buffer *mask; 24 Ector_Buffer *comp;
25 int mask_op; 25 Ector_Renderer_Composite_Method comp_method;
26 int opacity; 26 int opacity;
27 Eina_Matrix3 inv_m; 27 Eina_Matrix3 inv_m;
28 struct { 28 struct {
29 int x1, y1, x2, y2; 29 int x1, y1, x2, y2;
30 } boundary; 30 } boundary;
@@ -101,7 +101,7 @@ _ector_renderer_software_image_ector_renderer_draw(Eo *obj EINA_UNUSED,
101 return EINA_TRUE; 101 return EINA_TRUE;
102 102
103 const int pix_stride = pd->surface->rasterizer->fill_data.raster_buffer->stride / 4; 103 const int pix_stride = pd->surface->rasterizer->fill_data.raster_buffer->stride / 4;
104 Ector_Software_Buffer_Base_Data *mask = pd->mask ? efl_data_scope_get(pd->mask, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN) : NULL; 104 Ector_Software_Buffer_Base_Data *comp = pd->comp ? efl_data_scope_get(pd->comp, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN) : NULL;
105 Ector_Software_Buffer_Base_Data *bpd = efl_data_scope_get(pd->image->buffer, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN); 105 Ector_Software_Buffer_Base_Data *bpd = efl_data_scope_get(pd->image->buffer, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN);
106 double im11, im12, im21, im22, im31, im32; 106 double im11, im12, im21, im22, im31, im32;
107 uint32_t *dst_buf, *src_buf; 107 uint32_t *dst_buf, *src_buf;
@@ -128,10 +128,10 @@ _ector_renderer_software_image_ector_renderer_draw(Eo *obj EINA_UNUSED,
128 continue; 128 continue;
129 uint32_t *src = src_buf + (rx + (ry * image_w)); //FIXME: use to stride 129 uint32_t *src = src_buf + (rx + (ry * image_w)); //FIXME: use to stride
130 uint32_t temp = 0x0; 130 uint32_t temp = 0x0;
131 if (mask) 131 if (comp)
132 { 132 {
133 uint32_t *m = mask->pixels.u32 + ((int)local_x + ((int)local_y * mask->generic->w)); 133 uint32_t *m = comp->pixels.u32 + ((int)local_x + ((int)local_y * comp->generic->w));
134 //FIXME : This masking can work only matte case. 134 //FIXME : This comping can work only matte case.
135 // We need consider to inverse matte case. 135 // We need consider to inverse matte case.
136 temp = draw_mul_256((((*m)>>24) * pd->opacity)>>8, *src); 136 temp = draw_mul_256((((*m)>>24) * pd->opacity)>>8, *src);
137 } 137 }
@@ -182,13 +182,13 @@ _ector_renderer_software_image_ector_renderer_crc_get(const Eo *obj,
182} 182}
183 183
184static void 184static void
185_ector_renderer_software_image_ector_renderer_mask_set(Eo *obj EINA_UNUSED, 185_ector_renderer_software_image_ector_renderer_comp_method_set(Eo *obj EINA_UNUSED,
186 Ector_Renderer_Software_Image_Data *pd, 186 Ector_Renderer_Software_Image_Data *pd,
187 Ector_Buffer *mask, 187 Ector_Buffer *comp,
188 int op) 188 Ector_Renderer_Composite_Method method)
189{ 189{
190 pd->mask = mask; 190 pd->comp = comp;
191 pd->mask_op = op; 191 pd->comp_method = method;
192} 192}
193 193
194#include "ector_renderer_software_image.eo.c" 194#include "ector_renderer_software_image.eo.c"
diff --git a/src/lib/ector/software/ector_renderer_software_image.eo b/src/lib/ector/software/ector_renderer_software_image.eo
index 8a3f9c51e7..477170242b 100644
--- a/src/lib/ector/software/ector_renderer_software_image.eo
+++ b/src/lib/ector/software/ector_renderer_software_image.eo
@@ -5,7 +5,7 @@ class @beta Ector.Renderer.Software.Image extends Ector.Renderer.Software implem
5 implements { 5 implements {
6 Ector.Renderer.prepare; 6 Ector.Renderer.prepare;
7 Ector.Renderer.draw; 7 Ector.Renderer.draw;
8 Ector.Renderer.mask { set; } 8 Ector.Renderer.comp_method { set; }
9 Ector.Renderer.crc { get; } 9 Ector.Renderer.crc { get; }
10 Efl.Object.constructor; 10 Efl.Object.constructor;
11 Efl.Object.destructor; 11 Efl.Object.destructor;
diff --git a/src/lib/ector/software/ector_renderer_software_shape.c b/src/lib/ector/software/ector_renderer_software_shape.c
index b9cf1faaed..00a95b85f2 100644
--- a/src/lib/ector/software/ector_renderer_software_shape.c
+++ b/src/lib/ector/software/ector_renderer_software_shape.c
@@ -38,8 +38,8 @@ struct _Ector_Renderer_Software_Shape_Data
38 Shape_Rle_Data *shape_data; 38 Shape_Rle_Data *shape_data;
39 Shape_Rle_Data *outline_data; 39 Shape_Rle_Data *outline_data;
40 40
41 Ector_Buffer *mask; 41 Ector_Buffer *comp;
42 int mask_op; 42 Ector_Renderer_Composite_Method comp_method;
43 43
44 Ector_Software_Shape_Task *task; 44 Ector_Software_Shape_Task *task;
45 45
@@ -674,8 +674,8 @@ _ector_renderer_software_shape_ector_renderer_draw(Eo *obj,
674 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer, 674 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer,
675 x, y, mul_col, op, 675 x, y, mul_col, op,
676 pd->shape_data, 676 pd->shape_data,
677 pd->mask, 677 pd->comp,
678 pd->mask_op); 678 pd->comp_method);
679 } 679 }
680 else 680 else
681 { 681 {
@@ -689,8 +689,8 @@ _ector_renderer_software_shape_ector_renderer_draw(Eo *obj,
689 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer, 689 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer,
690 x, y, mul_col, op, 690 x, y, mul_col, op,
691 pd->shape_data, 691 pd->shape_data,
692 pd->mask, 692 pd->comp,
693 pd->mask_op); 693 pd->comp_method);
694 } 694 }
695 } 695 }
696 696
@@ -702,8 +702,8 @@ _ector_renderer_software_shape_ector_renderer_draw(Eo *obj,
702 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer, 702 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer,
703 x, y, mul_col, op, 703 x, y, mul_col, op,
704 pd->outline_data, 704 pd->outline_data,
705 pd->mask, 705 pd->comp,
706 pd->mask_op); 706 pd->comp_method);
707 } 707 }
708 else 708 else
709 { 709 {
@@ -717,8 +717,8 @@ _ector_renderer_software_shape_ector_renderer_draw(Eo *obj,
717 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer, 717 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer,
718 x, y, mul_col, op, 718 x, y, mul_col, op,
719 pd->outline_data, 719 pd->outline_data,
720 pd->mask, 720 pd->comp,
721 pd->mask_op); 721 pd->comp_method);
722 } 722 }
723 } 723 }
724 724
@@ -828,14 +828,14 @@ _ector_renderer_software_shape_ector_renderer_crc_get(const Eo *obj,
828} 828}
829 829
830static void 830static void
831_ector_renderer_software_shape_ector_renderer_mask_set(Eo *obj EINA_UNUSED, 831_ector_renderer_software_shape_ector_renderer_comp_method_set(Eo *obj EINA_UNUSED,
832 Ector_Renderer_Software_Shape_Data *pd, 832 Ector_Renderer_Software_Shape_Data *pd,
833 Ector_Buffer *mask, 833 Ector_Buffer *comp,
834 int op) 834 Ector_Renderer_Composite_Method method)
835{ 835{
836 //Use ref/unref. 836 //Use ref/unref.
837 pd->mask = mask; 837 pd->comp = comp;
838 pd->mask_op = op; 838 pd->comp_method = method;
839} 839}
840 840
841#include "ector_renderer_software_shape.eo.c" 841#include "ector_renderer_software_shape.eo.c"
diff --git a/src/lib/ector/software/ector_renderer_software_shape.eo b/src/lib/ector/software/ector_renderer_software_shape.eo
index 4ea56f9260..83b87c0121 100644
--- a/src/lib/ector/software/ector_renderer_software_shape.eo
+++ b/src/lib/ector/software/ector_renderer_software_shape.eo
@@ -6,7 +6,7 @@ class @beta Ector.Renderer.Software.Shape extends Ector.Renderer.Software implem
6 Ector.Renderer.prepare; 6 Ector.Renderer.prepare;
7 Ector.Renderer.draw; 7 Ector.Renderer.draw;
8 Ector.Renderer.Software.op_fill; 8 Ector.Renderer.Software.op_fill;
9 Ector.Renderer.mask { set; } 9 Ector.Renderer.comp_method { set; }
10 Ector.Renderer.crc { get; } 10 Ector.Renderer.crc { get; }
11 Efl.Gfx.Path.commit; 11 Efl.Gfx.Path.commit;
12 Efl.Object.constructor; 12 Efl.Object.constructor;
diff --git a/src/lib/ector/software/ector_software_private.h b/src/lib/ector/software/ector_software_private.h
index 62d1c3f8fd..7ac63b5646 100644
--- a/src/lib/ector/software/ector_software_private.h
+++ b/src/lib/ector/software/ector_software_private.h
@@ -83,8 +83,8 @@ typedef struct _Span_Data
83 83
84 int offx, offy; 84 int offx, offy;
85 Clip_Data clip; 85 Clip_Data clip;
86 Ector_Software_Buffer_Base_Data *mask; 86 Ector_Software_Buffer_Base_Data *comp;
87 int mask_op; 87 Ector_Renderer_Composite_Method comp_method;
88 Eina_Matrix3 inv; 88 Eina_Matrix3 inv;
89 Span_Data_Type type; 89 Span_Data_Type type;
90 Eina_Bool fast_matrix; 90 Eina_Bool fast_matrix;
@@ -136,8 +136,8 @@ void ector_software_rasterizer_draw_rle_data(Software_Rasterizer *rasterizer,
136 int x, int y, uint32_t mul_col, 136 int x, int y, uint32_t mul_col,
137 Efl_Gfx_Render_Op op, 137 Efl_Gfx_Render_Op op,
138 Shape_Rle_Data* rle, 138 Shape_Rle_Data* rle,
139 Ector_Buffer *mask, 139 Ector_Buffer *comp,
140 int mask_op); 140 Ector_Renderer_Composite_Method comp_method);
141 141
142void ector_software_rasterizer_destroy_rle_data(Shape_Rle_Data *rle); 142void ector_software_rasterizer_destroy_rle_data(Shape_Rle_Data *rle);
143 143
diff --git a/src/lib/ector/software/ector_software_rasterizer.c b/src/lib/ector/software/ector_software_rasterizer.c
index 2b995c9e81..d4b67561fe 100644
--- a/src/lib/ector/software/ector_software_rasterizer.c
+++ b/src/lib/ector/software/ector_software_rasterizer.c
@@ -11,21 +11,6 @@
11 11
12#include "draw.h" 12#include "draw.h"
13 13
14//FIXME: This enum add temporarily to help understanding of additional code
15//related to masking in prepare_mask.
16//This needs to be formally declared through the eo class.
17typedef enum _EFL_CANVAS_VG_NODE_BLEND_TYPE
18{
19 EFL_CANVAS_VG_NODE_BLEND_TYPE_NONE = 0,
20 EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA,
21 EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA_INV,
22 EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_ADD,
23 EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_SUBSTRACT,
24 EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_INTERSECT,
25 EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_DIFFERENCE
26}EFL_CANVAS_VG_NODE_BLEND_TYPE;
27//
28
29static void 14static void
30_blend_argb(int count, const SW_FT_Span *spans, void *user_data) 15_blend_argb(int count, const SW_FT_Span *spans, void *user_data)
31{ 16{
@@ -49,12 +34,12 @@ _blend_argb(int count, const SW_FT_Span *spans, void *user_data)
49} 34}
50 35
51static void 36static void
52_blend_alpha(int count, const SW_FT_Span *spans, void *user_data) 37_comp_matte_alpha(int count, const SW_FT_Span *spans, void *user_data)
53{ 38{
54 Span_Data *sd = user_data; 39 Span_Data *sd = user_data;
55 const int pix_stride = sd->raster_buffer->stride / 4; 40 const int pix_stride = sd->raster_buffer->stride / 4;
56 Ector_Software_Buffer_Base_Data *mask = sd->mask; 41 Ector_Software_Buffer_Base_Data *comp = sd->comp;
57 if (!mask || !mask->pixels.u32) return; 42 if (!comp || !comp->pixels.u32) return;
58 43
59 // multiply the color with mul_col if any 44 // multiply the color with mul_col if any
60 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); 45 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
@@ -63,7 +48,7 @@ _blend_alpha(int count, const SW_FT_Span *spans, void *user_data)
63 // move to the offset location 48 // move to the offset location
64 uint32_t *buffer = 49 uint32_t *buffer =
65 sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx); 50 sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx);
66 uint32_t *mbuffer = mask->pixels.u32; 51 uint32_t *mbuffer = comp->pixels.u32;
67 52
68 //Temp buffer for intermediate processing 53 //Temp buffer for intermediate processing
69 int tsize = sd->raster_buffer->generic->w; 54 int tsize = sd->raster_buffer->generic->w;
@@ -73,12 +58,12 @@ _blend_alpha(int count, const SW_FT_Span *spans, void *user_data)
73 { 58 {
74 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x); 59 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x);
75 uint32_t *mtarget = 60 uint32_t *mtarget =
76 mbuffer + ((mask->generic->w * spans->y) + spans->x); 61 mbuffer + ((comp->generic->w * spans->y) + spans->x);
77 uint32_t *temp = tbuffer; 62 uint32_t *temp = tbuffer;
78 memset(temp, 0x00, sizeof(uint32_t) * spans->len); 63 memset(temp, 0x00, sizeof(uint32_t) * spans->len);
79 comp_func(temp, spans->len, color, spans->coverage); 64 comp_func(temp, spans->len, color, spans->coverage);
80 65
81 //masking 66 //composite
82 for (int i = 0; i < spans->len; i++) 67 for (int i = 0; i < spans->len; i++)
83 { 68 {
84 *temp = draw_mul_256(((*mtarget)>>24), *temp); 69 *temp = draw_mul_256(((*mtarget)>>24), *temp);
@@ -93,12 +78,12 @@ _blend_alpha(int count, const SW_FT_Span *spans, void *user_data)
93} 78}
94 79
95static void 80static void
96_blend_alpha_inv(int count, const SW_FT_Span *spans, void *user_data) 81_comp_matte_alpha_inv(int count, const SW_FT_Span *spans, void *user_data)
97{ 82{
98 Span_Data *sd = user_data; 83 Span_Data *sd = user_data;
99 const int pix_stride = sd->raster_buffer->stride / 4; 84 const int pix_stride = sd->raster_buffer->stride / 4;
100 Ector_Software_Buffer_Base_Data *mask = sd->mask; 85 Ector_Software_Buffer_Base_Data *comp = sd->comp;
101 if (!mask || !mask->pixels.u32) return; 86 if (!comp || !comp->pixels.u32) return;
102 87
103 // multiply the color with mul_col if any 88 // multiply the color with mul_col if any
104 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); 89 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
@@ -107,7 +92,7 @@ _blend_alpha_inv(int count, const SW_FT_Span *spans, void *user_data)
107 // move to the offset location 92 // move to the offset location
108 uint32_t *buffer = 93 uint32_t *buffer =
109 sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx); 94 sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx);
110 uint32_t *mbuffer = mask->pixels.u32; 95 uint32_t *mbuffer = comp->pixels.u32;
111 96
112 //Temp buffer for intermediate processing 97 //Temp buffer for intermediate processing
113 int tsize = sd->raster_buffer->generic->w; 98 int tsize = sd->raster_buffer->generic->w;
@@ -117,12 +102,12 @@ _blend_alpha_inv(int count, const SW_FT_Span *spans, void *user_data)
117 { 102 {
118 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x); 103 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x);
119 uint32_t *mtarget = 104 uint32_t *mtarget =
120 mbuffer + ((mask->generic->w * spans->y) + spans->x); 105 mbuffer + ((comp->generic->w * spans->y) + spans->x);
121 uint32_t *temp = tbuffer; 106 uint32_t *temp = tbuffer;
122 memset(temp, 0x00, sizeof(uint32_t) * spans->len); 107 memset(temp, 0x00, sizeof(uint32_t) * spans->len);
123 comp_func(temp, spans->len, color, spans->coverage); 108 comp_func(temp, spans->len, color, spans->coverage);
124 109
125 //masking 110 //composite
126 for (int i = 0; i < spans->len; i++) 111 for (int i = 0; i < spans->len; i++)
127 { 112 {
128 if (*mtarget) 113 if (*mtarget)
@@ -138,22 +123,22 @@ _blend_alpha_inv(int count, const SW_FT_Span *spans, void *user_data)
138} 123}
139 124
140static void 125static void
141_blend_mask_add(int count, const SW_FT_Span *spans, void *user_data) 126_comp_mask_add(int count, const SW_FT_Span *spans, void *user_data)
142{ 127{
143 Span_Data *sd = user_data; 128 Span_Data *sd = user_data;
144 Ector_Software_Buffer_Base_Data *mask = sd->mask; 129 Ector_Software_Buffer_Base_Data *comp = sd->comp;
145 if (!mask || !mask->pixels.u32) return; 130 if (!comp || !comp->pixels.u32) return;
146 131
147 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); 132 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
148 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color); 133 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color);
149 uint32_t *mbuffer = mask->pixels.u32; 134 uint32_t *mbuffer = comp->pixels.u32;
150 135
151 int tsize = sd->raster_buffer->generic->w; 136 int tsize = sd->raster_buffer->generic->w;
152 uint32_t *ttarget = alloca(sizeof(uint32_t) * tsize); 137 uint32_t *ttarget = alloca(sizeof(uint32_t) * tsize);
153 138
154 while (count--) 139 while (count--)
155 { 140 {
156 uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); 141 uint32_t *mtarget = mbuffer + ((comp->generic->w * spans->y) + spans->x);
157 memset(ttarget, 0x00, sizeof(uint32_t) * spans->len); 142 memset(ttarget, 0x00, sizeof(uint32_t) * spans->len);
158 comp_func(ttarget, spans->len, color, spans->coverage); 143 comp_func(ttarget, spans->len, color, spans->coverage);
159 for (int i = 0; i < spans->len; i++) 144 for (int i = 0; i < spans->len; i++)
@@ -163,22 +148,22 @@ _blend_mask_add(int count, const SW_FT_Span *spans, void *user_data)
163} 148}
164 149
165static void 150static void
166_blend_mask_sub(int count, const SW_FT_Span *spans, void *user_data) 151_comp_mask_sub(int count, const SW_FT_Span *spans, void *user_data)
167{ 152{
168 Span_Data *sd = user_data; 153 Span_Data *sd = user_data;
169 Ector_Software_Buffer_Base_Data *mask = sd->mask; 154 Ector_Software_Buffer_Base_Data *comp = sd->comp;
170 if (!mask || !mask->pixels.u32) return; 155 if (!comp || !comp->pixels.u32) return;
171 156
172 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); 157 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
173 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color); 158 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color);
174 uint32_t *mbuffer = mask->pixels.u32; 159 uint32_t *mbuffer = comp->pixels.u32;
175 160
176 int tsize = sd->raster_buffer->generic->w; 161 int tsize = sd->raster_buffer->generic->w;
177 uint32_t *ttarget = alloca(sizeof(uint32_t) * tsize); 162 uint32_t *ttarget = alloca(sizeof(uint32_t) * tsize);
178 163
179 while (count--) 164 while (count--)
180 { 165 {
181 uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); 166 uint32_t *mtarget = mbuffer + ((comp->generic->w * spans->y) + spans->x);
182 memset(ttarget, 0x00, sizeof(uint32_t) * spans->len); 167 memset(ttarget, 0x00, sizeof(uint32_t) * spans->len);
183 comp_func(ttarget, spans->len, color, spans->coverage); 168 comp_func(ttarget, spans->len, color, spans->coverage);
184 for (int i = 0; i < spans->len; i++) 169 for (int i = 0; i < spans->len; i++)
@@ -189,28 +174,28 @@ _blend_mask_sub(int count, const SW_FT_Span *spans, void *user_data)
189 174
190 175
191static void 176static void
192_blend_mask_ins(int count, const SW_FT_Span *spans, void *user_data) 177_comp_mask_ins(int count, const SW_FT_Span *spans, void *user_data)
193{ 178{
194 Span_Data *sd = user_data; 179 Span_Data *sd = user_data;
195 Ector_Software_Buffer_Base_Data *mask = sd->mask; 180 Ector_Software_Buffer_Base_Data *comp = sd->comp;
196 if (!mask || !mask->pixels.u32) return; 181 if (!comp || !comp->pixels.u32) return;
197 182
198 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); 183 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
199 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color); 184 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color);
200 uint32_t *mbuffer = mask->pixels.u32; 185 uint32_t *mbuffer = comp->pixels.u32;
201 186
202 int tsize = sd->raster_buffer->generic->w; 187 int tsize = sd->raster_buffer->generic->w;
203 uint32_t *ttarget = alloca(sizeof(uint32_t) * tsize); 188 uint32_t *ttarget = alloca(sizeof(uint32_t) * tsize);
204 189
205 for(unsigned int y = 0; y < mask->generic->h; y++) 190 for(unsigned int y = 0; y < comp->generic->h; y++)
206 { 191 {
207 for(unsigned int x = 0; x < mask->generic->w; x++) 192 for(unsigned int x = 0; x < comp->generic->w; x++)
208 { 193 {
209 if (x == (unsigned int)spans->x && x + spans->len <= mask->generic->w && 194 if (x == (unsigned int)spans->x && x + spans->len <= comp->generic->w &&
210 y == (unsigned int)spans->y && count > 0) 195 y == (unsigned int)spans->y && count > 0)
211 { 196 {
212 memset(ttarget, 0x00, sizeof(uint32_t) * spans->len); 197 memset(ttarget, 0x00, sizeof(uint32_t) * spans->len);
213 uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); 198 uint32_t *mtarget = mbuffer + ((comp->generic->w * spans->y) + spans->x);
214 comp_func(ttarget, spans->len, color, spans->coverage); 199 comp_func(ttarget, spans->len, color, spans->coverage);
215 for (int c = 0; c < spans->len; c++) 200 for (int c = 0; c < spans->len; c++)
216 mtarget[c] = draw_mul_256(ttarget[c]>>24, mtarget[c]); 201 mtarget[c] = draw_mul_256(ttarget[c]>>24, mtarget[c]);
@@ -220,7 +205,7 @@ _blend_mask_ins(int count, const SW_FT_Span *spans, void *user_data)
220 } 205 }
221 else 206 else
222 { 207 {
223 mbuffer[x + (mask->generic->w * y)] = (0x00FFFFFF & mbuffer[x + (mask->generic->w * y)]); 208 mbuffer[x + (comp->generic->w * y)] = (0x00FFFFFF & mbuffer[x + (comp->generic->w * y)]);
224 } 209 }
225 } 210 }
226 } 211 }
@@ -228,15 +213,15 @@ _blend_mask_ins(int count, const SW_FT_Span *spans, void *user_data)
228 213
229 214
230static void 215static void
231_blend_mask_diff(int count, const SW_FT_Span *spans, void *user_data) 216_comp_mask_diff(int count, const SW_FT_Span *spans, void *user_data)
232{ 217{
233 Span_Data *sd = user_data; 218 Span_Data *sd = user_data;
234 Ector_Software_Buffer_Base_Data *mask = sd->mask; 219 Ector_Software_Buffer_Base_Data *comp = sd->comp;
235 if (!mask || !mask->pixels.u32) return; 220 if (!comp || !comp->pixels.u32) return;
236 221
237 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); 222 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
238 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color); 223 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color);
239 uint32_t *mbuffer = mask->pixels.u32; 224 uint32_t *mbuffer = comp->pixels.u32;
240 225
241 int tsize = sd->raster_buffer->generic->w; 226 int tsize = sd->raster_buffer->generic->w;
242 uint32_t *ttarget = alloca(sizeof(uint32_t) * tsize); 227 uint32_t *ttarget = alloca(sizeof(uint32_t) * tsize);
@@ -244,7 +229,7 @@ _blend_mask_diff(int count, const SW_FT_Span *spans, void *user_data)
244 while (count--) 229 while (count--)
245 { 230 {
246 memset(ttarget, 0x00, sizeof(uint32_t) * spans->len); 231 memset(ttarget, 0x00, sizeof(uint32_t) * spans->len);
247 uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); 232 uint32_t *mtarget = mbuffer + ((comp->generic->w * spans->y) + spans->x);
248 comp_func(ttarget, spans->len, color, spans->coverage); 233 comp_func(ttarget, spans->len, color, spans->coverage);
249 for (int i = 0; i < spans->len; i++) 234 for (int i = 0; i < spans->len; i++)
250 mtarget[i] = draw_mul_256(0xFF - (mtarget[i]>>24), ttarget[i]) + draw_mul_256(0xFF - (ttarget[i]>>24), mtarget[i]); 235 mtarget[i] = draw_mul_256(0xFF - (mtarget[i]>>24), ttarget[i]) + draw_mul_256(0xFF - (ttarget[i]>>24), mtarget[i]);
@@ -310,8 +295,8 @@ _blend_gradient_alpha(int count, const SW_FT_Span *spans, void *user_data)
310 if (!fetchfunc) 295 if (!fetchfunc)
311 return; 296 return;
312 297
313 Ector_Software_Buffer_Base_Data *mask = data->mask; 298 Ector_Software_Buffer_Base_Data *comp = data->comp;
314 uint32_t *mbuffer = mask->pixels.u32; 299 uint32_t *mbuffer = comp->pixels.u32;
315 300
316 //Temp buffer for intermediate processing 301 //Temp buffer for intermediate processing
317 uint32_t *tbuffer = malloc(sizeof(uint32_t) * data->raster_buffer->generic->w); 302 uint32_t *tbuffer = malloc(sizeof(uint32_t) * data->raster_buffer->generic->w);
@@ -324,7 +309,7 @@ _blend_gradient_alpha(int count, const SW_FT_Span *spans, void *user_data)
324 while (count--) 309 while (count--)
325 { 310 {
326 uint32_t *target = buffer + ((data->raster_buffer->generic->w * spans->y) + spans->x); 311 uint32_t *target = buffer + ((data->raster_buffer->generic->w * spans->y) + spans->x);
327 uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); 312 uint32_t *mtarget = mbuffer + ((comp->generic->w * spans->y) + spans->x);
328 uint32_t *temp = tbuffer; 313 uint32_t *temp = tbuffer;
329 int length = spans->len; 314 int length = spans->len;
330 memset(temp, 0x00, sizeof(uint32_t) * spans->len); 315 memset(temp, 0x00, sizeof(uint32_t) * spans->len);
@@ -367,8 +352,8 @@ _blend_gradient_alpha_inv(int count, const SW_FT_Span *spans, void *user_data)
367 if (!fetchfunc) 352 if (!fetchfunc)
368 return; 353 return;
369 354
370 Ector_Software_Buffer_Base_Data *mask = data->mask; 355 Ector_Software_Buffer_Base_Data *comp = data->comp;
371 uint32_t *mbuffer = mask->pixels.u32; 356 uint32_t *mbuffer = comp->pixels.u32;
372 357
373 //Temp buffer for intermediate processing 358 //Temp buffer for intermediate processing
374 uint32_t *tbuffer = malloc(sizeof(uint32_t) * data->raster_buffer->generic->w); 359 uint32_t *tbuffer = malloc(sizeof(uint32_t) * data->raster_buffer->generic->w);
@@ -381,7 +366,7 @@ _blend_gradient_alpha_inv(int count, const SW_FT_Span *spans, void *user_data)
381 while (count--) 366 while (count--)
382 { 367 {
383 uint32_t *target = buffer + ((data->raster_buffer->generic->w * spans->y) + spans->x); 368 uint32_t *target = buffer + ((data->raster_buffer->generic->w * spans->y) + spans->x);
384 uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); 369 uint32_t *mtarget = mbuffer + ((comp->generic->w * spans->y) + spans->x);
385 uint32_t *temp = tbuffer; 370 uint32_t *temp = tbuffer;
386 int length = spans->len; 371 int length = spans->len;
387 memset(temp, 0x00, sizeof(uint32_t) * spans->len); 372 memset(temp, 0x00, sizeof(uint32_t) * spans->len);
@@ -599,38 +584,38 @@ static void
599_adjust_span_fill_methods(Span_Data *spdata) 584_adjust_span_fill_methods(Span_Data *spdata)
600{ 585{
601 //Blending Function 586 //Blending Function
602 if (spdata->mask) 587 if (spdata->comp)
603 { 588 {
604 switch (spdata->mask_op) 589 switch (spdata->comp_method)
605 { 590 {
606 default: 591 default:
607 case EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA: 592 case ECTOR_RENDERER_COMPOSITE_METHOD_MATTE_ALPHA:
608 if (spdata->type == Solid) 593 if (spdata->type == Solid)
609 spdata->unclipped_blend = &_blend_alpha; 594 spdata->unclipped_blend = &_comp_matte_alpha;
610 else if (spdata->type == LinearGradient || spdata->type == RadialGradient) 595 else if (spdata->type == LinearGradient || spdata->type == RadialGradient)
611 spdata->unclipped_blend = &_blend_gradient_alpha; 596 spdata->unclipped_blend = &_blend_gradient_alpha;
612 else //None 597 else //None
613 spdata->unclipped_blend = NULL; 598 spdata->unclipped_blend = NULL;
614 break; 599 break;
615 case EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA_INV: 600 case ECTOR_RENDERER_COMPOSITE_METHOD_MATTE_ALPHA_INVERSE:
616 if (spdata->type == Solid) 601 if (spdata->type == Solid)
617 spdata->unclipped_blend = &_blend_alpha_inv; 602 spdata->unclipped_blend = &_comp_matte_alpha_inv;
618 else if (spdata->type == LinearGradient || spdata->type == RadialGradient) 603 else if (spdata->type == LinearGradient || spdata->type == RadialGradient)
619 spdata->unclipped_blend = &_blend_gradient_alpha_inv; 604 spdata->unclipped_blend = &_blend_gradient_alpha_inv;
620 else //None 605 else //None
621 spdata->unclipped_blend = NULL; 606 spdata->unclipped_blend = NULL;
622 break; 607 break;
623 case EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_ADD: 608 case ECTOR_RENDERER_COMPOSITE_METHOD_MASK_ADD:
624 spdata->unclipped_blend = &_blend_mask_add; 609 spdata->unclipped_blend = &_comp_mask_add;
625 break; 610 break;
626 case EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_SUBSTRACT: 611 case ECTOR_RENDERER_COMPOSITE_METHOD_MASK_SUBSTRACT:
627 spdata->unclipped_blend = &_blend_mask_sub; 612 spdata->unclipped_blend = &_comp_mask_sub;
628 break; 613 break;
629 case EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_INTERSECT: 614 case ECTOR_RENDERER_COMPOSITE_METHOD_MASK_INTERSECT:
630 spdata->unclipped_blend = &_blend_mask_ins; 615 spdata->unclipped_blend = &_comp_mask_ins;
631 break; 616 break;
632 case EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_DIFFERENCE: 617 case ECTOR_RENDERER_COMPOSITE_METHOD_MASK_DIFFERENCE:
633 spdata->unclipped_blend = &_blend_mask_diff; 618 spdata->unclipped_blend = &_comp_mask_diff;
634 break; 619 break;
635 } 620 }
636 } 621 }
@@ -910,8 +895,8 @@ void
910ector_software_rasterizer_draw_rle_data(Software_Rasterizer *rasterizer, 895ector_software_rasterizer_draw_rle_data(Software_Rasterizer *rasterizer,
911 int x, int y, uint32_t mul_col, 896 int x, int y, uint32_t mul_col,
912 Efl_Gfx_Render_Op op, Shape_Rle_Data* rle, 897 Efl_Gfx_Render_Op op, Shape_Rle_Data* rle,
913 Ector_Buffer *mask, 898 Ector_Buffer *comp,
914 int mask_op) 899 Ector_Renderer_Composite_Method comp_method)
915{ 900{
916 if (!rle) return; 901 if (!rle) return;
917 if (!rasterizer->fill_data.raster_buffer->pixels.u32) return; 902 if (!rasterizer->fill_data.raster_buffer->pixels.u32) return;
@@ -920,9 +905,9 @@ ector_software_rasterizer_draw_rle_data(Software_Rasterizer *rasterizer,
920 rasterizer->fill_data.offy = y; 905 rasterizer->fill_data.offy = y;
921 rasterizer->fill_data.mul_col = mul_col; 906 rasterizer->fill_data.mul_col = mul_col;
922 rasterizer->fill_data.op = op; 907 rasterizer->fill_data.op = op;
923 rasterizer->fill_data.mask = 908 rasterizer->fill_data.comp =
924 mask ? efl_data_scope_get(mask, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN) : NULL; 909 comp ? efl_data_scope_get(comp, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN) : NULL;
925 rasterizer->fill_data.mask_op = mask_op; 910 rasterizer->fill_data.comp_method = comp_method;
926 911
927 _setup_span_fill_matrix(rasterizer); 912 _setup_span_fill_matrix(rasterizer);
928 _adjust_span_fill_methods(&rasterizer->fill_data); 913 _adjust_span_fill_methods(&rasterizer->fill_data);