aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/engines/common/evas_op_mul/op_mul_pixel_mask_.c
blob: 37d0497bcb4cad080e5e89c1892184a372c88fa9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/* mul pixel x mask --> dst */

#ifdef BUILD_C
static void
_op_mul_p_mas_dp(DATA32 *s, DATA8 *m, DATA32 c, DATA32 *d, int l) {
   DATA32 *e = d + l;
   while (d < e)
     {
	c = *m;
	switch(c)
	  {
	    case 0:
		break;
	    case 255:
		*d = MUL4_SYM(*s, *d);
		break;
	    default:
		c = ~(*s);
		c = ~MUL_SYM(*m, c);
		*d = MUL4_SYM(c, *d);
		break;
	  }
	m++;  s++;  d++;
     }
}

static void
_op_mul_pan_mas_dp(DATA32 *s, DATA8 *m, DATA32 c, DATA32 *d, int l) {
   DATA32 *e = d + l;
   while (d < e)
     {
	c = *m;
	switch(c)
	  {
	    case 0:
		break;
	    case 255:
		*d = (*d & 0xff000000) + MUL3_SYM(*s, *d);
		break;
	    default:
		c = ~(*s);
		c = ~MUL_SYM(*m, c);
		*d = (*d & 0xff000000) + MUL3_SYM(c, *d);
		break;
	  }
	m++;  s++;  d++;
     }
}

static void
_op_mul_p_mas_dpan(DATA32 *s, DATA8 *m, DATA32 c, DATA32 *d, int l) {
   DATA32 *e = d + l;
   while (d < e)
     {
	c = *m;
	switch(c)
	  {
	    case 0:
		break;
	    case 255:
		*d = (*s & 0xff000000) + MUL3_SYM(*s, *d);
		break;
	    default:
		c = ~(*s);
		c = ~MUL_SYM(*m, c);
		*d = (c & 0xff000000) + MUL3_SYM(c, *d);
		break;
	  }
	m++;  d++;
     }
}

#define _op_mul_pas_mas_dp _op_mul_p_mas_dp

#define _op_mul_pan_mas_dpan _op_mul_p_mas_dpan
#define _op_mul_pas_mas_dpan _op_mul_p_mas_dpan

static void
init_mul_pixel_mask_span_funcs_c(void)
{
   op_mul_span_funcs[SP][SM_AS][SC_N][DP][CPU_C] = _op_mul_p_mas_dp;
   op_mul_span_funcs[SP_AS][SM_AS][SC_N][DP][CPU_C] = _op_mul_pas_mas_dp;
   op_mul_span_funcs[SP_AN][SM_AS][SC_N][DP][CPU_C] = _op_mul_pan_mas_dp;

   op_mul_span_funcs[SP][SM_AS][SC_N][DP_AN][CPU_C] = _op_mul_p_mas_dpan;
   op_mul_span_funcs[SP_AS][SM_AS][SC_N][DP_AN][CPU_C] = _op_mul_pas_mas_dpan;
   op_mul_span_funcs[SP_AN][SM_AS][SC_N][DP_AN][CPU_C] = _op_mul_pan_mas_dpan;
}
#endif

#ifdef BUILD_C
static void
_op_mul_pt_p_mas_dp(DATA32 s, DATA8 m, DATA32 c __UNUSED__, DATA32 *d) {
	s = ~s;
	s = ~MUL_SYM(m, s);
	*d = MUL4_SYM(s, *d);
}

#define _op_mul_pt_pas_mas_dp _op_mul_pt_p_mas_dp
#define _op_mul_pt_pan_mas_dp _op_mul_pt_p_mas_dp

#define _op_mul_pt_p_mas_dpan _op_mul_pt_p_mas_dp
#define _op_mul_pt_pas_mas_dpan _op_mul_pt_p_mas_dp
#define _op_mul_pt_pan_mas_dpan _op_mul_pt_p_mas_dp

static void
init_mul_pixel_mask_pt_funcs_c(void)
{
   op_mul_pt_funcs[SP][SM_AS][SC_N][DP][CPU_C] = _op_mul_pt_p_mas_dp;
   op_mul_pt_funcs[SP_AS][SM_AS][SC_N][DP][CPU_C] = _op_mul_pt_pas_mas_dp;
   op_mul_pt_funcs[SP_AN][SM_AS][SC_N][DP][CPU_C] = _op_mul_pt_pan_mas_dp;

   op_mul_pt_funcs[SP][SM_AS][SC_N][DP_AN][CPU_C] = _op_mul_pt_p_mas_dpan;
   op_mul_pt_funcs[SP_AS][SM_AS][SC_N][DP_AN][CPU_C] = _op_mul_pt_pas_mas_dpan;
   op_mul_pt_funcs[SP_AN][SM_AS][SC_N][DP_AN][CPU_C] = _op_mul_pt_pan_mas_dpan;
}
#endif