move around - flatter.
[profile/ivi/evas.git] / src / lib / engines / common / evas_op_sub_main_.c
1 #include "evas_common.h"
2
3 static RGBA_Gfx_Func     op_sub_span_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST];
4 static RGBA_Gfx_Pt_Func  op_sub_pt_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST];
5
6 static void op_sub_init(void);
7 static void op_sub_shutdown(void);
8
9 static RGBA_Gfx_Func op_sub_pixel_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels);
10 static RGBA_Gfx_Func op_sub_color_span_get(DATA32 col, RGBA_Image *dst, int pixels);
11 static RGBA_Gfx_Func op_sub_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int pixels);
12 static RGBA_Gfx_Func op_sub_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels);
13 static RGBA_Gfx_Func op_sub_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels);
14
15 static RGBA_Gfx_Pt_Func op_sub_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
16 static RGBA_Gfx_Pt_Func op_sub_color_pt_get(DATA32 col, RGBA_Image *dst);
17 static RGBA_Gfx_Pt_Func op_sub_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst);
18 static RGBA_Gfx_Pt_Func op_sub_mask_color_pt_get(DATA32 col, RGBA_Image *dst);
19 static RGBA_Gfx_Pt_Func op_sub_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
20
21 static RGBA_Gfx_Compositor  _composite_sub = { "sub",
22  op_sub_init, op_sub_shutdown,
23  op_sub_pixel_span_get, op_sub_color_span_get,
24  op_sub_pixel_color_span_get, op_sub_mask_color_span_get,
25  op_sub_pixel_mask_span_get,
26  op_sub_pixel_pt_get, op_sub_color_pt_get,
27  op_sub_pixel_color_pt_get, op_sub_mask_color_pt_get,
28  op_sub_pixel_mask_pt_get
29  };
30
31 RGBA_Gfx_Compositor  *
32 evas_common_gfx_compositor_sub_get(void)
33 {
34    return &(_composite_sub);
35 }
36
37 static RGBA_Gfx_Func     op_sub_rel_span_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST];
38 static RGBA_Gfx_Pt_Func  op_sub_rel_pt_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST];
39
40 static void op_sub_rel_init(void);
41 static void op_sub_rel_shutdown(void);
42
43 static RGBA_Gfx_Func op_sub_rel_pixel_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels);
44 static RGBA_Gfx_Func op_sub_rel_color_span_get(DATA32 col, RGBA_Image *dst, int pixels);
45 static RGBA_Gfx_Func op_sub_rel_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int pixels);
46 static RGBA_Gfx_Func op_sub_rel_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels);
47 static RGBA_Gfx_Func op_sub_rel_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels);
48
49 static RGBA_Gfx_Pt_Func op_sub_rel_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
50 static RGBA_Gfx_Pt_Func op_sub_rel_color_pt_get(DATA32 col, RGBA_Image *dst);
51 static RGBA_Gfx_Pt_Func op_sub_rel_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst);
52 static RGBA_Gfx_Pt_Func op_sub_rel_mask_color_pt_get(DATA32 col, RGBA_Image *dst);
53 static RGBA_Gfx_Pt_Func op_sub_rel_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
54
55 static RGBA_Gfx_Compositor  _composite_sub_rel = { "sub_rel",
56  op_sub_rel_init, op_sub_rel_shutdown,
57  op_sub_rel_pixel_span_get, op_sub_rel_color_span_get,
58  op_sub_rel_pixel_color_span_get, op_sub_rel_mask_color_span_get,
59  op_sub_rel_pixel_mask_span_get,
60  op_sub_rel_pixel_pt_get, op_sub_rel_color_pt_get,
61  op_sub_rel_pixel_color_pt_get, op_sub_rel_mask_color_pt_get,
62  op_sub_rel_pixel_mask_pt_get
63  };
64
65 RGBA_Gfx_Compositor  *
66 evas_common_gfx_compositor_sub_rel_get(void)
67 {
68    return &(_composite_sub_rel);
69 }
70
71
72 # include "./evas_op_sub/op_sub_pixel_.c"
73 # include "./evas_op_sub/op_sub_color_.c"
74 # include "./evas_op_sub/op_sub_pixel_color_.c"
75 # include "./evas_op_sub/op_sub_pixel_mask_.c"
76 # include "./evas_op_sub/op_sub_mask_color_.c"
77 //# include "./evas_op_sub/op_sub_pixel_mask_color_.c"
78
79 # include "./evas_op_sub/op_sub_pixel_i386.c"
80 # include "./evas_op_sub/op_sub_color_i386.c"
81 # include "./evas_op_sub/op_sub_pixel_color_i386.c"
82 # include "./evas_op_sub/op_sub_pixel_mask_i386.c"
83 # include "./evas_op_sub/op_sub_mask_color_i386.c"
84 //# include "./evas_op_sub/op_sub_pixel_mask_color_i386.c"
85
86 static void
87 op_sub_init(void)
88 {
89    memset(op_sub_span_funcs, 0, sizeof(op_sub_span_funcs));
90    memset(op_sub_pt_funcs, 0, sizeof(op_sub_pt_funcs));
91 #ifdef BUILD_MMX
92    init_sub_pixel_span_funcs_mmx();
93    init_sub_pixel_color_span_funcs_mmx();
94    init_sub_pixel_mask_span_funcs_mmx();
95    init_sub_color_span_funcs_mmx();
96    init_sub_mask_color_span_funcs_mmx();
97
98    init_sub_pixel_pt_funcs_mmx();
99    init_sub_pixel_color_pt_funcs_mmx();
100    init_sub_pixel_mask_pt_funcs_mmx();
101    init_sub_color_pt_funcs_mmx();
102    init_sub_mask_color_pt_funcs_mmx();
103 #endif
104 #ifdef BUILD_C
105    init_sub_pixel_span_funcs_c();
106    init_sub_pixel_color_span_funcs_c();
107    init_sub_rel_pixel_mask_span_funcs_c();
108    init_sub_color_span_funcs_c();
109    init_sub_mask_color_span_funcs_c();
110
111    init_sub_pixel_pt_funcs_c();
112    init_sub_pixel_color_pt_funcs_c();
113    init_sub_rel_pixel_mask_pt_funcs_c();
114    init_sub_color_pt_funcs_c();
115    init_sub_mask_color_pt_funcs_c();
116 #endif
117 }
118
119 static void
120 op_sub_shutdown(void)
121 {
122 }
123
124 static RGBA_Gfx_Func
125 sub_gfx_span_func_cpu(int s, int m, int c, int d)
126 {
127    RGBA_Gfx_Func  func = NULL;
128    int cpu = CPU_N;
129 #ifdef BUILD_MMX
130    if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
131      {
132         cpu = CPU_MMX;
133         func = op_sub_span_funcs[s][m][c][d][cpu];
134         if (func) return func;
135      }
136 #endif
137 #ifdef BUILD_C
138    cpu = CPU_C;
139    func = op_sub_span_funcs[s][m][c][d][cpu];
140    if (func) return func;
141 #endif
142    return func;
143 }
144
145 static RGBA_Gfx_Func
146 op_sub_pixel_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
147 {
148    int  s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
149
150    if (src && src->cache_entry.flags.alpha)
151         s = SP;
152    if (dst && dst->cache_entry.flags.alpha)
153         d = DP;
154    return sub_gfx_span_func_cpu(s, m, c, d);
155 }
156
157 static RGBA_Gfx_Func
158 op_sub_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
159 {
160    int  s = SP_N, m = SM_N, c = SC_AN, d = DP_AN;
161
162    if ((col >> 24) < 255)
163         c = SC;
164    if (col == (col | 0x00ffffff))
165         c = SC_AA;
166    if (col == 0xffffffff)
167         c = SC_N;
168    if (dst && dst->cache_entry.flags.alpha)
169         d = DP;
170    return sub_gfx_span_func_cpu(s, m, c, d);
171 }
172
173 static RGBA_Gfx_Func
174 op_sub_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int pixels)
175 {
176    int  s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
177
178    if (src && src->cache_entry.flags.alpha)
179         s = SP;
180    if ((col >> 24) < 255)
181         c = SC;
182    if (col == (col | 0x00ffffff))
183         c = SC_AA;
184    if (col == 0xffffffff)
185         c = SC_N;
186    if (dst && dst->cache_entry.flags.alpha)
187         d = DP;
188    return sub_gfx_span_func_cpu(s, m, c, d);
189 }
190
191 static RGBA_Gfx_Func
192 op_sub_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
193 {
194    int  s = SP_N, m = SM_AS, c = SC_AN, d = DP_AN;
195
196    if ((col >> 24) < 255)
197         c = SC;
198    if (col == (col | 0x00ffffff))
199         c = SC_AA;
200    if (col == 0xffffffff)
201         c = SC_N;
202    if (dst && dst->cache_entry.flags.alpha)
203         d = DP;
204    return sub_gfx_span_func_cpu(s, m, c, d);
205 }
206
207 static RGBA_Gfx_Func
208 op_sub_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
209 {
210    int  s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
211
212    if (src && src->cache_entry.flags.alpha)
213         s = SP;
214    if (dst && dst->cache_entry.flags.alpha)
215         d = DP;
216    return sub_gfx_span_func_cpu(s, m, c, d);
217 }
218
219 static RGBA_Gfx_Pt_Func
220 sub_gfx_pt_func_cpu(int s, int m, int c, int d)
221 {
222    RGBA_Gfx_Pt_Func  func = NULL;
223    int cpu = CPU_N;
224 #ifdef BUILD_MMX
225    if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
226      {
227         cpu = CPU_MMX;
228         func = op_sub_pt_funcs[s][m][c][d][cpu];
229         if (func) return func;
230      }
231 #endif
232 #ifdef BUILD_C
233    cpu = CPU_C;
234    func = op_sub_pt_funcs[s][m][c][d][cpu];
235    if (func) return func;
236 #endif
237    return func;
238 }
239
240 static RGBA_Gfx_Pt_Func
241 op_sub_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
242 {
243    int  s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
244
245    if (src_flags.alpha)
246         s = SP;
247    if (dst && dst->cache_entry.flags.alpha)
248         d = DP;
249    return sub_gfx_pt_func_cpu(s, m, c, d);
250 }
251
252 static RGBA_Gfx_Pt_Func
253 op_sub_color_pt_get(DATA32 col, RGBA_Image *dst)
254 {
255    int  s = SP_N, m = SM_N, c = SC_AN, d = DP_AN;
256
257    if ((col >> 24) < 255)
258         c = SC;
259    if (col == (col | 0x00ffffff))
260         c = SC_AA;
261    if (col == 0xffffffff)
262         c = SC_N;
263    if (dst && dst->cache_entry.flags.alpha)
264         d = DP;
265    return sub_gfx_pt_func_cpu(s, m, c, d);
266 }
267
268 static RGBA_Gfx_Pt_Func
269 op_sub_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst)
270 {
271    int  s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
272
273    if (src_flags.alpha)
274         s = SP;
275    if ((col >> 24) < 255)
276         c = SC;
277    if (col == (col | 0x00ffffff))
278         c = SC_AA;
279    if (col == 0xffffffff)
280         c = SC_N;
281    if (dst && dst->cache_entry.flags.alpha)
282         d = DP;
283    return sub_gfx_pt_func_cpu(s, m, c, d);
284 }
285
286 static RGBA_Gfx_Pt_Func
287 op_sub_mask_color_pt_get(DATA32 col, RGBA_Image *dst)
288 {
289    int  s = SP_N, m = SM_AS, c = SC_AN, d = DP_AN;
290
291    if ((col >> 24) < 255)
292         c = SC;
293    if (col == (col | 0x00ffffff))
294         c = SC_AA;
295    if (col == 0xffffffff)
296         c = SC_N;
297    if (dst && dst->cache_entry.flags.alpha)
298         d = DP;
299    return sub_gfx_pt_func_cpu(s, m, c, d);
300 }
301
302 static RGBA_Gfx_Pt_Func
303 op_sub_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
304 {
305    int  s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
306
307    if (src_flags.alpha)
308         s = SP;
309    if (dst && dst->cache_entry.flags.alpha)
310         d = DP;
311    return sub_gfx_pt_func_cpu(s, m, c, d);
312 }
313
314
315
316 static void
317 op_sub_rel_init(void)
318 {
319    memset(op_sub_rel_span_funcs, 0, sizeof(op_sub_rel_span_funcs));
320    memset(op_sub_rel_pt_funcs, 0, sizeof(op_sub_rel_pt_funcs));
321 #ifdef BUILD_MMX
322    init_sub_rel_pixel_span_funcs_mmx();
323    init_sub_rel_pixel_color_span_funcs_mmx();
324    init_sub_rel_pixel_mask_span_funcs_mmx();
325    init_sub_rel_color_span_funcs_mmx();
326    init_sub_rel_mask_color_span_funcs_mmx();
327
328    init_sub_rel_pixel_pt_funcs_mmx();
329    init_sub_rel_pixel_color_pt_funcs_mmx();
330    init_sub_rel_pixel_mask_pt_funcs_mmx();
331    init_sub_rel_color_pt_funcs_mmx();
332    init_sub_rel_mask_color_pt_funcs_mmx();
333 #endif
334 #ifdef BUILD_C
335    init_sub_rel_pixel_span_funcs_c();
336    init_sub_rel_pixel_color_span_funcs_c();
337    init_sub_rel_pixel_mask_span_funcs_c();
338    init_sub_rel_color_span_funcs_c();
339    init_sub_rel_mask_color_span_funcs_c();
340
341    init_sub_rel_pixel_pt_funcs_c();
342    init_sub_rel_pixel_color_pt_funcs_c();
343    init_sub_rel_pixel_mask_pt_funcs_c();
344    init_sub_rel_color_pt_funcs_c();
345    init_sub_rel_mask_color_pt_funcs_c();
346 #endif
347 }
348
349 static void
350 op_sub_rel_shutdown(void)
351 {
352 }
353
354 static RGBA_Gfx_Func
355 sub_rel_gfx_span_func_cpu(int s, int m, int c, int d)
356 {
357    RGBA_Gfx_Func  func = NULL;
358    int cpu = CPU_N;
359 #ifdef BUILD_MMX
360    if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
361      {
362         cpu = CPU_MMX;
363         func = op_sub_rel_span_funcs[s][m][c][d][cpu];
364         if (func) return func;
365      }
366 #endif
367 #ifdef BUILD_C
368    cpu = CPU_C;
369    func = op_sub_rel_span_funcs[s][m][c][d][cpu];
370    if (func) return func;
371 #endif
372    return func;
373 }
374
375 static RGBA_Gfx_Func
376 op_sub_rel_pixel_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
377 {
378    int  s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
379
380    if (src && src->cache_entry.flags.alpha)
381         s = SP;
382    if (dst && dst->cache_entry.flags.alpha)
383         d = DP;
384    return sub_rel_gfx_span_func_cpu(s, m, c, d);
385 }
386
387 static RGBA_Gfx_Func
388 op_sub_rel_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
389 {
390    int  s = SP_N, m = SM_N, c = SC_AN, d = DP_AN;
391
392    if ((col >> 24) < 255)
393         c = SC;
394    if (col == (col | 0x00ffffff))
395         c = SC_AA;
396    if (col == 0xffffffff)
397         c = SC_N;
398    if (dst && dst->cache_entry.flags.alpha)
399         d = DP;
400    return sub_rel_gfx_span_func_cpu(s, m, c, d);
401 }
402
403 static RGBA_Gfx_Func
404 op_sub_rel_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int pixels)
405 {
406    int  s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
407
408    if (src && src->cache_entry.flags.alpha)
409         s = SP;
410    if ((col >> 24) < 255)
411         c = SC;
412    if (col == (col | 0x00ffffff))
413         c = SC_AA;
414    if (col == 0xffffffff)
415         c = SC_N;
416    if (dst && dst->cache_entry.flags.alpha)
417         d = DP;
418    return sub_rel_gfx_span_func_cpu(s, m, c, d);
419 }
420
421 static RGBA_Gfx_Func
422 op_sub_rel_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels)
423 {
424    int  s = SP_N, m = SM_AS, c = SC_AN, d = DP_AN;
425
426    if ((col >> 24) < 255)
427         c = SC;
428    if (col == (col | 0x00ffffff))
429         c = SC_AA;
430    if (col == 0xffffffff)
431         c = SC_N;
432    if (dst && dst->cache_entry.flags.alpha)
433         d = DP;
434    return sub_rel_gfx_span_func_cpu(s, m, c, d);
435 }
436
437 static RGBA_Gfx_Func
438 op_sub_rel_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
439 {
440    int  s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
441
442    if (src && src->cache_entry.flags.alpha)
443         s = SP;
444    if (dst && dst->cache_entry.flags.alpha)
445         d = DP;
446    return sub_rel_gfx_span_func_cpu(s, m, c, d);
447 }
448
449 static RGBA_Gfx_Pt_Func
450 sub_rel_gfx_pt_func_cpu(int s, int m, int c, int d)
451 {
452    RGBA_Gfx_Pt_Func  func = NULL;
453    int cpu = CPU_N;
454 #ifdef BUILD_MMX
455    if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
456      {
457         cpu = CPU_MMX;
458         func = op_sub_rel_pt_funcs[s][m][c][d][cpu];
459         if (func) return func;
460      }
461 #endif
462 #ifdef BUILD_C
463    cpu = CPU_C;
464    func = op_sub_rel_pt_funcs[s][m][c][d][cpu];
465    if (func) return func;
466 #endif
467    return func;
468 }
469
470 static RGBA_Gfx_Pt_Func
471 op_sub_rel_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
472 {
473    int  s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
474
475    if (src_flags.alpha)
476         s = SP;
477    if (dst && dst->cache_entry.flags.alpha)
478         d = DP;
479    return sub_rel_gfx_pt_func_cpu(s, m, c, d);
480 }
481
482 static RGBA_Gfx_Pt_Func
483 op_sub_rel_color_pt_get(DATA32 col, RGBA_Image *dst)
484 {
485    int  s = SP_N, m = SM_N, c = SC_AN, d = DP_AN;
486
487    if ((col >> 24) < 255)
488         c = SC;
489    if (col == (col | 0x00ffffff))
490         c = SC_AA;
491    if (col == 0xffffffff)
492         c = SC_N;
493    if (dst && dst->cache_entry.flags.alpha)
494         d = DP;
495    return sub_rel_gfx_pt_func_cpu(s, m, c, d);
496 }
497
498 static RGBA_Gfx_Pt_Func
499 op_sub_rel_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst)
500 {
501    int  s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
502
503    if (src_flags.alpha)
504         s = SP;
505    if ((col >> 24) < 255)
506         c = SC;
507    if (col == (col | 0x00ffffff))
508         c = SC_AA;
509    if (col == 0xffffffff)
510         c = SC_N;
511    if (dst && dst->cache_entry.flags.alpha)
512         d = DP;
513    return sub_rel_gfx_pt_func_cpu(s, m, c, d);
514 }
515
516 static RGBA_Gfx_Pt_Func
517 op_sub_rel_mask_color_pt_get(DATA32 col, RGBA_Image *dst)
518 {
519    int  s = SP_N, m = SM_AS, c = SC_AN, d = DP_AN;
520
521    if ((col >> 24) < 255)
522         c = SC;
523    if (col == (col | 0x00ffffff))
524         c = SC_AA;
525    if (col == 0xffffffff)
526         c = SC_N;
527    if (dst && dst->cache_entry.flags.alpha)
528         d = DP;
529    return sub_rel_gfx_pt_func_cpu(s, m, c, d);
530 }
531
532 static RGBA_Gfx_Pt_Func
533 op_sub_rel_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
534 {
535    int  s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
536
537    if (src_flags.alpha)
538         s = SP;
539    if (dst && dst->cache_entry.flags.alpha)
540         d = DP;
541    return sub_rel_gfx_pt_func_cpu(s, m, c, d);
542 }