summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaeun Choi <jaeun12.choi@samsung.com>2014-11-13 10:04:00 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-12-22 22:33:10 +0900
commit676cd98a1f48527eafcd8fe150872b0334e6bcfd (patch)
tree50a4f66b42ef1fdd0bb0d9b8d3d01ddf1a37d6ad
parentaf43bc67e4a79b18343f7f8f55754b3eceaa48a3 (diff)
Evas masking: Use alpha mask in SW engine draw functions
Work done by Jaeun Choi, rebased & squashed by jpeg. This commit introduces changes to the low-level draw functions of the SW engine considering the existence of an alpha mask image. Features: - Font masking (TEXT, TEXTBLOCK), - Rectangle masking, - Image masking (all image scaling functions should be handled). The mask image itself is not yet set in the draw context (see following commits). @feature Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
-rw-r--r--src/lib/evas/common/evas_font_compress.c37
-rw-r--r--src/lib/evas/common/evas_rectangle.h2
-rw-r--r--src/lib/evas/common/evas_rectangle_main.c41
-rw-r--r--src/lib/evas/common/evas_scale_main.h4
-rw-r--r--src/lib/evas/common/evas_scale_sample.c220
-rw-r--r--src/lib/evas/common/evas_scale_smooth.c20
-rw-r--r--src/lib/evas/common/evas_scale_smooth_scaler.c2
-rw-r--r--src/lib/evas/common/evas_scale_smooth_scaler_down.c18
-rw-r--r--src/lib/evas/common/evas_scale_smooth_scaler_downx.c35
-rw-r--r--src/lib/evas/common/evas_scale_smooth_scaler_downx_downy.c35
-rw-r--r--src/lib/evas/common/evas_scale_smooth_scaler_downy.c35
-rw-r--r--src/lib/evas/common/evas_scale_smooth_scaler_up.c70
-rw-r--r--src/lib/evas/include/evas_common_private.h2
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c35
14 files changed, 467 insertions, 89 deletions
diff --git a/src/lib/evas/common/evas_font_compress.c b/src/lib/evas/common/evas_font_compress.c
index 1cbd0906c8..90612ec4c3 100644
--- a/src/lib/evas/common/evas_font_compress.c
+++ b/src/lib/evas/common/evas_font_compress.c
@@ -525,6 +525,43 @@ evas_common_font_glyph_draw(RGBA_Font_Glyph *fg,
525 } 525 }
526 free(src8); 526 free(src8);
527 } 527 }
528 else if (dc->clip.mask)
529 {
530 RGBA_Gfx_Func func;
531 DATA8 *src8, *mask;
532 DATA32 *buf, *ptr, *buf_ptr;
533 RGBA_Image *im = dc->clip.mask;
534 int row;
535
536 buf = alloca(sizeof(DATA32) * w * h);
537
538 // Step 1: alpha glyph drawing
539 src8 = evas_common_font_glyph_uncompress(fg, NULL, NULL);
540 if (!src8) return;
541
542 // Step 2: color blending to buffer
543 func = evas_common_gfx_func_composite_mask_color_span_get(col, dst_image->cache_entry.flags.alpha, 1, EVAS_RENDER_COPY);
544 for (row = y1; row < y2; row++)
545 {
546 buf_ptr = buf + (row * w) + x1;
547 DATA8 *s = src8 + (row * w) + x1;
548 func(NULL, s, col, buf_ptr, x2 - x1);
549 }
550 free(src8);
551
552 // Step 3: masking to destination
553 func = evas_common_gfx_func_composite_pixel_mask_span_get(im->cache_entry.flags.alpha, im->cache_entry.flags.alpha_sparse, dst_image->cache_entry.flags.alpha, dst_pitch, dc->render_op);
554 for (row = y1; row < y2; row++)
555 {
556 mask = im->image.data8
557 + (y + row - dc->clip.mask_y) * im->cache_entry.w
558 + (x + x1 - dc->clip.mask_x);
559
560 ptr = dst + (x + x1) + ((y + row) * dst_pitch);
561 buf_ptr = buf + (row * w) + x1;
562 func(buf_ptr, mask, 0, ptr, x2 - x1);
563 }
564 }
528 else 565 else
529 { 566 {
530 // build fast multiply + mask color tables to avoid compute. this works 567 // build fast multiply + mask color tables to avoid compute. this works
diff --git a/src/lib/evas/common/evas_rectangle.h b/src/lib/evas/common/evas_rectangle.h
index 289188f58f..e79afd586d 100644
--- a/src/lib/evas/common/evas_rectangle.h
+++ b/src/lib/evas/common/evas_rectangle.h
@@ -10,7 +10,7 @@ EAPI void evas_common_rectangle_draw (RGBA_Image *dst, RGBA_Draw_Context *dc, in
10EAPI void evas_common_rectangle_draw_do(const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h); 10EAPI void evas_common_rectangle_draw_do(const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h);
11EAPI Eina_Bool evas_common_rectangle_draw_prepare(Cutout_Rects **reuse, const RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h); 11EAPI Eina_Bool evas_common_rectangle_draw_prepare(Cutout_Rects **reuse, const RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h);
12 12
13EAPI void evas_common_rectangle_rgba_draw (RGBA_Image *dst, DATA32 color, int render_op, int x, int y, int w, int h); 13EAPI void evas_common_rectangle_rgba_draw (RGBA_Image *dst, DATA32 color, int render_op, int x, int y, int w, int h, RGBA_Image *mask_ie, int mask_x, int mask_y);
14 14
15#endif /* _EVAS_RECTANGLE_H */ 15#endif /* _EVAS_RECTANGLE_H */
16 16
diff --git a/src/lib/evas/common/evas_rectangle_main.c b/src/lib/evas/common/evas_rectangle_main.c
index 68a5ffc720..d952f41e49 100644
--- a/src/lib/evas/common/evas_rectangle_main.c
+++ b/src/lib/evas/common/evas_rectangle_main.c
@@ -110,6 +110,8 @@ rectangle_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, in
110 RGBA_Gfx_Func func; 110 RGBA_Gfx_Func func;
111 int yy; 111 int yy;
112 DATA32 *ptr; 112 DATA32 *ptr;
113 DATA8 *mask;
114 RGBA_Image *mask_ie = dc->clip.mask;
113 115
114 if (!dst->image.data) return; 116 if (!dst->image.data) return;
115 RECTS_CLIP_TO_RECT(x, y, w, h, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h); 117 RECTS_CLIP_TO_RECT(x, y, w, h, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h);
@@ -132,29 +134,54 @@ rectangle_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, in
132# endif 134# endif
133#endif 135#endif
134 { 136 {
135 func = evas_common_gfx_func_composite_color_span_get(dc->col.col, dst->cache_entry.flags.alpha, w, dc->render_op); 137 if (mask_ie)
138 func = evas_common_gfx_func_composite_mask_color_span_get(dc->col.col, dst->cache_entry.flags.alpha, w, dc->render_op);
139 else
140 func = evas_common_gfx_func_composite_color_span_get(dc->col.col, dst->cache_entry.flags.alpha, w, dc->render_op);
136 ptr = dst->image.data + (y * dst->cache_entry.w) + x; 141 ptr = dst->image.data + (y * dst->cache_entry.w) + x;
137 for (yy = 0; yy < h; yy++) 142 for (yy = 0; yy < h; yy++)
138 { 143 {
139 func(NULL, NULL, dc->col.col, ptr, w); 144 if (mask_ie)
140 145 {
141 ptr += dst->cache_entry.w; 146 mask = mask_ie->image.data8
147 + (y + yy - dc->clip.mask_y) * mask_ie->cache_entry.w
148 + (x - dc->clip.mask_x);
149 func(NULL, mask, dc->col.col, ptr, w);
150 }
151 else
152 func(NULL, NULL, dc->col.col, ptr, w);
153
154 ptr += dst->cache_entry.w;
142 } 155 }
143 } 156 }
144} 157}
145 158
146EAPI void 159EAPI void
147evas_common_rectangle_rgba_draw(RGBA_Image *dst, DATA32 color, int render_op, int x, int y, int w, int h) 160evas_common_rectangle_rgba_draw(RGBA_Image *dst, DATA32 color, int render_op, int x, int y, int w, int h, RGBA_Image *mask_ie, int mask_x, int mask_y)
148{ 161{
149 RGBA_Gfx_Func func; 162 RGBA_Gfx_Func func;
150 DATA32 *ptr; 163 DATA32 *ptr;
164 DATA8 *mask;
151 int yy; 165 int yy;
152 166
153 func = evas_common_gfx_func_composite_color_span_get(color, dst->cache_entry.flags.alpha, w, render_op); 167 if (mask_ie)
168 func = evas_common_gfx_func_composite_mask_color_span_get(color, dst->cache_entry.flags.alpha, w, render_op);
169 else
170 func = evas_common_gfx_func_composite_color_span_get(color, dst->cache_entry.flags.alpha, w, render_op);
171
154 ptr = dst->image.data + (y * dst->cache_entry.w) + x; 172 ptr = dst->image.data + (y * dst->cache_entry.w) + x;
155 for (yy = 0; yy < h; yy++) 173 for (yy = 0; yy < h; yy++)
156 { 174 {
157 func(NULL, NULL, color, ptr, w); 175 if (mask_ie)
176 {
177 mask = mask_ie->image.data8
178 + (y + yy - mask_y) * mask_ie->cache_entry.w
179 + (x - mask_x);
180 func(NULL, mask, color, ptr, w);
181 }
182 else
183 func(NULL, NULL, color, ptr, w);
184
158 ptr += dst->cache_entry.w; 185 ptr += dst->cache_entry.w;
159 } 186 }
160} 187}
diff --git a/src/lib/evas/common/evas_scale_main.h b/src/lib/evas/common/evas_scale_main.h
index 4e606e03be..c0e1f945ec 100644
--- a/src/lib/evas/common/evas_scale_main.h
+++ b/src/lib/evas/common/evas_scale_main.h
@@ -13,8 +13,8 @@ EAPI void evas_common_rgba_image_scalecache_dump(void);
13 13
14EAPI void evas_common_scale_rgba_in_to_out_clip_sample_do (const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h); 14EAPI void evas_common_scale_rgba_in_to_out_clip_sample_do (const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h);
15EAPI void evas_common_scale_rgba_in_to_out_clip_smooth_do (const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h); 15EAPI void evas_common_scale_rgba_in_to_out_clip_smooth_do (const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h);
16EAPI void evas_common_scale_rgba_sample_draw (RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h); 16EAPI void evas_common_scale_rgba_sample_draw (RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h, RGBA_Image *mask, int mask_x, int mask_y);
17EAPI void evas_common_scale_rgba_smooth_draw (RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h); 17EAPI void evas_common_scale_rgba_smooth_draw (RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h, RGBA_Image *mask_ie, int mask_x, int mask_y);
18EAPI Eina_Bool evas_common_scale_rgba_in_to_out_clip_prepare (Cutout_Rects **reuse, const RGBA_Image *src, const RGBA_Image *dst, RGBA_Draw_Context *dc, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h); 18EAPI Eina_Bool evas_common_scale_rgba_in_to_out_clip_prepare (Cutout_Rects **reuse, const RGBA_Image *src, const RGBA_Image *dst, RGBA_Draw_Context *dc, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h);
19 19
20#endif /* _EVAS_SCALE_MAIN_H */ 20#endif /* _EVAS_SCALE_MAIN_H */
diff --git a/src/lib/evas/common/evas_scale_sample.c b/src/lib/evas/common/evas_scale_sample.c
index f462da5f23..86b02d8e68 100644
--- a/src/lib/evas/common/evas_scale_sample.c
+++ b/src/lib/evas/common/evas_scale_sample.c
@@ -59,15 +59,16 @@ evas_common_scale_rgba_in_to_out_clip_sample_do(const Cutout_Rects *reuse,
59} 59}
60 60
61EAPI void 61EAPI void
62evas_common_scale_rgba_sample_draw(RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h) 62evas_common_scale_rgba_sample_draw(RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h, RGBA_Image *mask_ie, int mask_x, int mask_y)
63{ 63{
64 int x, y; 64 int x, y;
65 int *lin_ptr; 65 int *lin_ptr;
66 DATA32 *buf, *dptr; 66 DATA32 *buf, *dptr;
67 DATA32 **row_ptr; 67 DATA32 **row_ptr;
68 DATA32 *ptr, *dst_ptr, *src_data, *dst_data; 68 DATA32 *ptr, *dst_ptr, *src_data, *dst_data;
69 DATA8 *mask;
69 int src_w, src_h, dst_w, dst_h; 70 int src_w, src_h, dst_w, dst_h;
70 RGBA_Gfx_Func func; 71 RGBA_Gfx_Func func, func2 = NULL;
71 72
72 if ((!src->image.data) || (!dst->image.data)) return; 73 if ((!src->image.data) || (!dst->image.data)) return;
73 if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h, 74 if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h,
@@ -198,21 +199,59 @@ evas_common_scale_rgba_sample_draw(RGBA_Image *src, RGBA_Image *dst, int dst_cli
198 /* figure out dest start ptr */ 199 /* figure out dest start ptr */
199 dst_ptr = dst_data + dst_clip_x + (dst_clip_y * dst_w); 200 dst_ptr = dst_data + dst_clip_x + (dst_clip_y * dst_w);
200 201
201 if (mul_col != 0xffffffff) 202 if (!mask_ie)
202 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, dst_clip_w, render_op); 203 {
204 if (mul_col != 0xffffffff)
205 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, dst_clip_w, render_op);
206 else
207 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, dst_clip_w, render_op);
208 }
203 else 209 else
204 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, dst_clip_w, render_op); 210 {
211 func = evas_common_gfx_func_composite_pixel_mask_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, render_op);
212 if (mul_col != 0xffffffff)
213 func2 = 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, dst_clip_w, render_op);
214 }
205 215
206 if ((dst_region_w == src_region_w) && (dst_region_h == src_region_h)) 216 if ((dst_region_w == src_region_w) && (dst_region_h == src_region_h))
207 { 217 {
208 ptr = src_data + (((dst_clip_y - dst_region_y) + src_region_y) * src_w) + ((dst_clip_x - dst_region_x) + src_region_x); 218 ptr = src_data + (((dst_clip_y - dst_region_y) + src_region_y) * src_w) + ((dst_clip_x - dst_region_x) + src_region_x);
209 for (y = 0; y < dst_clip_h; y++) 219
220 /* image masking */
221 if (mask_ie)
210 { 222 {
211 /* * blend here [clip_w *] ptr -> dst_ptr * */ 223 if (mul_col != 0xffffffff)
212 func(ptr, NULL, mul_col, dst_ptr, dst_clip_w); 224 buf = alloca(dst_clip_w * sizeof(DATA32));
225
226 for (y = 0; y < dst_clip_h; y++)
227 {
228 mask = mask_ie->image.data8
229 + ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
230 + (dst_clip_x - mask_x);
231
232 /* * blend here [clip_w *] ptr -> dst_ptr * */
233 if (mul_col != 0xffffffff)
234 {
235 func2(ptr, NULL, mul_col, buf, dst_clip_w);
236 func(buf, mask, 0, dst_ptr, dst_clip_w);
237 }
238 else
239 func(ptr, mask, 0, dst_ptr, dst_clip_w);
240
241 ptr += src_w;
242 dst_ptr += dst_w;
243 }
244 }
245 else
246 {
247 for (y = 0; y < dst_clip_h; y++)
248 {
249 /* * blend here [clip_w *] ptr -> dst_ptr * */
250 func(ptr, NULL, mul_col, dst_ptr, dst_clip_w);
213 251
214 ptr += src_w; 252 ptr += src_w;
215 dst_ptr += dst_w; 253 dst_ptr += dst_w;
254 }
216 } 255 }
217 } 256 }
218 else 257 else
@@ -234,20 +273,48 @@ evas_common_scale_rgba_sample_draw(RGBA_Image *src, RGBA_Image *dst, int dst_cli
234 /* a scanline buffer */ 273 /* a scanline buffer */
235 buf = alloca(dst_clip_w * sizeof(DATA32)); 274 buf = alloca(dst_clip_w * sizeof(DATA32));
236 275
237 for (y = 0; y < dst_clip_h; y++) 276 /* image masking */
277 if (mask_ie)
238 { 278 {
239 dst_ptr = buf; 279 for (y = 0; y < dst_clip_h; y++)
240
241 for (x = 0; x < dst_clip_w; x++)
242 { 280 {
243 ptr = row_ptr[y] + lin_ptr[x]; 281 dst_ptr = buf;
244 *dst_ptr = *ptr; 282 mask = mask_ie->image.data8
245 dst_ptr++; 283 + ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
284 + (dst_clip_x - mask_x);
285
286 for (x = 0; x < dst_clip_w; x++)
287 {
288 ptr = row_ptr[y] + lin_ptr[x];
289 *dst_ptr = *ptr;
290 dst_ptr++;
291 }
292
293 /* * blend here [clip_w *] buf -> dptr * */
294 if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, dst_clip_w);
295 func(buf, mask, 0, dptr, dst_clip_w);
296
297 dptr += dst_w;
246 } 298 }
247 /* * blend here [clip_w *] buf -> dptr * */ 299 }
248 func(buf, NULL, mul_col, dptr, dst_clip_w); 300 else
301 {
302 for (y = 0; y < dst_clip_h; y++)
303 {
304 dst_ptr = buf;
305
306 for (x = 0; x < dst_clip_w; x++)
307 {
308 ptr = row_ptr[y] + lin_ptr[x];
309 *dst_ptr = *ptr;
310 dst_ptr++;
311 }
312
313 /* * blend here [clip_w *] buf -> dptr * */
314 func(buf, NULL, mul_col, dptr, dst_clip_w);
249 315
250 dptr += dst_w; 316 dptr += dst_w;
317 }
251 } 318 }
252 } 319 }
253} 320}
@@ -265,9 +332,10 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
265 DATA32 *buf, *dptr; 332 DATA32 *buf, *dptr;
266 DATA32 **row_ptr; 333 DATA32 **row_ptr;
267 DATA32 *ptr, *dst_ptr, *src_data, *dst_data; 334 DATA32 *ptr, *dst_ptr, *src_data, *dst_data;
335 DATA8 *mask;
268 int dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h; 336 int dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h;
269 int src_w, src_h, dst_w, dst_h; 337 int src_w, src_h, dst_w, dst_h;
270 RGBA_Gfx_Func func; 338 RGBA_Gfx_Func func, func2 = NULL;
271 339
272 if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h, 0, 0, dst->cache_entry.w, dst->cache_entry.h))) 340 if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h, 0, 0, dst->cache_entry.w, dst->cache_entry.h)))
273 return EINA_FALSE; 341 return EINA_FALSE;
@@ -395,10 +463,19 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
395 /* figure out dest start ptr */ 463 /* figure out dest start ptr */
396 dst_ptr = dst_data + dst_clip_x + (dst_clip_y * dst_w); 464 dst_ptr = dst_data + dst_clip_x + (dst_clip_y * dst_w);
397 465
398 if (dc->mul.use) 466 if (!dc->clip.mask)
399 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, dst_clip_w, dc->render_op); 467 {
468 if (dc->mul.use)
469 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, dst_clip_w, dc->render_op);
470 else
471 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, dst_clip_w, dc->render_op);
472 }
400 else 473 else
401 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, dst_clip_w, dc->render_op); 474 {
475 func = evas_common_gfx_func_composite_pixel_mask_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, dc->render_op);
476 if (dc->mul.use)
477 func2 = 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, dst_clip_w, dc->render_op);
478 }
402 479
403 if ((dst_region_w == src_region_w) && (dst_region_h == src_region_h)) 480 if ((dst_region_w == src_region_w) && (dst_region_h == src_region_h))
404 { 481 {
@@ -427,13 +504,44 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
427#endif 504#endif
428 { 505 {
429 ptr = src_data + ((dst_clip_y - dst_region_y + src_region_y) * src_w) + (dst_clip_x - dst_region_x) + src_region_x; 506 ptr = src_data + ((dst_clip_y - dst_region_y + src_region_y) * src_w) + (dst_clip_x - dst_region_x) + src_region_x;
430 for (y = 0; y < dst_clip_h; y++) 507
508 /* image masking */
509 if (dc->clip.mask)
431 { 510 {
432 /* * blend here [clip_w *] ptr -> dst_ptr * */ 511 RGBA_Image *im = dc->clip.mask;
433 func(ptr, NULL, dc->mul.col, dst_ptr, dst_clip_w);
434 512
435 ptr += src_w; 513 if (dc->mul.use)
436 dst_ptr += dst_w; 514 buf = alloca(dst_clip_w * sizeof(DATA32));
515
516 for (y = 0; y < dst_clip_h; y++)
517 {
518 mask = im->image.data8
519 + ((dst_clip_y - dc->clip.mask_y + y) * im->cache_entry.w)
520 + (dst_clip_x - dc->clip.mask_x);
521
522 /* * blend here [clip_w *] ptr -> dst_ptr * */
523 if (dc->mul.use)
524 {
525 func2(ptr, NULL, dc->mul.col, buf, dst_clip_w);
526 func(buf, mask, 0, dst_ptr, dst_clip_w);
527 }
528 else
529 func(ptr, mask, 0, dst_ptr, dst_clip_w);
530
531 ptr += src_w;
532 dst_ptr += dst_w;
533 }
534 }
535 else
536 {
537 for (y = 0; y < dst_clip_h; y++)
538 {
539 /* * blend here [clip_w *] ptr -> dst_ptr * */
540 func(ptr, NULL, dc->mul.col, dst_ptr, dst_clip_w);
541
542 ptr += src_w;
543 dst_ptr += dst_w;
544 }
437 } 545 }
438 } 546 }
439 } 547 }
@@ -454,7 +562,8 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
454#ifdef DIRECT_SCALE 562#ifdef DIRECT_SCALE
455 if ((!src->cache_entry.flags.alpha) && 563 if ((!src->cache_entry.flags.alpha) &&
456 (!dst->cache_entry.flags.alpha) && 564 (!dst->cache_entry.flags.alpha) &&
457 (!dc->mul.use)) 565 (!dc->mul.use) &&
566 (!dc->clip.mask))
458 { 567 {
459 for (y = 0; y < dst_clip_h; y++) 568 for (y = 0; y < dst_clip_h; y++)
460 { 569 {
@@ -475,19 +584,50 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
475 { 584 {
476 /* a scanline buffer */ 585 /* a scanline buffer */
477 buf = alloca(dst_clip_w * sizeof(DATA32)); 586 buf = alloca(dst_clip_w * sizeof(DATA32));
478 for (y = 0; y < dst_clip_h; y++) 587
588 /* image masking */
589 if (dc->clip.mask)
479 { 590 {
480 dst_ptr = buf; 591 RGBA_Image *im = dc->clip.mask;
481 for (x = 0; x < dst_clip_w; x++) 592
593 for (y = 0; y < dst_clip_h; y++)
482 { 594 {
483 ptr = row_ptr[y] + lin_ptr[x]; 595 dst_ptr = buf;
484 *dst_ptr = *ptr; 596 mask = im->image.data8
485 dst_ptr++; 597 + ((dst_clip_y - dc->clip.mask_y + y) * im->cache_entry.w)
598 + (dst_clip_x - dc->clip.mask_x);
599
600 for (x = 0; x < dst_clip_w; x++)
601 {
602 ptr = row_ptr[y] + lin_ptr[x];
603 *dst_ptr = *ptr;
604 dst_ptr++;
605 }
606
607 /* * blend here [clip_w *] buf -> dptr * */
608 if (dc->mul.use) func2(buf, NULL, dc->mul.col, buf, dst_clip_w);
609 func(buf, mask, 0, dptr, dst_clip_w);
610
611 dptr += dst_w;
612 }
613 }
614 else
615 {
616 for (y = 0; y < dst_clip_h; y++)
617 {
618 dst_ptr = buf;
619 for (x = 0; x < dst_clip_w; x++)
620 {
621 ptr = row_ptr[y] + lin_ptr[x];
622 *dst_ptr = *ptr;
623 dst_ptr++;
624 }
625
626 /* * blend here [clip_w *] buf -> dptr * */
627 func(buf, NULL, dc->mul.col, dptr, dst_clip_w);
628
629 dptr += dst_w;
486 } 630 }
487 /* * blend here [clip_w *] buf -> dptr * */
488 func(buf, NULL, dc->mul.col, dptr, dst_clip_w);
489
490 dptr += dst_w;
491 } 631 }
492 } 632 }
493 } 633 }
diff --git a/src/lib/evas/common/evas_scale_smooth.c b/src/lib/evas/common/evas_scale_smooth.c
index a1957f1e3f..781c13d1df 100644
--- a/src/lib/evas/common/evas_scale_smooth.c
+++ b/src/lib/evas/common/evas_scale_smooth.c
@@ -148,7 +148,8 @@ evas_common_scale_rgba_in_to_out_clip_smooth_mmx(RGBA_Image *src, RGBA_Image *ds
148 clip_x, clip_y, clip_w, clip_h, 148 clip_x, clip_y, clip_w, clip_h,
149 mul_col, dc->render_op, 149 mul_col, dc->render_op,
150 src_region_x, src_region_y, src_region_w, src_region_h, 150 src_region_x, src_region_y, src_region_w, src_region_h,
151 dst_region_x, dst_region_y, dst_region_w, dst_region_h); 151 dst_region_x, dst_region_y, dst_region_w, dst_region_h,
152 dc->clip.mask, dc->clip.mask_x, dc->clip.mask_y);
152 153
153 return EINA_TRUE; 154 return EINA_TRUE;
154} 155}
@@ -188,7 +189,8 @@ evas_common_scale_rgba_in_to_out_clip_smooth_neon(RGBA_Image *src, RGBA_Image *d
188 clip_x, clip_y, clip_w, clip_h, 189 clip_x, clip_y, clip_w, clip_h,
189 mul_col, dc->render_op, 190 mul_col, dc->render_op,
190 src_region_x, src_region_y, src_region_w, src_region_h, 191 src_region_x, src_region_y, src_region_w, src_region_h,
191 dst_region_x, dst_region_y, dst_region_w, dst_region_h); 192 dst_region_x, dst_region_y, dst_region_w, dst_region_h,
193 dc->clip.mask, dc->clip.mask_x, dc->clip.mask_y);
192 194
193 return EINA_TRUE; 195 return EINA_TRUE;
194} 196}
@@ -227,7 +229,8 @@ evas_common_scale_rgba_in_to_out_clip_smooth_c(RGBA_Image *src, RGBA_Image *dst,
227 clip_x, clip_y, clip_w, clip_h, 229 clip_x, clip_y, clip_w, clip_h,
228 mul_col, dc->render_op, 230 mul_col, dc->render_op,
229 src_region_x, src_region_y, src_region_w, src_region_h, 231 src_region_x, src_region_y, src_region_w, src_region_h,
230 dst_region_x, dst_region_y, dst_region_w, dst_region_h); 232 dst_region_x, dst_region_y, dst_region_w, dst_region_h,
233 dc->clip.mask, dc->clip.mask_x, dc->clip.mask_y);
231 234
232 return EINA_TRUE; 235 return EINA_TRUE;
233} 236}
@@ -265,7 +268,7 @@ evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst,
265} 268}
266 269
267EAPI void 270EAPI void
268evas_common_scale_rgba_smooth_draw(RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h) 271evas_common_scale_rgba_smooth_draw(RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h, RGBA_Image *mask_ie, int mask_x, int mask_y)
269{ 272{
270#ifdef BUILD_MMX 273#ifdef BUILD_MMX
271 int mmx, sse, sse2; 274 int mmx, sse, sse2;
@@ -277,7 +280,8 @@ evas_common_scale_rgba_smooth_draw(RGBA_Image *src, RGBA_Image *dst, int dst_cli
277 dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h, 280 dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h,
278 mul_col, render_op, 281 mul_col, render_op,
279 src_region_x, src_region_y, src_region_w, src_region_h, 282 src_region_x, src_region_y, src_region_w, src_region_h,
280 dst_region_x, dst_region_y, dst_region_w, dst_region_h); 283 dst_region_x, dst_region_y, dst_region_w, dst_region_h,
284 mask_ie, mask_x, mask_y);
281 else 285 else
282#endif 286#endif
283#ifdef BUILD_NEON 287#ifdef BUILD_NEON
@@ -287,7 +291,8 @@ evas_common_scale_rgba_smooth_draw(RGBA_Image *src, RGBA_Image *dst, int dst_cli
287 dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h, 291 dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h,
288 mul_col, render_op, 292 mul_col, render_op,
289 src_region_x, src_region_y, src_region_w, src_region_h, 293 src_region_x, src_region_y, src_region_w, src_region_h,
290 dst_region_x, dst_region_y, dst_region_w, dst_region_h); 294 dst_region_x, dst_region_y, dst_region_w, dst_region_h,
295 mask_ie, mask_x, mask_y);
291 else 296 else
292#endif 297#endif
293 _evas_common_scale_rgba_in_to_out_clip_smooth_c 298 _evas_common_scale_rgba_in_to_out_clip_smooth_c
@@ -295,7 +300,8 @@ evas_common_scale_rgba_smooth_draw(RGBA_Image *src, RGBA_Image *dst, int dst_cli
295 dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h, 300 dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h,
296 mul_col, render_op, 301 mul_col, render_op,
297 src_region_x, src_region_y, src_region_w, src_region_h, 302 src_region_x, src_region_y, src_region_w, src_region_h,
298 dst_region_x, dst_region_y, dst_region_w, dst_region_h); 303 dst_region_x, dst_region_y, dst_region_w, dst_region_h,
304 mask_ie, mask_x, mask_y);
299} 305}
300 306
301EAPI void 307EAPI void
diff --git a/src/lib/evas/common/evas_scale_smooth_scaler.c b/src/lib/evas/common/evas_scale_smooth_scaler.c
index 67dd1d6289..0eea1626fc 100644
--- a/src/lib/evas/common/evas_scale_smooth_scaler.c
+++ b/src/lib/evas/common/evas_scale_smooth_scaler.c
@@ -1,5 +1,5 @@
1void 1void
2SCALE_FUNC(RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h) 2SCALE_FUNC(RGBA_Image *src, RGBA_Image *dst, int dst_clip_x, int dst_clip_y, int dst_clip_w, int dst_clip_h, DATA32 mul_col, int render_op, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h, RGBA_Image *mask_ie, int mask_x, int mask_y)
3{ 3{
4 DATA32 *dst_ptr; 4 DATA32 *dst_ptr;
5 int src_w, src_h, dst_w, dst_h; 5 int src_w, src_h, dst_w, dst_h;
diff --git a/src/lib/evas/common/evas_scale_smooth_scaler_down.c b/src/lib/evas/common/evas_scale_smooth_scaler_down.c
index 057e526205..9d0bae3836 100644
--- a/src/lib/evas/common/evas_scale_smooth_scaler_down.c
+++ b/src/lib/evas/common/evas_scale_smooth_scaler_down.c
@@ -5,7 +5,7 @@
5 int *yapoints, *yapp; 5 int *yapoints, *yapp;
6 DATA32 *buf, *src_data; 6 DATA32 *buf, *src_data;
7 7
8 RGBA_Gfx_Func func; 8 RGBA_Gfx_Func func, func2 = NULL;
9 9
10 src_data = src->image.data; 10 src_data = src->image.data;
11 11
@@ -18,10 +18,20 @@
18 /* a scanline buffer */ 18 /* a scanline buffer */
19 buf = alloca(dst_clip_w * sizeof(DATA32)); 19 buf = alloca(dst_clip_w * sizeof(DATA32));
20 20
21 if (mul_col != 0xffffffff) 21 if (!mask_ie)
22 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, dst_clip_w, render_op); 22 {
23 if (mul_col != 0xffffffff)
24 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, dst_clip_w, render_op);
25 else
26 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, dst_clip_w, render_op);
27 }
23 else 28 else
24 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, dst_clip_w, render_op); 29 {
30 func = evas_common_gfx_func_composite_pixel_mask_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, render_op);
31 if (mul_col != 0xffffffff)
32 func2 = 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, dst_clip_w, render_op);
33 }
34
25 /* scaling down vertically */ 35 /* scaling down vertically */
26 if ((dst_region_w >= src_region_w) && 36 if ((dst_region_w >= src_region_w) &&
27 (dst_region_h < src_region_h)) 37 (dst_region_h < src_region_h))
diff --git a/src/lib/evas/common/evas_scale_smooth_scaler_downx.c b/src/lib/evas/common/evas_scale_smooth_scaler_downx.c
index 6ef45e5f35..a73731e1a1 100644
--- a/src/lib/evas/common/evas_scale_smooth_scaler_downx.c
+++ b/src/lib/evas/common/evas_scale_smooth_scaler_downx.c
@@ -1,10 +1,12 @@
1{ 1{
2 int Cx, j; 2 int Cx, j;
3 DATA32 *pix, *dptr, *pbuf, **yp; 3 DATA32 *pix, *dptr, *pbuf, **yp;
4 DATA8 *mask;
4 int r, g, b, a, rr, gg, bb, aa; 5 int r, g, b, a, rr, gg, bb, aa;
5 int *xp, xap, yap, pos; 6 int *xp, xap, yap, pos;
6 //int dyy, dxx; 7 //int dyy, dxx;
7 int w = dst_clip_w; 8 int w = dst_clip_w;
9 int y;
8 10
9 dptr = dst_ptr; 11 dptr = dst_ptr;
10 pos = (src_region_y * src_w) + src_region_x; 12 pos = (src_region_y * src_w) + src_region_x;
@@ -19,6 +21,7 @@
19 21
20 if (src->cache_entry.flags.alpha) 22 if (src->cache_entry.flags.alpha)
21 { 23 {
24 y = 0;
22 while (dst_clip_h--) 25 while (dst_clip_h--)
23 { 26 {
24 while (dst_clip_w--) 27 while (dst_clip_w--)
@@ -82,7 +85,18 @@
82 xp++; xapp++; 85 xp++; xapp++;
83 } 86 }
84 87
85 func(buf, NULL, mul_col, dptr, w); 88 if (!mask_ie)
89 func(buf, NULL, mul_col, dptr, w);
90 else
91 {
92 mask = mask_ie->image.data8
93 + ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
94 + (dst_clip_x - mask_x);
95
96 if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, w);
97 func(buf, mask, 0, dptr, w);
98 }
99 y++;
86 100
87 pbuf = buf; 101 pbuf = buf;
88 dptr += dst_w; dst_clip_w = w; 102 dptr += dst_w; dst_clip_w = w;
@@ -95,8 +109,9 @@
95 { 109 {
96#ifdef DIRECT_SCALE 110#ifdef DIRECT_SCALE
97 if ((!src->cache_entry.flags.alpha) && 111 if ((!src->cache_entry.flags.alpha) &&
98 (!dst->cache_entry.flags.alpha) && 112 (!dst->cache_entry.flags.alpha) &&
99 (mul_col == 0xffffffff)) 113 (mul_col == 0xffffffff) &&
114 (!mask_ie))
100 { 115 {
101 while (dst_clip_h--) 116 while (dst_clip_h--)
102 { 117 {
@@ -165,6 +180,7 @@
165 else 180 else
166#endif 181#endif
167 { 182 {
183 y = 0;
168 while (dst_clip_h--) 184 while (dst_clip_h--)
169 { 185 {
170 while (dst_clip_w--) 186 while (dst_clip_w--)
@@ -221,7 +237,18 @@
221 xp++; xapp++; 237 xp++; xapp++;
222 } 238 }
223 239
224 func(buf, NULL, mul_col, dptr, w); 240 if (!mask_ie)
241 func(buf, NULL, mul_col, dptr, w);
242 else
243 {
244 mask = mask_ie->image.data8
245 + ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
246 + (dst_clip_x - mask_x);
247
248 if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, w);
249 func(buf, mask, 0, dptr, w);
250 }
251 y++;
225 252
226 pbuf = buf; 253 pbuf = buf;
227 dptr += dst_w; dst_clip_w = w; 254 dptr += dst_w; dst_clip_w = w;
diff --git a/src/lib/evas/common/evas_scale_smooth_scaler_downx_downy.c b/src/lib/evas/common/evas_scale_smooth_scaler_downx_downy.c
index d186ce1e2b..84fed3faf3 100644
--- a/src/lib/evas/common/evas_scale_smooth_scaler_downx_downy.c
+++ b/src/lib/evas/common/evas_scale_smooth_scaler_downx_downy.c
@@ -1,8 +1,10 @@
1{ 1{
2 int Cx, Cy, i, j; 2 int Cx, Cy, i, j;
3 DATA32 *dptr, *sptr, *pix, *pbuf; 3 DATA32 *dptr, *sptr, *pix, *pbuf;
4 DATA8 *mask;
4 int a, r, g, b, rx, gx, bx, ax; 5 int a, r, g, b, rx, gx, bx, ax;
5 int xap, yap, pos; 6 int xap, yap, pos;
7 int y;
6 //int dyy, dxx; 8 //int dyy, dxx;
7 9
8 DATA32 **yp; 10 DATA32 **yp;
@@ -24,6 +26,7 @@
24#if 1 26#if 1
25 if (src->cache_entry.flags.alpha) 27 if (src->cache_entry.flags.alpha)
26 { 28 {
29 y = 0;
27 while (dst_clip_h--) 30 while (dst_clip_h--)
28 { 31 {
29 Cy = *yapp >> 16; 32 Cy = *yapp >> 16;
@@ -131,7 +134,18 @@
131 xp++; xapp++; 134 xp++; xapp++;
132 } 135 }
133 136
134 func(buf, NULL, mul_col, dptr, w); 137 if (!mask_ie)
138 func(buf, NULL, mul_col, dptr, w);
139 else
140 {
141 mask = mask_ie->image.data8
142 + ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
143 + (dst_clip_x - mask_x);
144
145 if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, w);
146 func(buf, mask, 0, dptr, w);
147 }
148 y++;
135 149
136 pbuf = buf; 150 pbuf = buf;
137 dptr += dst_w; dst_clip_w = w; 151 dptr += dst_w; dst_clip_w = w;
@@ -144,8 +158,9 @@
144 { 158 {
145#ifdef DIRECT_SCALE 159#ifdef DIRECT_SCALE
146 if ((!src->cache_entry.flags.alpha) && 160 if ((!src->cache_entry.flags.alpha) &&
147 (!dst->cache_entry.flags.alpha) && 161 (!dst->cache_entry.flags.alpha) &&
148 (mul_col == 0xffffffff)) 162 (mul_col == 0xffffffff) &&
163 (!mask_ie))
149 { 164 {
150 while (dst_clip_h--) 165 while (dst_clip_h--)
151 { 166 {
@@ -252,6 +267,7 @@
252 else 267 else
253#endif 268#endif
254 { 269 {
270 y = 0;
255 while (dst_clip_h--) 271 while (dst_clip_h--)
256 { 272 {
257 Cy = *yapp >> 16; 273 Cy = *yapp >> 16;
@@ -347,7 +363,18 @@
347 xp++; xapp++; 363 xp++; xapp++;
348 } 364 }
349 365
350 func(buf, NULL, mul_col, dptr, w); 366 if (!mask_ie)
367 func(buf, NULL, mul_col, dptr, w);
368 else
369 {
370 mask = mask_ie->image.data8
371 + ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
372 + (dst_clip_x - mask_x);
373
374 if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, w);
375 func(buf, mask, 0, dptr, w);
376 }
377 y++;
351 378
352 pbuf = buf; 379 pbuf = buf;
353 dptr += dst_w; dst_clip_w = w; 380 dptr += dst_w; dst_clip_w = w;
diff --git a/src/lib/evas/common/evas_scale_smooth_scaler_downy.c b/src/lib/evas/common/evas_scale_smooth_scaler_downy.c
index 7e1c741f2e..733c2a41ba 100644
--- a/src/lib/evas/common/evas_scale_smooth_scaler_downy.c
+++ b/src/lib/evas/common/evas_scale_smooth_scaler_downy.c
@@ -1,10 +1,12 @@
1{ 1{
2 int Cy, j; 2 int Cy, j;
3 DATA32 *dptr, *pix, *pbuf, **yp; 3 DATA32 *dptr, *pix, *pbuf, **yp;
4 DATA8 *mask;
4 int r, g, b, a, rr, gg, bb, aa; 5 int r, g, b, a, rr, gg, bb, aa;
5 int *xp, xap, yap, pos; 6 int *xp, xap, yap, pos;
6 //int dyy, dxx; 7 //int dyy, dxx;
7 int w = dst_clip_w; 8 int w = dst_clip_w;
9 int y;
8 10
9 dptr = dst_ptr; 11 dptr = dst_ptr;
10 pos = (src_region_y * src_w) + src_region_x; 12 pos = (src_region_y * src_w) + src_region_x;
@@ -19,6 +21,7 @@
19 21
20 if (src->cache_entry.flags.alpha) 22 if (src->cache_entry.flags.alpha)
21 { 23 {
24 y = 0;
22 while (dst_clip_h--) 25 while (dst_clip_h--)
23 { 26 {
24 Cy = *yapp >> 16; 27 Cy = *yapp >> 16;
@@ -83,7 +86,18 @@
83 xp++; xapp++; 86 xp++; xapp++;
84 } 87 }
85 88
86 func(buf, NULL, mul_col, dptr, w); 89 if (!mask_ie)
90 func(buf, NULL, mul_col, dptr, w);
91 else
92 {
93 mask = mask_ie->image.data8
94 + ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
95 + (dst_clip_x - mask_x);
96
97 if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, w);
98 func(buf, mask, 0, dptr, w);
99 }
100 y++;
87 101
88 pbuf = buf; 102 pbuf = buf;
89 dptr += dst_w; dst_clip_w = w; 103 dptr += dst_w; dst_clip_w = w;
@@ -96,8 +110,9 @@
96 { 110 {
97#ifdef DIRECT_SCALE 111#ifdef DIRECT_SCALE
98 if ((!src->cache_entry.flags.alpha) && 112 if ((!src->cache_entry.flags.alpha) &&
99 (!dst->cache_entry.flags.alpha) && 113 (!dst->cache_entry.flags.alpha) &&
100 (mul_col == 0xffffffff)) 114 (mul_col == 0xffffffff) &&
115 (!mask_ie))
101 { 116 {
102 while (dst_clip_h--) 117 while (dst_clip_h--)
103 { 118 {
@@ -166,6 +181,7 @@
166 else 181 else
167#endif 182#endif
168 { 183 {
184 y = 0;
169 while (dst_clip_h--) 185 while (dst_clip_h--)
170 { 186 {
171 Cy = *yapp >> 16; 187 Cy = *yapp >> 16;
@@ -223,7 +239,18 @@
223 xp++; xapp++; 239 xp++; xapp++;
224 } 240 }
225 241
226 func(buf, NULL, mul_col, dptr, w); 242 if (!mask_ie)
243 func(buf, NULL, mul_col, dptr, w);
244 else
245 {
246 mask = mask_ie->image.data8
247 + ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
248 + (dst_clip_x - mask_x);
249
250 if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, w);
251 func(buf, mask, 0, dptr, w);
252 }
253 y++;
227 254
228 pbuf = buf; 255 pbuf = buf;
229 dptr += dst_w; dst_clip_w = w; 256 dptr += dst_w; dst_clip_w = w;
diff --git a/src/lib/evas/common/evas_scale_smooth_scaler_up.c b/src/lib/evas/common/evas_scale_smooth_scaler_up.c
index 44bfbfa12d..56060f8a07 100644
--- a/src/lib/evas/common/evas_scale_smooth_scaler_up.c
+++ b/src/lib/evas/common/evas_scale_smooth_scaler_up.c
@@ -10,7 +10,8 @@
10 10
11 DATA32 *psrc, *pdst, *pdst_end; 11 DATA32 *psrc, *pdst, *pdst_end;
12 DATA32 *buf, *pbuf, *pbuf_end; 12 DATA32 *buf, *pbuf, *pbuf_end;
13 RGBA_Gfx_Func func = NULL; 13 DATA8 *mask;
14 RGBA_Gfx_Func func = NULL, func2 = NULL;
14 15
15 /* check value to make overflow(only check value related with overflow) */ 16 /* check value to make overflow(only check value related with overflow) */
16 if ((src_region_w > SCALE_SIZE_MAX) || 17 if ((src_region_w > SCALE_SIZE_MAX) ||
@@ -19,7 +20,7 @@
19 /* a scanline buffer */ 20 /* a scanline buffer */
20 pdst = dst_ptr; // it's been set at (dst_clip_x, dst_clip_y) 21 pdst = dst_ptr; // it's been set at (dst_clip_x, dst_clip_y)
21 pdst_end = pdst + (dst_clip_h * dst_w); 22 pdst_end = pdst + (dst_clip_h * dst_w);
22 if (mul_col == 0xffffffff) 23 if (mul_col == 0xffffffff && !mask_ie)
23 { 24 {
24 if ((render_op == _EVAS_RENDER_BLEND) && !src->cache_entry.flags.alpha) 25 if ((render_op == _EVAS_RENDER_BLEND) && !src->cache_entry.flags.alpha)
25 { direct_scale = 1; buf_step = dst->cache_entry.w; } 26 { direct_scale = 1; buf_step = dst->cache_entry.w; }
@@ -33,10 +34,19 @@
33 if (!direct_scale) 34 if (!direct_scale)
34 { 35 {
35 buf = alloca(dst_clip_w * sizeof(DATA32)); 36 buf = alloca(dst_clip_w * sizeof(DATA32));
36 if (mul_col != 0xffffffff) 37 if (!mask_ie)
37 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, dst_clip_w, render_op); 38 {
38 else 39 if (mul_col != 0xffffffff)
39 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, dst_clip_w, render_op); 40 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, dst_clip_w, render_op);
41 else
42 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, dst_clip_w, render_op);
43 }
44 else
45 {
46 func = evas_common_gfx_func_composite_pixel_mask_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, render_op);
47 if (mul_col != 0xffffffff)
48 func2 = 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, dst_clip_w, render_op);
49 }
40 } 50 }
41 else 51 else
42 buf = pdst; 52 buf = pdst;
@@ -61,6 +71,7 @@
61 if (drh == srh) 71 if (drh == srh)
62 { 72 {
63 int sxx0 = sxx; 73 int sxx0 = sxx;
74 int y = 0;
64 psrc = src->image.data + (src_w * (sry + cy)) + srx; 75 psrc = src->image.data + (src_w * (sry + cy)) + srx;
65 while (pdst < pdst_end) 76 while (pdst < pdst_end)
66 { 77 {
@@ -99,7 +110,20 @@
99 } 110 }
100 /* * blend here [clip_w *] buf -> dptr * */ 111 /* * blend here [clip_w *] buf -> dptr * */
101 if (!direct_scale) 112 if (!direct_scale)
102 func(buf, NULL, mul_col, pdst, dst_clip_w); 113 {
114 if (!mask_ie)
115 func(buf, NULL, mul_col, pdst, dst_clip_w);
116 else
117 {
118 mask = mask_ie->image.data8
119 + ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
120 + (dst_clip_x - mask_x);
121
122 if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, dst_clip_w);
123 func(buf, mask, 0, pdst, dst_clip_w);
124 }
125 y++;
126 }
103 127
104 pdst += dst_w; 128 pdst += dst_w;
105 psrc += src_w; 129 psrc += src_w;
@@ -111,6 +135,7 @@
111 else if (drw == srw) 135 else if (drw == srw)
112 { 136 {
113 DATA32 *ps = src->image.data + (src_w * sry) + srx + cx; 137 DATA32 *ps = src->image.data + (src_w * sry) + srx + cx;
138 int y = 0;
114 139
115 while (pdst < pdst_end) 140 while (pdst < pdst_end)
116 { 141 {
@@ -149,7 +174,20 @@
149 } 174 }
150 /* * blend here [clip_w *] buf -> dptr * */ 175 /* * blend here [clip_w *] buf -> dptr * */
151 if (!direct_scale) 176 if (!direct_scale)
152 func(buf, NULL, mul_col, pdst, dst_clip_w); 177 {
178 if (!mask_ie)
179 func(buf, NULL, mul_col, pdst, dst_clip_w);
180 else
181 {
182 mask = mask_ie->image.data8
183 + ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
184 + (dst_clip_x - mask_x);
185
186 if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, dst_clip_w);
187 func(buf, mask, 0, pdst, dst_clip_w);
188 }
189 y++;
190 }
153 pdst += dst_w; 191 pdst += dst_w;
154 syy += dsyy; 192 syy += dsyy;
155 buf += buf_step; 193 buf += buf_step;
@@ -160,6 +198,7 @@
160 { 198 {
161 DATA32 *ps = src->image.data + (src_w * sry) + srx; 199 DATA32 *ps = src->image.data + (src_w * sry) + srx;
162 int sxx0 = sxx; 200 int sxx0 = sxx;
201 int y = 0;
163 202
164 while (pdst < pdst_end) 203 while (pdst < pdst_end)
165 { 204 {
@@ -277,7 +316,20 @@
277 } 316 }
278 /* * blend here [clip_w *] buf -> dptr * */ 317 /* * blend here [clip_w *] buf -> dptr * */
279 if (!direct_scale) 318 if (!direct_scale)
280 func(buf, NULL, mul_col, pdst, dst_clip_w); 319 {
320 if (!mask_ie)
321 func(buf, NULL, mul_col, pdst, dst_clip_w);
322 else
323 {
324 mask = mask_ie->image.data8
325 + ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
326 + (dst_clip_x - mask_x);
327
328 if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, dst_clip_w);
329 func(buf, mask, 0, pdst, dst_clip_w);
330 }
331 y++;
332 }
281 333
282 pdst += dst_w; 334 pdst += dst_w;
283 syy += dsyy; 335 syy += dsyy;
diff --git a/src/lib/evas/include/evas_common_private.h b/src/lib/evas/include/evas_common_private.h
index e9a25f474c..8f01bf0536 100644
--- a/src/lib/evas/include/evas_common_private.h
+++ b/src/lib/evas/include/evas_common_private.h
@@ -700,6 +700,8 @@ struct _RGBA_Draw_Context
700 } col; 700 } col;
701 struct RGBA_Draw_Context_clip { 701 struct RGBA_Draw_Context_clip {
702 int x, y, w, h; 702 int x, y, w, h;
703 void *mask;
704 int mask_x, mask_y;
703 Eina_Bool use : 1; 705 Eina_Bool use : 1;
704 } clip; 706 } clip;
705 Cutout_Rects cutout; 707 Cutout_Rects cutout;
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index ac9e086b0d..673924c50e 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -296,6 +296,8 @@ struct _Evas_Thread_Command_Rect
296 DATA32 color; 296 DATA32 color;
297 int render_op; 297 int render_op;
298 int x, y, w, h; 298 int x, y, w, h;
299 void *mask;
300 int mask_x, mask_y;
299}; 301};
300 302
301struct _Evas_Thread_Command_Line 303struct _Evas_Thread_Command_Line
@@ -327,6 +329,8 @@ struct _Evas_Thread_Command_Image
327 DATA32 mul_col; 329 DATA32 mul_col;
328 int render_op; 330 int render_op;
329 int smooth; 331 int smooth;
332 void *mask;
333 int mask_x, mask_y;
330}; 334};
331 335
332struct _Evas_Thread_Command_Font 336struct _Evas_Thread_Command_Font
@@ -341,9 +345,11 @@ struct _Evas_Thread_Command_Font
341 void *gl_draw; 345 void *gl_draw;
342 void *font_ext_data; 346 void *font_ext_data;
343 DATA32 col; 347 DATA32 col;
344 Eina_Bool clip_use : 1;
345 Eina_Rectangle clip_rect, ext; 348 Eina_Rectangle clip_rect, ext;
346 int im_w, im_h; 349 int im_w, im_h;
350 void *mask;
351 int mask_x, mask_y;
352 Eina_Bool clip_use : 1;
347}; 353};
348 354
349struct _Evas_Thread_Command_Map 355struct _Evas_Thread_Command_Map
@@ -525,7 +531,8 @@ _draw_thread_rectangle_draw(void *data)
525 531
526 evas_common_rectangle_rgba_draw(rect->surface, 532 evas_common_rectangle_rgba_draw(rect->surface,
527 rect->color, rect->render_op, 533 rect->color, rect->render_op,
528 rect->x, rect->y, rect->w, rect->h); 534 rect->x, rect->y, rect->w, rect->h,
535 rect->mask, rect->mask_x, rect->mask_y);
529 536
530 eina_mempool_free(_mp_command_rect, rect); 537 eina_mempool_free(_mp_command_rect, rect);
531} 538}
@@ -548,6 +555,9 @@ _draw_rectangle_thread_cmd(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y,
548 cr->y = y; 555 cr->y = y;
549 cr->w = w; 556 cr->w = w;
550 cr->h = h; 557 cr->h = h;
558 cr->mask = dc->clip.mask;
559 cr->mask_x = dc->clip.mask_x;
560 cr->mask_y = dc->clip.mask_y;
551 561
552 evas_thread_cmd_enqueue(_draw_thread_rectangle_draw, cr); 562 evas_thread_cmd_enqueue(_draw_thread_rectangle_draw, cr);
553} 563}
@@ -1239,14 +1249,16 @@ _draw_thread_image_draw(void *data)
1239 image->clip.x, image->clip.y, image->clip.w, image->clip.h, 1249 image->clip.x, image->clip.y, image->clip.w, image->clip.h,
1240 image->mul_col, image->render_op, 1250 image->mul_col, image->render_op,
1241 image->src.x, image->src.y, image->src.w, image->src.h, 1251 image->src.x, image->src.y, image->src.w, image->src.h,
1242 image->dst.x, image->dst.y, image->dst.w, image->dst.h); 1252 image->dst.x, image->dst.y, image->dst.w, image->dst.h,
1253 image->mask, image->mask_x, image->mask_y);
1243 else 1254 else
1244 evas_common_scale_rgba_sample_draw 1255 evas_common_scale_rgba_sample_draw
1245 (image->image, image->surface, 1256 (image->image, image->surface,
1246 image->clip.x, image->clip.y, image->clip.w, image->clip.h, 1257 image->clip.x, image->clip.y, image->clip.w, image->clip.h,
1247 image->mul_col, image->render_op, 1258 image->mul_col, image->render_op,
1248 image->src.x, image->src.y, image->src.w, image->src.h, 1259 image->src.x, image->src.y, image->src.w, image->src.h,
1249 image->dst.x, image->dst.y, image->dst.w, image->dst.h); 1260 image->dst.x, image->dst.y, image->dst.w, image->dst.h,
1261 image->mask, image->mask_x, image->mask_y);
1250 1262
1251 eina_mempool_free(_mp_command_image, image); 1263 eina_mempool_free(_mp_command_image, image);
1252} 1264}
@@ -1289,6 +1301,9 @@ _image_draw_thread_cmd(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc,
1289 cr->mul_col = dc->mul.use ? dc->mul.col : 0xffffffff; 1301 cr->mul_col = dc->mul.use ? dc->mul.col : 0xffffffff;
1290 cr->render_op = dc->render_op; 1302 cr->render_op = dc->render_op;
1291 cr->smooth = smooth; 1303 cr->smooth = smooth;
1304 cr->mask = dc->clip.mask;
1305 cr->mask_x = dc->clip.mask_x;
1306 cr->mask_y = dc->clip.mask_y;
1292 1307
1293 evas_thread_cmd_enqueue(_draw_thread_image_draw, cr); 1308 evas_thread_cmd_enqueue(_draw_thread_image_draw, cr);
1294 1309
@@ -1429,13 +1444,15 @@ _map_image_draw(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src
1429 clip_x, clip_y, clip_w, clip_h, 1444 clip_x, clip_y, clip_w, clip_h,
1430 mul_col, dc->render_op, 1445 mul_col, dc->render_op,
1431 src_x, src_y, src_w, src_h, 1446 src_x, src_y, src_w, src_h,
1432 dst_x, dst_y, dst_w, dst_h); 1447 dst_x, dst_y, dst_w, dst_h,
1448 dc->clip.mask, dc->clip.mask_x, dc->clip.mask_y);
1433 else 1449 else
1434 evas_common_scale_rgba_sample_draw(src, dst, 1450 evas_common_scale_rgba_sample_draw(src, dst,
1435 clip_x, clip_y, clip_w, clip_h, 1451 clip_x, clip_y, clip_w, clip_h,
1436 mul_col, dc->render_op, 1452 mul_col, dc->render_op,
1437 src_x, src_y, src_w, src_h, 1453 src_x, src_y, src_w, src_h,
1438 dst_x, dst_y, dst_w, dst_h); 1454 dst_x, dst_y, dst_w, dst_h,
1455 dc->clip.mask, dc->clip.mask_x, dc->clip.mask_y);
1439} 1456}
1440 1457
1441static Eina_Bool 1458static Eina_Bool
@@ -2152,6 +2169,9 @@ _draw_thread_font_draw(void *data)
2152 dc.clip.y = font->clip_rect.y; 2169 dc.clip.y = font->clip_rect.y;
2153 dc.clip.w = font->clip_rect.w; 2170 dc.clip.w = font->clip_rect.w;
2154 dc.clip.h = font->clip_rect.h; 2171 dc.clip.h = font->clip_rect.h;
2172 dc.clip.mask = font->mask;
2173 dc.clip.mask_x = font->mask_x;
2174 dc.clip.mask_y = font->mask_y;
2155 2175
2156 evas_common_font_rgba_draw 2176 evas_common_font_rgba_draw
2157 (font->dst, &dc, 2177 (font->dst, &dc,
@@ -2186,6 +2206,9 @@ _font_draw_thread_cmd(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas
2186 EINA_RECTANGLE_SET(&cf->ext, ext_x, ext_y, ext_w, ext_h); 2206 EINA_RECTANGLE_SET(&cf->ext, ext_x, ext_y, ext_w, ext_h);
2187 cf->im_w = im_w; 2207 cf->im_w = im_w;
2188 cf->im_h = im_h; 2208 cf->im_h = im_h;
2209 cf->mask = dc->clip.mask;
2210 cf->mask_x = dc->clip.mask_x;
2211 cf->mask_y = dc->clip.mask_y;
2189 2212
2190 evas_thread_cmd_enqueue(_draw_thread_font_draw, cf); 2213 evas_thread_cmd_enqueue(_draw_thread_font_draw, cf);
2191 2214