summaryrefslogtreecommitdiff
path: root/src/lib/ector
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2019-09-06 17:41:52 +0900
committerHermet Park <hermetpark@gmail.com>2019-09-06 17:56:02 +0900
commit690dd5d33a39aec8537dbab3321a75e506b306de (patch)
tree0d4d160caf4b55ecadd3b3934da2546eaa0b2ade /src/lib/ector
parentae29408b86eaf8f6f324baff0312b336d56b1efc (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() with Efl.Gfx.VG_Composite_Method instead of mask_set().
Diffstat (limited to 'src/lib/ector')
-rw-r--r--src/lib/ector/ector_renderer.c8
-rw-r--r--src/lib/ector/ector_renderer.eo8
-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
8 files changed, 105 insertions, 120 deletions
diff --git a/src/lib/ector/ector_renderer.c b/src/lib/ector/ector_renderer.c
index d0efab6..15bd96e 100644
--- a/src/lib/ector/ector_renderer.c
+++ b/src/lib/ector/ector_renderer.c
@@ -146,10 +146,10 @@ _ector_renderer_crc_get(const Eo *obj EINA_UNUSED,
146} 146}
147 147
148static void 148static void
149_ector_renderer_mask_set(Eo *obj EINA_UNUSED, 149_ector_renderer_comp_method_set(Eo *obj EINA_UNUSED,
150 Ector_Renderer_Data *pd EINA_UNUSED, 150 Ector_Renderer_Data *pd EINA_UNUSED,
151 Ector_Buffer *mask EINA_UNUSED, 151 Ector_Buffer *comp EINA_UNUSED,
152 int op EINA_UNUSED) 152 Efl_Gfx_Vg_Composite_Method method EINA_UNUSED)
153{ 153{
154} 154}
155 155
diff --git a/src/lib/ector/ector_renderer.eo b/src/lib/ector/ector_renderer.eo
index 4d7279a..74d0f8b 100644
--- a/src/lib/ector/ector_renderer.eo
+++ b/src/lib/ector/ector_renderer.eo
@@ -78,13 +78,13 @@ abstract @beta Ector.Renderer extends Efl.Object
78 return: uint; [[CRC value]] 78 return: uint; [[CRC value]]
79 } 79 }
80 } 80 }
81 @property mask { 81 @property comp_method {
82 [[Set Mask Image to this Renderer]] 82 [[Set Composite Buffer to this Renderer]]
83 set { 83 set {
84 } 84 }
85 values { 85 values {
86 mask: Ector.Buffer; [[Mask Image Buffer]] 86 comp: Ector.Buffer; [[Composite Buffer]]
87 op: int; [[Masking option]] 87 method: Efl.Gfx.Vg_Composite_Method; [[Composite method]]
88 } 88 }
89 } 89 }
90 draw @pure_virtual { 90 draw @pure_virtual {
diff --git a/src/lib/ector/software/ector_renderer_software_image.c b/src/lib/ector/software/ector_renderer_software_image.c
index cb8d93a..e06e79d 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 Efl_Gfx_Vg_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 Efl_Gfx_Vg_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 8a3f9c5..4771702 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 6210179..601d03c 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 Efl_Gfx_Vg_Composite_Method comp_method;
43 43
44 Ector_Software_Shape_Task *task; 44 Ector_Software_Shape_Task *task;
45 45
@@ -675,8 +675,8 @@ _ector_renderer_software_shape_ector_renderer_draw(Eo *obj,
675 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer, 675 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer,
676 x, y, mul_col, op, 676 x, y, mul_col, op,
677 pd->shape_data, 677 pd->shape_data,
678 pd->mask, 678 pd->comp,
679 pd->mask_op); 679 pd->comp_method);
680 } 680 }
681 else 681 else
682 { 682 {
@@ -690,8 +690,8 @@ _ector_renderer_software_shape_ector_renderer_draw(Eo *obj,
690 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer, 690 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer,
691 x, y, mul_col, op, 691 x, y, mul_col, op,
692 pd->shape_data, 692 pd->shape_data,
693 pd->mask, 693 pd->comp,
694 pd->mask_op); 694 pd->comp_method);
695 } 695 }
696 } 696 }
697 697
@@ -703,8 +703,8 @@ _ector_renderer_software_shape_ector_renderer_draw(Eo *obj,
703 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer, 703 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer,
704 x, y, mul_col, op, 704 x, y, mul_col, op,
705 pd->outline_data, 705 pd->outline_data,
706 pd->mask, 706 pd->comp,
707 pd->mask_op); 707 pd->comp_method);
708 } 708 }
709 else 709 else
710 { 710 {
@@ -718,8 +718,8 @@ _ector_renderer_software_shape_ector_renderer_draw(Eo *obj,
718 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer, 718 ector_software_rasterizer_draw_rle_data(pd->surface->rasterizer,
719 x, y, mul_col, op, 719 x, y, mul_col, op,
720 pd->outline_data, 720 pd->outline_data,
721 pd->mask, 721 pd->comp,
722 pd->mask_op); 722 pd->comp_method);
723 } 723 }
724 } 724 }
725 725
@@ -829,14 +829,14 @@ _ector_renderer_software_shape_ector_renderer_crc_get(const Eo *obj,
829} 829}
830 830
831static void 831static void
832_ector_renderer_software_shape_ector_renderer_mask_set(Eo *obj EINA_UNUSED, 832_ector_renderer_software_shape_ector_renderer_comp_method_set(Eo *obj EINA_UNUSED,
833 Ector_Renderer_Software_Shape_Data *pd, 833 Ector_Renderer_Software_Shape_Data *pd,
834 Ector_Buffer *mask, 834 Ector_Buffer *comp,
835 int op) 835 Efl_Gfx_Vg_Composite_Method method)
836{ 836{
837 //Use ref/unref. 837 //Use ref/unref.
838 pd->mask = mask; 838 pd->comp = comp;
839 pd->mask_op = op; 839 pd->comp_method = method;
840} 840}
841 841
842#include "ector_renderer_software_shape.eo.c" 842#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 4ea56f9..83b87c0 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 f7e47fe..24fe240 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 Efl_Gfx_Vg_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 Efl_Gfx_Vg_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 ad4aa25..8cd0854 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]);
@@ -309,8 +294,8 @@ _blend_gradient_alpha(int count, const SW_FT_Span *spans, void *user_data)
309 294
310 if (!fetchfunc) return; 295 if (!fetchfunc) return;
311 296
312 Ector_Software_Buffer_Base_Data *mask = sd->mask; 297 Ector_Software_Buffer_Base_Data *comp = sd->comp;
313 uint32_t *mbuffer = mask->pixels.u32; 298 uint32_t *mbuffer = comp->pixels.u32;
314 299
315 // move to the offset location 300 // move to the offset location
316 buffer = sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx); 301 buffer = sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx);
@@ -318,7 +303,7 @@ _blend_gradient_alpha(int count, const SW_FT_Span *spans, void *user_data)
318 while (count--) 303 while (count--)
319 { 304 {
320 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x); 305 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x);
321 uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); 306 uint32_t *mtarget = mbuffer + ((comp->generic->w * spans->y) + spans->x);
322 int length = spans->len; 307 int length = spans->len;
323 308
324 while (length) 309 while (length)
@@ -358,8 +343,8 @@ _blend_gradient_alpha_inv(int count, const SW_FT_Span *spans, void *user_data)
358 343
359 if (!fetchfunc) return; 344 if (!fetchfunc) return;
360 345
361 Ector_Software_Buffer_Base_Data *mask = sd->mask; 346 Ector_Software_Buffer_Base_Data *comp = sd->comp;
362 uint32_t *mbuffer = mask->pixels.u32; 347 uint32_t *mbuffer = comp->pixels.u32;
363 348
364 // move to the offset location 349 // move to the offset location
365 buffer = sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx); 350 buffer = sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx);
@@ -367,7 +352,7 @@ _blend_gradient_alpha_inv(int count, const SW_FT_Span *spans, void *user_data)
367 while (count--) 352 while (count--)
368 { 353 {
369 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x); 354 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x);
370 uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); 355 uint32_t *mtarget = mbuffer + ((comp->generic->w * spans->y) + spans->x);
371 int length = spans->len; 356 int length = spans->len;
372 357
373 while (length) 358 while (length)
@@ -584,38 +569,38 @@ static void
584_adjust_span_fill_methods(Span_Data *spdata) 569_adjust_span_fill_methods(Span_Data *spdata)
585{ 570{
586 //Blending Function 571 //Blending Function
587 if (spdata->mask) 572 if (spdata->comp)
588 { 573 {
589 switch (spdata->mask_op) 574 switch (spdata->comp_method)
590 { 575 {
591 default: 576 default:
592 case EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA: 577 case EFL_GFX_VG_COMPOSITE_METHOD_MATTE_ALPHA:
593 if (spdata->type == Solid) 578 if (spdata->type == Solid)
594 spdata->unclipped_blend = &_blend_alpha; 579 spdata->unclipped_blend = &_comp_matte_alpha;
595 else if (spdata->type == LinearGradient || spdata->type == RadialGradient) 580 else if (spdata->type == LinearGradient || spdata->type == RadialGradient)
596 spdata->unclipped_blend = &_blend_gradient_alpha; 581 spdata->unclipped_blend = &_blend_gradient_alpha;
597 else //None 582 else //None
598 spdata->unclipped_blend = NULL; 583 spdata->unclipped_blend = NULL;
599 break; 584 break;
600 case EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA_INV: 585 case EFL_GFX_VG_COMPOSITE_METHOD_MATTE_ALPHA_INVERSE:
601 if (spdata->type == Solid) 586 if (spdata->type == Solid)
602 spdata->unclipped_blend = &_blend_alpha_inv; 587 spdata->unclipped_blend = &_comp_matte_alpha_inv;
603 else if (spdata->type == LinearGradient || spdata->type == RadialGradient) 588 else if (spdata->type == LinearGradient || spdata->type == RadialGradient)
604 spdata->unclipped_blend = &_blend_gradient_alpha_inv; 589 spdata->unclipped_blend = &_blend_gradient_alpha_inv;
605 else //None 590 else //None
606 spdata->unclipped_blend = NULL; 591 spdata->unclipped_blend = NULL;
607 break; 592 break;
608 case EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_ADD: 593 case EFL_GFX_VG_COMPOSITE_METHOD_MASK_ADD:
609 spdata->unclipped_blend = &_blend_mask_add; 594 spdata->unclipped_blend = &_comp_mask_add;
610 break; 595 break;
611 case EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_SUBSTRACT: 596 case EFL_GFX_VG_COMPOSITE_METHOD_MASK_SUBSTRACT:
612 spdata->unclipped_blend = &_blend_mask_sub; 597 spdata->unclipped_blend = &_comp_mask_sub;
613 break; 598 break;
614 case EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_INTERSECT: 599 case EFL_GFX_VG_COMPOSITE_METHOD_MASK_INTERSECT:
615 spdata->unclipped_blend = &_blend_mask_ins; 600 spdata->unclipped_blend = &_comp_mask_ins;
616 break; 601 break;
617 case EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_DIFFERENCE: 602 case EFL_GFX_VG_COMPOSITE_METHOD_MASK_DIFFERENCE:
618 spdata->unclipped_blend = &_blend_mask_diff; 603 spdata->unclipped_blend = &_comp_mask_diff;
619 break; 604 break;
620 } 605 }
621 } 606 }
@@ -895,8 +880,8 @@ void
895ector_software_rasterizer_draw_rle_data(Software_Rasterizer *rasterizer, 880ector_software_rasterizer_draw_rle_data(Software_Rasterizer *rasterizer,
896 int x, int y, uint32_t mul_col, 881 int x, int y, uint32_t mul_col,
897 Efl_Gfx_Render_Op op, Shape_Rle_Data* rle, 882 Efl_Gfx_Render_Op op, Shape_Rle_Data* rle,
898 Ector_Buffer *mask, 883 Ector_Buffer *comp,
899 int mask_op) 884 Efl_Gfx_Vg_Composite_Method comp_method)
900{ 885{
901 if (!rle) return; 886 if (!rle) return;
902 if (!rasterizer->fill_data.raster_buffer->pixels.u32) return; 887 if (!rasterizer->fill_data.raster_buffer->pixels.u32) return;
@@ -905,9 +890,9 @@ ector_software_rasterizer_draw_rle_data(Software_Rasterizer *rasterizer,
905 rasterizer->fill_data.offy = y; 890 rasterizer->fill_data.offy = y;
906 rasterizer->fill_data.mul_col = mul_col; 891 rasterizer->fill_data.mul_col = mul_col;
907 rasterizer->fill_data.op = op; 892 rasterizer->fill_data.op = op;
908 rasterizer->fill_data.mask = 893 rasterizer->fill_data.comp =
909 mask ? efl_data_scope_get(mask, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN) : NULL; 894 comp ? efl_data_scope_get(comp, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN) : NULL;
910 rasterizer->fill_data.mask_op = mask_op; 895 rasterizer->fill_data.comp_method = comp_method;
911 896
912 _setup_span_fill_matrix(rasterizer); 897 _setup_span_fill_matrix(rasterizer);
913 _adjust_span_fill_methods(&rasterizer->fill_data); 898 _adjust_span_fill_methods(&rasterizer->fill_data);