aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/engines/common/evas_blend_main.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libraries/evas/src/lib/engines/common/evas_blend_main.c325
1 files changed, 325 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/engines/common/evas_blend_main.c b/libraries/evas/src/lib/engines/common/evas_blend_main.c
new file mode 100644
index 0000000..4aadd02
--- /dev/null
+++ b/libraries/evas/src/lib/engines/common/evas_blend_main.c
@@ -0,0 +1,325 @@
1#include "evas_common.h"
2#include "evas_blend_private.h"
3
4#if defined BUILD_MMX || defined BUILD_SSE
5#include "evas_mmx.h"
6#endif
7
8const DATA32 ALPHA_255 = 255;
9const DATA32 ALPHA_256 = 256;
10
11static void
12_composite_span_nothing(DATA32 *s __UNUSED__, DATA8 *m __UNUSED__, DATA32 c __UNUSED__, DATA32 *d __UNUSED__, int l __UNUSED__)
13{
14}
15
16static void
17_composite_pt_nothing(DATA32 s __UNUSED__, DATA8 m __UNUSED__, DATA32 c __UNUSED__, DATA32 *d __UNUSED__)
18{
19}
20
21static RGBA_Gfx_Compositor *
22evas_gfx_compositor_get(unsigned char op)
23{
24 RGBA_Gfx_Compositor *comp;
25
26 switch (op)
27 {
28 case _EVAS_RENDER_BLEND:
29 comp = evas_common_gfx_compositor_blend_get();
30 break;
31 case _EVAS_RENDER_BLEND_REL:
32 comp = evas_common_gfx_compositor_blend_rel_get();
33 break;
34 case _EVAS_RENDER_COPY:
35 comp = evas_common_gfx_compositor_copy_get();
36 break;
37 case _EVAS_RENDER_COPY_REL:
38 comp = evas_common_gfx_compositor_copy_rel_get();
39 break;
40/*
41 case _EVAS_RENDER_ADD:
42 comp = evas_common_gfx_compositor_add_get();
43 break;
44 case _EVAS_RENDER_ADD_REL:
45 comp = evas_common_gfx_compositor_add_rel_get();
46 break;
47 case _EVAS_RENDER_SUB:
48 comp = evas_common_gfx_compositor_sub_get();
49 break;
50 case _EVAS_RENDER_SUB_REL:
51 comp = evas_common_gfx_compositor_sub_rel_get();
52 break;
53*/
54 case _EVAS_RENDER_MASK:
55 comp = evas_common_gfx_compositor_mask_get();
56 break;
57 case _EVAS_RENDER_MUL:
58 comp = evas_common_gfx_compositor_mul_get();
59 break;
60 default:
61 comp = evas_common_gfx_compositor_blend_get();
62 break;
63 }
64 return comp;
65}
66
67EAPI void
68evas_common_blend_init(void)
69{
70 static int gfx_initialised = 0;
71 static int mmx = 0;
72 static int sse = 0;
73 static int sse2 = 0;
74 RGBA_Gfx_Compositor *comp;
75
76 if (gfx_initialised) return;
77 gfx_initialised = 1;
78
79 evas_common_cpu_can_do(&mmx, &sse, &sse2);
80
81 comp = evas_common_gfx_compositor_copy_get();
82 if (comp) comp->init();
83 comp = evas_common_gfx_compositor_copy_rel_get();
84 if (comp) comp->init();
85
86 comp = evas_common_gfx_compositor_blend_get();
87 if (comp) comp->init();
88 comp = evas_common_gfx_compositor_blend_rel_get();
89 if (comp) comp->init();
90
91/*
92 comp = evas_common_gfx_compositor_add_get();
93 if (comp) comp->init();
94 comp = evas_common_gfx_compositor_add_rel_get();
95 if (comp) comp->init();
96 comp = evas_common_gfx_compositor_sub_get();
97 if (comp) comp->init();
98 comp = evas_common_gfx_compositor_sub_rel_get();
99 if (comp) comp->init();
100*/
101 comp = evas_common_gfx_compositor_mask_get();
102 if (comp) comp->init();
103
104 comp = evas_common_gfx_compositor_mul_get();
105 if (comp) comp->init();
106}
107
108void
109evas_common_blend_shutdown(void)
110{
111 RGBA_Gfx_Compositor *comp;
112
113 comp = evas_common_gfx_compositor_copy_get();
114 if (comp) comp->shutdown();
115 comp = evas_common_gfx_compositor_copy_rel_get();
116 if (comp) comp->shutdown();
117
118 comp = evas_common_gfx_compositor_blend_get();
119 if (comp) comp->shutdown();
120 comp = evas_common_gfx_compositor_blend_rel_get();
121 if (comp) comp->shutdown();
122
123/*
124 comp = evas_common_gfx_compositor_add_get();
125 if (comp) comp->shutdown();
126 comp = evas_common_gfx_compositor_add_rel_get();
127 if (comp) comp->shutdown();
128 comp = evas_common_gfx_compositor_sub_get();
129 if (comp) comp->shutdown();
130 comp = evas_common_gfx_compositor_sub_rel_get();
131 if (comp) comp->shutdown();
132*/
133 comp = evas_common_gfx_compositor_mask_get();
134 if (comp) comp->shutdown();
135
136 comp = evas_common_gfx_compositor_mul_get();
137 if (comp) comp->shutdown();
138}
139
140
141RGBA_Gfx_Func
142evas_common_gfx_func_composite_pixel_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels, int op)
143{
144 RGBA_Gfx_Compositor *comp;
145 RGBA_Gfx_Func func = NULL;
146
147 if (src && (!src->cache_entry.flags.alpha))
148 {
149 if (op == _EVAS_RENDER_BLEND)
150 op = _EVAS_RENDER_COPY;
151 if (op == _EVAS_RENDER_BLEND_REL)
152 op = _EVAS_RENDER_COPY_REL;
153 }
154 comp = evas_gfx_compositor_get(op);
155 if (comp)
156 func = comp->composite_pixel_span_get(src, dst, pixels);
157 if (func)
158 return func;
159 return _composite_span_nothing;
160}
161
162RGBA_Gfx_Func
163evas_common_gfx_func_composite_color_span_get(DATA32 col, RGBA_Image *dst, int pixels, int op)
164{
165 RGBA_Gfx_Compositor *comp;
166 RGBA_Gfx_Func func = NULL;
167
168 if ((col & 0xff000000) == 0xff000000)
169 {
170 if (op == _EVAS_RENDER_BLEND)
171 op = _EVAS_RENDER_COPY;
172 if (op == EVAS_RENDER_BLEND_REL)
173 op = _EVAS_RENDER_COPY_REL;
174 }
175
176 comp = evas_gfx_compositor_get(op);
177 if (comp)
178 func = comp->composite_color_span_get(col, dst, pixels);
179 if (func)
180 return func;
181 return _composite_span_nothing;
182}
183
184RGBA_Gfx_Func
185evas_common_gfx_func_composite_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int pixels, int op)
186{
187 RGBA_Gfx_Compositor *comp;
188 RGBA_Gfx_Func func = NULL;
189
190 if ((src && (!src->cache_entry.flags.alpha)) && ((col & 0xff000000) == 0xff000000))
191 {
192 if (op == _EVAS_RENDER_BLEND)
193 op = _EVAS_RENDER_COPY;
194 if (op == _EVAS_RENDER_BLEND_REL)
195 op = _EVAS_RENDER_COPY_REL;
196 }
197
198 comp = evas_gfx_compositor_get(op);
199 if (comp)
200 func = comp->composite_pixel_color_span_get(src, col, dst, pixels);
201 if (func)
202 return func;
203 return _composite_span_nothing;
204}
205
206RGBA_Gfx_Func
207evas_common_gfx_func_composite_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels, int op)
208{
209 RGBA_Gfx_Compositor *comp;
210 RGBA_Gfx_Func func = NULL;
211
212 comp = evas_gfx_compositor_get(op);
213 if (comp)
214 func = comp->composite_mask_color_span_get(col, dst, pixels);
215 if (func)
216 return func;
217 return _composite_span_nothing;
218}
219
220RGBA_Gfx_Func
221evas_common_gfx_func_composite_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels, int op)
222{
223 RGBA_Gfx_Compositor *comp;
224 RGBA_Gfx_Func func = NULL;
225
226 comp = evas_gfx_compositor_get(op);
227 if (comp)
228 func = comp->composite_pixel_mask_span_get(src, dst, pixels);
229 if (func)
230 return func;
231 return _composite_span_nothing;
232}
233
234RGBA_Gfx_Pt_Func
235evas_common_gfx_func_composite_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst, int op)
236{
237 RGBA_Gfx_Compositor *comp;
238 RGBA_Gfx_Pt_Func func = NULL;
239
240 if (!src_flags.alpha)
241 {
242 if (op == _EVAS_RENDER_BLEND)
243 op = _EVAS_RENDER_COPY;
244 if (op == _EVAS_RENDER_BLEND_REL)
245 op = _EVAS_RENDER_COPY_REL;
246 }
247 comp = evas_gfx_compositor_get(op);
248 if (comp)
249 func = comp->composite_pixel_pt_get(src_flags, dst);
250 if (func)
251 return func;
252 return _composite_pt_nothing;
253}
254
255RGBA_Gfx_Pt_Func
256evas_common_gfx_func_composite_color_pt_get(DATA32 col, RGBA_Image *dst, int op)
257{
258 RGBA_Gfx_Compositor *comp;
259 RGBA_Gfx_Pt_Func func = NULL;
260
261 if ((col & 0xff000000) == 0xff000000)
262 {
263 if (op == _EVAS_RENDER_BLEND)
264 op = _EVAS_RENDER_COPY;
265 if (op == EVAS_RENDER_BLEND_REL)
266 op = _EVAS_RENDER_COPY_REL;
267 }
268
269 comp = evas_gfx_compositor_get(op);
270 if (comp)
271 func = comp->composite_color_pt_get(col, dst);
272 if (func)
273 return func;
274 return _composite_pt_nothing;
275}
276
277RGBA_Gfx_Pt_Func
278evas_common_gfx_func_composite_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst, int op)
279{
280 RGBA_Gfx_Compositor *comp;
281 RGBA_Gfx_Pt_Func func = NULL;
282
283 if ((!src_flags.alpha) && ((col & 0xff000000) == 0xff000000))
284 {
285 if (op == _EVAS_RENDER_BLEND)
286 op = _EVAS_RENDER_COPY;
287 if (op == _EVAS_RENDER_BLEND_REL)
288 op = _EVAS_RENDER_COPY_REL;
289 }
290
291 comp = evas_gfx_compositor_get(op);
292 if (comp)
293 func = comp->composite_pixel_color_pt_get(src_flags, col, dst);
294 if (func)
295 return func;
296 return _composite_pt_nothing;
297}
298
299RGBA_Gfx_Pt_Func
300evas_common_gfx_func_composite_mask_color_pt_get(DATA32 col, RGBA_Image *dst, int op)
301{
302 RGBA_Gfx_Compositor *comp;
303 RGBA_Gfx_Pt_Func func = NULL;
304
305 comp = evas_gfx_compositor_get(op);
306 if (comp)
307 func = comp->composite_mask_color_pt_get(col, dst);
308 if (func)
309 return func;
310 return _composite_pt_nothing;
311}
312
313RGBA_Gfx_Pt_Func
314evas_common_gfx_func_composite_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst, int op)
315{
316 RGBA_Gfx_Compositor *comp;
317 RGBA_Gfx_Pt_Func func = NULL;
318
319 comp = evas_gfx_compositor_get(op);
320 if (comp)
321 func = comp->composite_pixel_mask_pt_get(src_flags, dst);
322 if (func)
323 return func;
324 return _composite_pt_nothing;
325}