summaryrefslogtreecommitdiff
path: root/src/lib/evas/common/evas_scale_smooth_scaler_up.c
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>2015-01-07 15:06:02 +0900
commit9af60b1b04a877c70f78ced137a6886b403b25f6 (patch)
treed8144f050622330aa65b7b7f0e4cf597a90b20eb /src/lib/evas/common/evas_scale_smooth_scaler_up.c
parenta86f799542b8663a5a5e2f02ebc6b77efecdb29f (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>
Diffstat (limited to '')
-rw-r--r--src/lib/evas/common/evas_scale_smooth_scaler_up.c70
1 files changed, 61 insertions, 9 deletions
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;