summaryrefslogtreecommitdiff
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>2014-12-22 22:33:11 +0900
commit0fc0e0ec9cc145c76c695a99fe7703ffbfea4d4f (patch)
tree8ddebb9df77861c1dbebd364dd11b70d5a2ba4c0
parentdcfce03791889e71fdef283e60cb1d874b9511c9 (diff)
Evas masking: Implement support for map draw (SW)
-rw-r--r--src/lib/evas/common/evas_map_image.c20
-rw-r--r--src/lib/evas/common/evas_map_image.h2
-rw-r--r--src/lib/evas/common/evas_map_image_core.c22
-rw-r--r--src/lib/evas/common/evas_map_image_internal.c62
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c9
5 files changed, 88 insertions, 27 deletions
diff --git a/src/lib/evas/common/evas_map_image.c b/src/lib/evas/common/evas_map_image.c
index 05ad32acfb..cec21f6480 100644
--- a/src/lib/evas/common/evas_map_image.c
+++ b/src/lib/evas/common/evas_map_image.c
@@ -675,7 +675,8 @@ void evas_common_map_rgba_internal_mmx(RGBA_Image *src, RGBA_Image *dst, RGBA_Dr
675 _evas_common_map_rgba_internal_mmx(src, dst, 675 _evas_common_map_rgba_internal_mmx(src, dst,
676 clip_x, clip_y, clip_w, clip_h, 676 clip_x, clip_y, clip_w, clip_h,
677 mul_col, dc->render_op, 677 mul_col, dc->render_op,
678 p, smooth, dc->anti_alias, level); 678 p, smooth, dc->anti_alias, level,
679 dc->clip.mask, dc->clip.mask_x, dc->clip.mask_y);
679} 680}
680#endif 681#endif
681 682
@@ -703,7 +704,8 @@ void evas_common_map_rgba_internal(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_C
703 _evas_common_map_rgba_internal(src, dst, 704 _evas_common_map_rgba_internal(src, dst,
704 clip_x, clip_y, clip_w, clip_h, 705 clip_x, clip_y, clip_w, clip_h,
705 mul_col, dc->render_op, 706 mul_col, dc->render_op,
706 p, smooth, dc->anti_alias, level); 707 p, smooth, dc->anti_alias, level,
708 dc->clip.mask, dc->clip.mask_x, dc->clip.mask_y);
707} 709}
708 710
709#ifdef BUILD_NEON 711#ifdef BUILD_NEON
@@ -731,7 +733,8 @@ void evas_common_map_rgba_internal_neon(RGBA_Image *src, RGBA_Image *dst, RGBA_D
731 _evas_common_map_rgba_internal_neon(src, dst, 733 _evas_common_map_rgba_internal_neon(src, dst,
732 clip_x, clip_y, clip_w, clip_h, 734 clip_x, clip_y, clip_w, clip_h,
733 mul_col, dc->render_op, 735 mul_col, dc->render_op,
734 p, smooth, dc->anti_alias, level); 736 p, smooth, dc->anti_alias, level,
737 dc->clip.mask, dc->clip.mask_x, dc->clip.mask_y);
735} 738}
736#endif 739#endif
737 740
@@ -863,7 +866,7 @@ evas_common_map_rgba(RGBA_Image *src, RGBA_Image *dst,
863} 866}
864 867
865EAPI void 868EAPI void
866evas_common_map_rgba_draw(RGBA_Image *src, RGBA_Image *dst, int clip_x, int clip_y, int clip_w, int clip_h, DATA32 mul_col, int render_op, int npoints EINA_UNUSED, RGBA_Map_Point *p, int smooth, Eina_Bool anti_alias, int level) 869evas_common_map_rgba_draw(RGBA_Image *src, RGBA_Image *dst, int clip_x, int clip_y, int clip_w, int clip_h, DATA32 mul_col, int render_op, int npoints EINA_UNUSED, RGBA_Map_Point *p, int smooth, Eina_Bool anti_alias, int level, RGBA_Image *mask_ie, int mask_x, int mask_y)
867{ 870{
868#ifdef BUILD_MMX 871#ifdef BUILD_MMX
869 int mmx, sse, sse2; 872 int mmx, sse, sse2;
@@ -873,7 +876,8 @@ evas_common_map_rgba_draw(RGBA_Image *src, RGBA_Image *dst, int clip_x, int clip
873 _evas_common_map_rgba_internal_mmx(src, dst, 876 _evas_common_map_rgba_internal_mmx(src, dst,
874 clip_x, clip_y, clip_w, clip_h, 877 clip_x, clip_y, clip_w, clip_h,
875 mul_col, render_op, 878 mul_col, render_op,
876 p, smooth, anti_alias, level); 879 p, smooth, anti_alias, level,
880 mask_ie, mask_x, mask_y);
877 else 881 else
878#endif 882#endif
879#ifdef BUILD_NEON 883#ifdef BUILD_NEON
@@ -881,13 +885,15 @@ evas_common_map_rgba_draw(RGBA_Image *src, RGBA_Image *dst, int clip_x, int clip
881 _evas_common_map_rgba_internal_neon(src, dst, 885 _evas_common_map_rgba_internal_neon(src, dst,
882 clip_x, clip_y, clip_w, clip_h, 886 clip_x, clip_y, clip_w, clip_h,
883 mul_col, render_op, 887 mul_col, render_op,
884 p, smooth, anti_alias, level); 888 p, smooth, anti_alias, level,
889 mask_ie, mask_x, mask_y);
885 else 890 else
886#endif 891#endif
887 _evas_common_map_rgba_internal(src, dst, 892 _evas_common_map_rgba_internal(src, dst,
888 clip_x, clip_y, clip_w, clip_h, 893 clip_x, clip_y, clip_w, clip_h,
889 mul_col, render_op, 894 mul_col, render_op,
890 p, smooth, anti_alias, level); 895 p, smooth, anti_alias, level,
896 mask_ie, mask_x, mask_y);
891} 897}
892 898
893EAPI void 899EAPI void
diff --git a/src/lib/evas/common/evas_map_image.h b/src/lib/evas/common/evas_map_image.h
index ff83650fe9..2bca78b0a2 100644
--- a/src/lib/evas/common/evas_map_image.h
+++ b/src/lib/evas/common/evas_map_image.h
@@ -19,7 +19,7 @@ evas_common_map_rgba(RGBA_Image *src, RGBA_Image *dst,
19 int npoints, RGBA_Map_Point *points, 19 int npoints, RGBA_Map_Point *points,
20 int smooth, int level); 20 int smooth, int level);
21 21
22EAPI void evas_common_map_rgba_draw(RGBA_Image *src, RGBA_Image *dst, int clip_x, int clip_y, int clip_w, int clip_h, DATA32 mul_col, int render_op, int npoints, RGBA_Map_Point *p, int smooth, Eina_Bool anti_alias, int level); 22EAPI void evas_common_map_rgba_draw(RGBA_Image *src, RGBA_Image *dst, int clip_x, int clip_y, int clip_w, int clip_h, DATA32 mul_col, int render_op, int npoints, RGBA_Map_Point *p, int smooth, Eina_Bool anti_alias, int level, RGBA_Image *mask_ie, int mask_x, int mask_y);
23 23
24EAPI Eina_Bool 24EAPI Eina_Bool
25evas_common_map_rgba_prepare(RGBA_Image *src, RGBA_Image *dst, 25evas_common_map_rgba_prepare(RGBA_Image *src, RGBA_Image *dst,
diff --git a/src/lib/evas/common/evas_map_image_core.c b/src/lib/evas/common/evas_map_image_core.c
index d514612998..14c46aa141 100644
--- a/src/lib/evas/common/evas_map_image_core.c
+++ b/src/lib/evas/common/evas_map_image_core.c
@@ -117,7 +117,16 @@
117 { 117 {
118 d = dst->image.data; 118 d = dst->image.data;
119 d += (y * dst->cache_entry.w) + x; 119 d += (y * dst->cache_entry.w) + x;
120 func(buf, NULL, mul_col, d, w); 120 if (!mask_ie)
121 func(buf, NULL, mul_col, d, w);
122 else
123 {
124 DATA8 *mask = mask_ie->image.data8
125 + (y - mask_y) * mask_ie->cache_entry.w
126 + (x - mask_x);
127 if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, w);
128 func(buf, mask, 0, d, w);
129 }
121 } 130 }
122 } 131 }
123 } 132 }
@@ -226,7 +235,16 @@
226 { 235 {
227 d = dst->image.data; 236 d = dst->image.data;
228 d += (y * dst->cache_entry.w) + x; 237 d += (y * dst->cache_entry.w) + x;
229 func(buf, NULL, mul_col, d, w); 238 if (!mask_ie)
239 func(buf, NULL, mul_col, d, w);
240 else
241 {
242 DATA8 *mask = mask_ie->image.data8
243 + (y - mask_y) * mask_ie->cache_entry.w
244 + (x - mask_x);
245 if (mul_col != 0xffffffff) func2(buf, NULL, mul_col, buf, w);
246 func(buf, mask, 0, d, w);
247 }
230 } 248 }
231 } 249 }
232 } 250 }
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)
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index 4bd1fd2b35..17ed7f3d44 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -367,6 +367,8 @@ struct _Evas_Thread_Command_Map
367 RGBA_Map *map; 367 RGBA_Map *map;
368 int smooth, level, offset; 368 int smooth, level, offset;
369 Eina_Bool anti_alias; 369 Eina_Bool anti_alias;
370 void *mask;
371 int mask_x, mask_y;
370}; 372};
371 373
372struct _Evas_Thread_Command_Multi_Font 374struct _Evas_Thread_Command_Multi_Font
@@ -1626,7 +1628,8 @@ _draw_thread_map_draw(void *data)
1626 (im, map->surface, 1628 (im, map->surface,
1627 map->clip.x, map->clip.y, map->clip.w, map->clip.h, 1629 map->clip.x, map->clip.y, map->clip.w, map->clip.h,
1628 map->mul_col, map->render_op, m->count - offset, &m->pts[offset], 1630 map->mul_col, map->render_op, m->count - offset, &m->pts[offset],
1629 map->smooth, map->anti_alias, map->level); 1631 map->smooth, map->anti_alias, map->level,
1632 map->mask, map->mask_x, map->mask_y);
1630 } 1633 }
1631 1634
1632 evas_common_cpu_end_opt(); 1635 evas_common_cpu_end_opt();
@@ -1689,6 +1692,10 @@ _map_draw_thread_cmd(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, RG
1689 cm->level = level; 1692 cm->level = level;
1690 cm->offset = offset; 1693 cm->offset = offset;
1691 1694
1695 cm->mask = dc->clip.mask;
1696 cm->mask_x = dc->clip.mask_x;
1697 cm->mask_y = dc->clip.mask_y;
1698
1692 evas_thread_cmd_enqueue(_draw_thread_map_draw, cm); 1699 evas_thread_cmd_enqueue(_draw_thread_map_draw, cm);
1693 1700
1694 return EINA_TRUE; 1701 return EINA_TRUE;