summaryrefslogtreecommitdiff
path: root/src/lib/evas/common/evas_map_image_internal.c
diff options
context:
space:
mode:
authorJaeun Choi <jaeun12.choi@samsung.com>2014-11-19 20:08:03 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-01-07 15:06:02 +0900
commit62f3170874c30194c78ab75248b2a45e400f237f (patch)
tree939b02a6a0345068560cdea84fd5b66927779c01 /src/lib/evas/common/evas_map_image_internal.c
parent4eb3a58edd1b88fc2c71945d39c75336e038fdd7 (diff)
Evas masking: Implement support for map draw (SW)
Diffstat (limited to '')
-rw-r--r--src/lib/evas/common/evas_map_image_internal.c62
1 files changed, 46 insertions, 16 deletions
diff --git a/src/lib/evas/common/evas_map_image_internal.c b/src/lib/evas/common/evas_map_image_internal.c
index ba00981319..f3238b2420 100644
--- a/src/lib/evas/common/evas_map_image_internal.c
+++ b/src/lib/evas/common/evas_map_image_internal.c
@@ -4,15 +4,17 @@ FUNC_NAME(RGBA_Image *src, RGBA_Image *dst,
4 int clip_x, int clip_y, int clip_w, int clip_h, 4 int clip_x, int clip_y, int clip_w, int clip_h,
5 DATA32 mul_col, int render_op, 5 DATA32 mul_col, int render_op,
6 RGBA_Map_Point *p, 6 RGBA_Map_Point *p,
7 int smooth, int anti_alias, int level EINA_UNUSED) // level unused for now - for future use 7 int smooth, int anti_alias, int level EINA_UNUSED, // level unused for now - for future use
8 RGBA_Image *mask_ie, int mask_x, int mask_y)
8{ 9{
9 int i; 10 int i;
10 int cx, cy, cw, ch; 11 int cx, cy, cw, ch;
11 int ytop, ybottom, ystart, yend, y, sw, shp, swp, direct; 12 int ytop, ybottom, ystart, yend, y, sw, shp, swp, direct;
12 Line *spans; 13 Line *spans;
13 DATA32 *buf = NULL, *sp; 14 DATA32 *buf = NULL, *sp;
14 RGBA_Gfx_Func func = NULL; 15 RGBA_Gfx_Func func = NULL, func2 = NULL;
15 Eina_Bool havea = EINA_FALSE; 16 Eina_Bool havea = EINA_FALSE;
17 Eina_Bool sa, ssa, da;
16 int havecol = 4; 18 int havecol = 4;
17 19
18 cx = clip_x; 20 cx = clip_x;
@@ -57,6 +59,10 @@ FUNC_NAME(RGBA_Image *src, RGBA_Image *dst,
57 swp = sw << (FP + FPI); 59 swp = sw << (FP + FPI);
58 shp = src->cache_entry.h << (FP + FPI); 60 shp = src->cache_entry.h << (FP + FPI);
59 61
62 sa = src->cache_entry.flags.alpha;
63 ssa = src->cache_entry.flags.alpha_sparse;
64 da = dst->cache_entry.flags.alpha;
65
60 // limit u,v coords of points to be within the source image 66 // limit u,v coords of points to be within the source image
61 for (i = 0; i < 4; i++) 67 for (i = 0; i < 4; i++)
62 { 68 {
@@ -88,8 +94,8 @@ FUNC_NAME(RGBA_Image *src, RGBA_Image *dst,
88 /* FIXME: even if anti-alias is enabled, only edges may require the 94 /* FIXME: even if anti-alias is enabled, only edges may require the
89 pixels composition. we can optimize it. */ 95 pixels composition. we can optimize it. */
90 96
91 if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha) && 97 if ((!sa) && (!dst->cache_entry.flags.alpha) &&
92 (mul_col == 0xffffffff) && (!havea) && (!anti_alias)) 98 (mul_col == 0xffffffff) && (!havea) && (!anti_alias) && (!mask_ie))
93 { 99 {
94 direct = 1; 100 direct = 1;
95 } 101 }
@@ -98,12 +104,20 @@ FUNC_NAME(RGBA_Image *src, RGBA_Image *dst,
98 int pa; 104 int pa;
99 105
100 buf = alloca(cw * sizeof(DATA32)); 106 buf = alloca(cw * sizeof(DATA32));
101 pa = src->cache_entry.flags.alpha; 107 if (havea) sa = 1;
102 if (havea) src->cache_entry.flags.alpha = 1; 108 if (!mask_ie)
103 if (mul_col != 0xffffffff) 109 {
104 func = evas_common_gfx_func_composite_pixel_color_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, mul_col, dst->cache_entry.flags.alpha, cw, render_op); 110 if (mul_col != 0xffffffff)
111 func = evas_common_gfx_func_composite_pixel_color_span_get(sa, ssa, mul_col, da, cw, render_op);
112 else
113 func = evas_common_gfx_func_composite_pixel_span_get(sa, ssa, da, cw, render_op);
114 }
105 else 115 else
106 func = evas_common_gfx_func_composite_pixel_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, cw, render_op); 116 {
117 func = evas_common_gfx_func_composite_pixel_mask_span_get(sa, ssa, da, cw, render_op);
118 if (mul_col != 0xffffffff)
119 func2 = evas_common_gfx_func_composite_pixel_color_span_get(sa, ssa, mul_col, da, cw, render_op);
120 }
107 121
108 if (anti_alias) src->cache_entry.flags.alpha = EINA_TRUE; 122 if (anti_alias) src->cache_entry.flags.alpha = EINA_TRUE;
109 else src->cache_entry.flags.alpha = pa; 123 else src->cache_entry.flags.alpha = pa;
@@ -128,12 +142,17 @@ FUNC_NAME_DO(RGBA_Image *src, RGBA_Image *dst,
128{ 142{
129 Line *spans; 143 Line *spans;
130 DATA32 *buf = NULL, *sp; 144 DATA32 *buf = NULL, *sp;
131 RGBA_Gfx_Func func = NULL; 145 RGBA_Gfx_Func func = NULL, func2 = NULL;
132 int cx, cy, cw, ch; 146 int cx, cy, cw, ch;
133 DATA32 mul_col; 147 DATA32 mul_col;
134 int ystart, yend, y, sw, shp, swp, direct; 148 int ystart, yend, y, sw, shp, swp, direct;
135 int havecol; 149 int havecol;
136 int i; 150 int i;
151 Eina_Bool sa, ssa, da;
152
153 RGBA_Image *mask_ie = dc->clip.mask;
154 int mask_x = dc->clip.mask_x;
155 int mask_y = dc->clip.mask_y;
137 156
138 cx = dc->clip.x; 157 cx = dc->clip.x;
139 cy = dc->clip.y; 158 cy = dc->clip.y;
@@ -155,6 +174,10 @@ FUNC_NAME_DO(RGBA_Image *src, RGBA_Image *dst,
155 havecol = ms->havecol; 174 havecol = ms->havecol;
156 direct = ms->direct; 175 direct = ms->direct;
157 176
177 sa = src->cache_entry.flags.alpha;
178 ssa = src->cache_entry.flags.alpha_sparse;
179 da = dst->cache_entry.flags.alpha;
180
158 // allocate some s to hold out span list 181 // allocate some s to hold out span list
159 spans = alloca((yend - ystart + 1) * sizeof(Line)); 182 spans = alloca((yend - ystart + 1) * sizeof(Line));
160 memcpy(spans, &ms->spans[ystart - ms->ystart], 183 memcpy(spans, &ms->spans[ystart - ms->ystart],
@@ -167,13 +190,20 @@ FUNC_NAME_DO(RGBA_Image *src, RGBA_Image *dst,
167 int pa; 190 int pa;
168 191
169 buf = alloca(cw * sizeof(DATA32)); 192 buf = alloca(cw * sizeof(DATA32));
170 pa = src->cache_entry.flags.alpha; 193 if (ms->havea) sa = 1;
171 if (ms->havea) src->cache_entry.flags.alpha = 1; 194 if (mask_ie)
172 if (dc->mul.use) 195 {
173 func = evas_common_gfx_func_composite_pixel_color_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dc->mul.col, dst->cache_entry.flags.alpha, cw, dc->render_op); 196 if (mul_col != 0xffffffff)
197 func = evas_common_gfx_func_composite_pixel_color_span_get(sa, ssa, dc->mul.col, da, cw, dc->render_op);
198 else
199 func = evas_common_gfx_func_composite_pixel_span_get(sa, ssa, da, cw, dc->render_op);
200 }
174 else 201 else
175 func = evas_common_gfx_func_composite_pixel_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, cw, dc->render_op); 202 {
176 src->cache_entry.flags.alpha = pa; 203 func = evas_common_gfx_func_composite_pixel_mask_span_get(sa, ssa, da, cw, dc->render_op);
204 if (mul_col != 0xffffffff)
205 func2 = evas_common_gfx_func_composite_pixel_color_span_get(sa, ssa, dc->mul.col, da, cw, dc->render_op);
206 }
177 } 207 }
178 208
179 if (havecol == 0) 209 if (havecol == 0)