7160751a8e37d44d1086b69a99522d67a3bda564
[framework/uifw/evas.git] / src / lib / engines / common / evas_op_blend_main_.c
1 #include "evas_common.h"
2
3 static RGBA_Gfx_Func     op_blend_span_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST];
4 static RGBA_Gfx_Pt_Func  op_blend_pt_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST];
5
6 static void op_blend_init(void);
7 static void op_blend_shutdown(void);
8
9 static RGBA_Gfx_Func op_blend_pixel_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels);
10 static RGBA_Gfx_Func op_blend_color_span_get(DATA32 col, RGBA_Image *dst, int pixels);
11 static RGBA_Gfx_Func op_blend_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int pixels);
12 static RGBA_Gfx_Func op_blend_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels);
13 static RGBA_Gfx_Func op_blend_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels);
14
15 static RGBA_Gfx_Pt_Func op_blend_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
16 static RGBA_Gfx_Pt_Func op_blend_color_pt_get(DATA32 col, RGBA_Image *dst);
17 static RGBA_Gfx_Pt_Func op_blend_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst);
18 static RGBA_Gfx_Pt_Func op_blend_mask_color_pt_get(DATA32 col, RGBA_Image *dst);
19 static RGBA_Gfx_Pt_Func op_blend_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
20
21 static RGBA_Gfx_Compositor  _composite_blend = { "blend",
22  op_blend_init, op_blend_shutdown,
23  op_blend_pixel_span_get, op_blend_color_span_get,
24  op_blend_pixel_color_span_get, op_blend_mask_color_span_get,
25  op_blend_pixel_mask_span_get,
26  op_blend_pixel_pt_get, op_blend_color_pt_get,
27  op_blend_pixel_color_pt_get, op_blend_mask_color_pt_get,
28  op_blend_pixel_mask_pt_get
29  };
30
31 RGBA_Gfx_Compositor  *
32 evas_common_gfx_compositor_blend_get(void)
33 {
34    return &(_composite_blend);
35 }
36
37
38 static RGBA_Gfx_Func     op_blend_rel_span_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST];
39 static RGBA_Gfx_Pt_Func  op_blend_rel_pt_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST];
40
41 static void op_blend_rel_init(void);
42 static void op_blend_rel_shutdown(void);
43
44 static RGBA_Gfx_Func op_blend_rel_pixel_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels);
45 static RGBA_Gfx_Func op_blend_rel_color_span_get(DATA32 col, RGBA_Image *dst, int pixels);
46 static RGBA_Gfx_Func op_blend_rel_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int pixels);
47 static RGBA_Gfx_Func op_blend_rel_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels);
48 static RGBA_Gfx_Func op_blend_rel_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels);
49
50 static RGBA_Gfx_Pt_Func op_blend_rel_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
51 static RGBA_Gfx_Pt_Func op_blend_rel_color_pt_get(DATA32 col, RGBA_Image *dst);
52 static RGBA_Gfx_Pt_Func op_blend_rel_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst);
53 static RGBA_Gfx_Pt_Func op_blend_rel_mask_color_pt_get(DATA32 col, RGBA_Image *dst);
54 static RGBA_Gfx_Pt_Func op_blend_rel_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst);
55
56 static RGBA_Gfx_Compositor  _composite_blend_rel = { "blend_rel",
57  op_blend_rel_init, op_blend_rel_shutdown,
58  op_blend_rel_pixel_span_get, op_blend_rel_color_span_get,
59  op_blend_rel_pixel_color_span_get, op_blend_rel_mask_color_span_get,
60  op_blend_rel_pixel_mask_span_get,
61  op_blend_rel_pixel_pt_get, op_blend_rel_color_pt_get,
62  op_blend_rel_pixel_color_pt_get, op_blend_rel_mask_color_pt_get,
63  op_blend_rel_pixel_mask_pt_get
64  };
65
66 RGBA_Gfx_Compositor  *
67 evas_common_gfx_compositor_blend_rel_get(void)
68 {
69    return &(_composite_blend_rel);
70 }
71
72
73 # include "./evas_op_blend/op_blend_pixel_.c"
74 # include "./evas_op_blend/op_blend_color_.c"
75 # include "./evas_op_blend/op_blend_pixel_color_.c"
76 # include "./evas_op_blend/op_blend_pixel_mask_.c"
77 # include "./evas_op_blend/op_blend_mask_color_.c"
78 //# include "./evas_op_blend/op_blend_pixel_mask_color_.c"
79
80 # include "./evas_op_blend/op_blend_pixel_i386.c"
81 # include "./evas_op_blend/op_blend_color_i386.c"
82 # include "./evas_op_blend/op_blend_pixel_color_i386.c"
83 # include "./evas_op_blend/op_blend_pixel_mask_i386.c"
84 # include "./evas_op_blend/op_blend_mask_color_i386.c"
85 //# include "./evas_op_blend/op_blend_pixel_mask_color_i386.c"
86
87 # include "./evas_op_blend/op_blend_pixel_neon.c"
88 # include "./evas_op_blend/op_blend_color_neon.c"
89 # include "./evas_op_blend/op_blend_pixel_color_neon.c"
90 # include "./evas_op_blend/op_blend_pixel_mask_neon.c"
91 # include "./evas_op_blend/op_blend_mask_color_neon.c"
92 //# include "./evas_op_blend/op_blend_pixel_mask_color_neon.c"
93
94 static void
95 op_blend_init(void)
96 {
97    memset(op_blend_span_funcs, 0, sizeof(op_blend_span_funcs));
98    memset(op_blend_pt_funcs, 0, sizeof(op_blend_pt_funcs));
99 #ifdef BUILD_MMX
100    init_blend_pixel_span_funcs_mmx();
101    init_blend_pixel_color_span_funcs_mmx();
102    init_blend_pixel_mask_span_funcs_mmx();
103    init_blend_color_span_funcs_mmx();
104    init_blend_mask_color_span_funcs_mmx();
105
106    init_blend_pixel_pt_funcs_mmx();
107    init_blend_pixel_color_pt_funcs_mmx();
108    init_blend_pixel_mask_pt_funcs_mmx();
109    init_blend_color_pt_funcs_mmx();
110    init_blend_mask_color_pt_funcs_mmx();
111 #endif
112 #ifdef BUILD_NEON
113    init_blend_pixel_span_funcs_neon();
114    init_blend_pixel_color_span_funcs_neon();
115    init_blend_pixel_mask_span_funcs_neon();
116    init_blend_color_span_funcs_neon();
117    init_blend_mask_color_span_funcs_neon();
118
119    init_blend_pixel_pt_funcs_neon();
120    init_blend_pixel_color_pt_funcs_neon();
121    init_blend_pixel_mask_pt_funcs_neon();
122    init_blend_color_pt_funcs_neon();
123    init_blend_mask_color_pt_funcs_neon();
124 #endif   
125 #ifdef BUILD_C
126    init_blend_pixel_span_funcs_c();
127    init_blend_pixel_color_span_funcs_c();
128    init_blend_pixel_mask_span_funcs_c();
129    init_blend_color_span_funcs_c();
130    init_blend_mask_color_span_funcs_c();
131
132    init_blend_pixel_pt_funcs_c();
133    init_blend_pixel_color_pt_funcs_c();
134    init_blend_pixel_mask_pt_funcs_c();
135    init_blend_color_pt_funcs_c();
136    init_blend_mask_color_pt_funcs_c();
137 #endif
138 }
139
140 static void
141 op_blend_shutdown(void)
142 {
143 }
144
145 static RGBA_Gfx_Func
146 blend_gfx_span_func_cpu(int s, int m, int c, int d)
147 {
148    RGBA_Gfx_Func func = NULL;
149    int cpu = CPU_N;
150 #ifdef BUILD_MMX
151    if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
152      {
153         cpu = CPU_MMX;
154         func = op_blend_span_funcs[s][m][c][d][cpu];
155         if (func) return func;
156      }
157 #endif
158 #ifdef BUILD_NEON
159    if (evas_common_cpu_has_feature(CPU_FEATURE_NEON))
160      {
161         cpu = CPU_NEON;
162         func = op_blend_span_funcs[s][m][c][d][cpu];
163         if (func) return func;
164      }
165 #endif
166 #ifdef BUILD_C
167    cpu = CPU_C;
168    func = op_blend_span_funcs[s][m][c][d][cpu];
169    if (func) return func;
170 #endif
171    return func;
172 }
173
174 static RGBA_Gfx_Func
175 op_blend_pixel_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels __UNUSED__)
176 {
177    int  s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
178
179    if (src && src->cache_entry.flags.alpha)
180      {
181         s = SP;
182         if (src->cache_entry.flags.alpha_sparse)
183             s = SP_AS;
184      }
185    if (dst && dst->cache_entry.flags.alpha)
186         d = DP;
187    return blend_gfx_span_func_cpu(s, m, c, d);
188 }
189
190 static RGBA_Gfx_Func
191 op_blend_color_span_get(DATA32 col, RGBA_Image *dst, int pixels __UNUSED__)
192 {
193    int  s = SP_N, m = SM_N, c = SC_AN, d = DP_AN;
194
195    if ((col >> 24) < 255)
196         c = SC;
197    if (col == ((col >> 24) * 0x01010101))
198         c = SC_AA;
199    if (col == 0xffffffff)
200         c = SC_N;
201    if (dst && dst->cache_entry.flags.alpha)
202         d = DP;
203    return blend_gfx_span_func_cpu(s, m, c, d);
204 }
205
206 static RGBA_Gfx_Func
207 op_blend_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int pixels __UNUSED__)
208 {
209    int  s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
210
211    if (src && src->cache_entry.flags.alpha)
212      {
213         s = SP;
214         if (src->cache_entry.flags.alpha_sparse)
215             s = SP_AS;
216      }
217    if ((col >> 24) < 255)
218         c = SC;
219    if (col == ((col >> 24) * 0x01010101))
220         c = SC_AA;
221    if (col == 0xffffffff)
222         c = SC_N;
223    if (dst && dst->cache_entry.flags.alpha)
224         d = DP;
225    return blend_gfx_span_func_cpu(s, m, c, d);
226 }
227
228 static RGBA_Gfx_Func
229 op_blend_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels __UNUSED__)
230 {
231    int  s = SP_N, m = SM_AS, c = SC_AN, d = DP_AN;
232
233    if ((col >> 24) < 255)
234         c = SC;
235    if (col == ((col >> 24) * 0x01010101))
236         c = SC_AA;
237    if (col == 0xffffffff)
238         c = SC_N;
239    if (dst && dst->cache_entry.flags.alpha)
240         d = DP;
241    return blend_gfx_span_func_cpu(s, m, c, d);
242 }
243
244 static RGBA_Gfx_Func
245 op_blend_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels __UNUSED__)
246 {
247    int  s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
248
249    if (src && src->cache_entry.flags.alpha)
250      {
251         s = SP;
252         if (src->cache_entry.flags.alpha_sparse)
253             s = SP_AS;
254      }
255    if (dst && dst->cache_entry.flags.alpha)
256         d = DP;
257    return blend_gfx_span_func_cpu(s, m, c, d);
258 }
259
260
261 static RGBA_Gfx_Pt_Func
262 blend_gfx_pt_func_cpu(int s, int m, int c, int d)
263 {
264    RGBA_Gfx_Pt_Func func = NULL;
265    int cpu = CPU_N;
266 #ifdef BUILD_MMX
267    if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
268      {
269         cpu = CPU_MMX;
270         func = op_blend_pt_funcs[s][m][c][d][cpu];
271         if (func) return func;
272      }
273 #endif
274 #ifdef BUILD_NEON
275    if (evas_common_cpu_has_feature(CPU_FEATURE_NEON))
276      {
277         cpu = CPU_NEON;
278         func = op_blend_pt_funcs[s][m][c][d][cpu];
279         if (func) return func;
280      }
281 #endif
282 #ifdef BUILD_C
283    cpu = CPU_C;
284    func = op_blend_pt_funcs[s][m][c][d][cpu];
285    if (func) return func;
286 #endif
287    return func;
288 }
289
290 static RGBA_Gfx_Pt_Func
291 op_blend_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
292 {
293    int  s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
294
295    if (src_flags.alpha)
296         s = SP;
297    if (dst && dst->cache_entry.flags.alpha)
298         d = DP;
299    return blend_gfx_pt_func_cpu(s, m, c, d);
300 }
301
302 static RGBA_Gfx_Pt_Func
303 op_blend_color_pt_get(DATA32 col, RGBA_Image *dst)
304 {
305    int  s = SP_N, m = SM_N, c = SC_AN, d = DP_AN;
306
307    if ((col >> 24) < 255)
308         c = SC;
309    if (col == ((col >> 24) * 0x01010101))
310         c = SC_AA;
311    if (col == 0xffffffff)
312         c = SC_N;
313    if (dst && dst->cache_entry.flags.alpha)
314         d = DP;
315    return blend_gfx_pt_func_cpu(s, m, c, d);
316 }
317
318 static RGBA_Gfx_Pt_Func
319 op_blend_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst)
320 {
321    int  s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
322
323    if (src_flags.alpha)
324         s = SP;
325    if ((col >> 24) < 255)
326         c = SC;
327    if (col == ((col >> 24) * 0x01010101))
328         c = SC_AA;
329    if (col == 0xffffffff)
330         c = SC_N;
331    if (dst && dst->cache_entry.flags.alpha)
332         d = DP;
333    return blend_gfx_pt_func_cpu(s, m, c, d);
334 }
335
336 static RGBA_Gfx_Pt_Func
337 op_blend_mask_color_pt_get(DATA32 col, RGBA_Image *dst)
338 {
339    int  s = SP_N, m = SM_AS, c = SC_AN, d = DP_AN;
340
341    if ((col >> 24) < 255)
342         c = SC;
343    if (col == ((col >> 24) * 0x01010101))
344         c = SC_AA;
345    if (col == 0xffffffff)
346         c = SC_N;
347    if (dst && dst->cache_entry.flags.alpha)
348         d = DP;
349    return blend_gfx_pt_func_cpu(s, m, c, d);
350 }
351
352 static RGBA_Gfx_Pt_Func
353 op_blend_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
354 {
355    int  s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
356
357    if (src_flags.alpha)
358         s = SP;
359    if (dst && dst->cache_entry.flags.alpha)
360         d = DP;
361    return blend_gfx_pt_func_cpu(s, m, c, d);
362 }
363
364
365 static void
366 op_blend_rel_init(void)
367 {
368    memset(op_blend_rel_span_funcs, 0, sizeof(op_blend_rel_span_funcs));
369    memset(op_blend_rel_pt_funcs, 0, sizeof(op_blend_rel_pt_funcs));
370 #ifdef BUILD_MMX
371    init_blend_rel_pixel_span_funcs_mmx();
372    init_blend_rel_pixel_color_span_funcs_mmx();
373    init_blend_rel_pixel_mask_span_funcs_mmx();
374    init_blend_rel_color_span_funcs_mmx();
375    init_blend_rel_mask_color_span_funcs_mmx();
376
377    init_blend_rel_pixel_pt_funcs_mmx();
378    init_blend_rel_pixel_color_pt_funcs_mmx();
379    init_blend_rel_pixel_mask_pt_funcs_mmx();
380    init_blend_rel_color_pt_funcs_mmx();
381    init_blend_rel_mask_color_pt_funcs_mmx();
382 #endif
383 #ifdef BUILD_NEON
384    init_blend_rel_pixel_span_funcs_neon();
385    init_blend_rel_pixel_color_span_funcs_neon();
386    init_blend_rel_pixel_mask_span_funcs_neon();
387    init_blend_rel_color_span_funcs_neon();
388    init_blend_rel_mask_color_span_funcs_neon();
389
390    init_blend_rel_pixel_pt_funcs_neon();
391    init_blend_rel_pixel_color_pt_funcs_neon();
392    init_blend_rel_pixel_mask_pt_funcs_neon();
393    init_blend_rel_color_pt_funcs_neon();
394    init_blend_rel_mask_color_pt_funcs_neon();
395 #endif
396 #ifdef BUILD_C
397    init_blend_rel_pixel_span_funcs_c();
398    init_blend_rel_pixel_color_span_funcs_c();
399    init_blend_rel_pixel_mask_span_funcs_c();
400    init_blend_rel_color_span_funcs_c();
401    init_blend_rel_mask_color_span_funcs_c();
402
403    init_blend_rel_pixel_pt_funcs_c();
404    init_blend_rel_pixel_color_pt_funcs_c();
405    init_blend_rel_pixel_mask_pt_funcs_c();
406    init_blend_rel_color_pt_funcs_c();
407    init_blend_rel_mask_color_pt_funcs_c();
408 #endif
409 }
410
411 static void
412 op_blend_rel_shutdown(void)
413 {
414 }
415
416 static RGBA_Gfx_Func
417 blend_rel_gfx_span_func_cpu(int s, int m, int c, int d)
418 {
419    RGBA_Gfx_Func func = NULL;
420    int cpu = CPU_N;
421 #ifdef BUILD_MMX
422    if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
423      {
424         cpu = CPU_MMX;
425         func = op_blend_rel_span_funcs[s][m][c][d][cpu];
426         if (func) return func;
427      }
428 #endif
429 #ifdef BUILD_NEON
430    if (evas_common_cpu_has_feature(CPU_FEATURE_NEON))
431      {
432         cpu = CPU_NEON;
433         func = op_blend_rel_span_funcs[s][m][c][d][cpu];
434         if (func) return func;
435      }
436 #endif
437 #ifdef BUILD_C
438    cpu = CPU_C;
439    func = op_blend_rel_span_funcs[s][m][c][d][cpu];
440    if (func) return func;
441 #endif
442    return func;
443 }
444
445 static RGBA_Gfx_Func
446 op_blend_rel_pixel_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels __UNUSED__)
447 {
448    int  s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
449
450    if (src && src->cache_entry.flags.alpha)
451      {
452         s = SP;
453         if (src->cache_entry.flags.alpha_sparse)
454             s = SP_AS;
455      }
456    if (dst && dst->cache_entry.flags.alpha)
457         d = DP;
458    return blend_rel_gfx_span_func_cpu(s, m, c, d);
459 }
460
461 static RGBA_Gfx_Func
462 op_blend_rel_color_span_get(DATA32 col, RGBA_Image *dst, int pixels __UNUSED__)
463 {
464    int  s = SP_N, m = SM_N, c = SC_AN, d = DP_AN;
465
466    if ((col >> 24) < 255)
467         c = SC;
468    if (col == ((col >> 24) * 0x01010101))
469         c = SC_AA;
470    if (col == 0xffffffff)
471         c = SC_N;
472    if (dst && dst->cache_entry.flags.alpha)
473         d = DP;
474    return blend_rel_gfx_span_func_cpu(s, m, c, d);
475 }
476
477 static RGBA_Gfx_Func
478 op_blend_rel_pixel_color_span_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int pixels __UNUSED__)
479 {
480    int  s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
481
482    if (src && src->cache_entry.flags.alpha)
483         s = SP;
484    if ((col >> 24) < 255)
485         c = SC;
486    if (col == ((col >> 24) * 0x01010101))
487         c = SC_AA;
488    if (col == 0xffffffff)
489         c = SC_N;
490    if (dst && dst->cache_entry.flags.alpha)
491         d = DP;
492    return blend_rel_gfx_span_func_cpu(s, m, c, d);
493 }
494
495 static RGBA_Gfx_Func
496 op_blend_rel_mask_color_span_get(DATA32 col, RGBA_Image *dst, int pixels __UNUSED__)
497 {
498    int  s = SP_N, m = SM_AS, c = SC_AN, d = DP_AN;
499
500    if ((col >> 24) < 255)
501         c = SC;
502    if (col == ((col >> 24) * 0x01010101))
503         c = SC_AA;
504    if (col == 0xffffffff)
505         c = SC_N;
506    if (dst && dst->cache_entry.flags.alpha)
507         d = DP;
508    return blend_rel_gfx_span_func_cpu(s, m, c, d);
509 }
510
511 static RGBA_Gfx_Func
512 op_blend_rel_pixel_mask_span_get(RGBA_Image *src, RGBA_Image *dst, int pixels __UNUSED__)
513 {
514    int  s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
515
516    if (src && src->cache_entry.flags.alpha)
517      {
518         s = SP;
519         if (src->cache_entry.flags.alpha_sparse)
520             s = SP_AS;
521      }
522    if (dst && dst->cache_entry.flags.alpha)
523         d = DP;
524    return blend_rel_gfx_span_func_cpu(s, m, c, d);
525 }
526
527 static RGBA_Gfx_Pt_Func
528 blend_rel_gfx_pt_func_cpu(int s, int m, int c, int d)
529 {
530    RGBA_Gfx_Pt_Func func = NULL;
531    int cpu = CPU_N;
532 #ifdef BUILD_MMX
533    if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
534      {
535         cpu = CPU_MMX;
536         func = op_blend_rel_pt_funcs[s][m][c][d][cpu];
537         if (func) return func;
538      }
539 #endif
540 #ifdef BUILD_NEON
541    if (evas_common_cpu_has_feature(CPU_FEATURE_NEON))
542      {
543         cpu = CPU_NEON;
544         func = op_blend_rel_pt_funcs[s][m][c][d][cpu];
545         if (func) return func;
546      }
547 #endif
548 #ifdef BUILD_C
549    cpu = CPU_C;
550    func = op_blend_rel_pt_funcs[s][m][c][d][cpu];
551    if (func) return func;
552 #endif
553    return func;
554 }
555
556 static RGBA_Gfx_Pt_Func
557 op_blend_rel_pixel_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
558 {
559    int  s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;
560
561    if (src_flags.alpha)
562         s = SP;
563    if (dst && dst->cache_entry.flags.alpha)
564         d = DP;
565    return blend_rel_gfx_pt_func_cpu(s, m, c, d);
566 }
567
568 static RGBA_Gfx_Pt_Func
569 op_blend_rel_color_pt_get(DATA32 col, RGBA_Image *dst)
570 {
571    int  s = SP_N, m = SM_N, c = SC_AN, d = DP_AN;
572
573    if ((col >> 24) < 255)
574         c = SC;
575    if (col == ((col >> 24) * 0x01010101))
576         c = SC_AA;
577    if (col == 0xffffffff)
578         c = SC_N;
579    if (dst && dst->cache_entry.flags.alpha)
580         d = DP;
581    return blend_rel_gfx_pt_func_cpu(s, m, c, d);
582 }
583
584 static RGBA_Gfx_Pt_Func
585 op_blend_rel_pixel_color_pt_get(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst)
586 {
587    int  s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;
588
589    if (src_flags.alpha)
590         s = SP;
591    if ((col >> 24) < 255)
592         c = SC;
593    if (col == ((col >> 24) * 0x01010101))
594         c = SC_AA;
595    if (col == 0xffffffff)
596         c = SC_N;
597    if (dst && dst->cache_entry.flags.alpha)
598         d = DP;
599    return blend_rel_gfx_pt_func_cpu(s, m, c, d);
600 }
601
602 static RGBA_Gfx_Pt_Func
603 op_blend_rel_mask_color_pt_get(DATA32 col, RGBA_Image *dst)
604 {
605    int  s = SP_N, m = SM_AS, c = SC_AN, d = DP_AN;
606
607    if ((col >> 24) < 255)
608         c = SC;
609    if (col == ((col >> 24) * 0x01010101))
610         c = SC_AA;
611    if (col == 0xffffffff)
612         c = SC_N;
613    if (dst && dst->cache_entry.flags.alpha)
614         d = DP;
615    return blend_rel_gfx_pt_func_cpu(s, m, c, d);
616 }
617
618 static RGBA_Gfx_Pt_Func
619 op_blend_rel_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst)
620 {
621    int  s = SP_AN, m = SM_AS, c = SC_N, d = DP_AN;
622
623    if (src_flags.alpha)
624         s = SP;
625    if (dst && dst->cache_entry.flags.alpha)
626         d = DP;
627    return blend_rel_gfx_pt_func_cpu(s, m, c, d);
628 }