summaryrefslogtreecommitdiff
path: root/src/lib/evas/common/evas_op_mask_main_.c
blob: 0304d725142b6524f488d38013b73933cb09893e (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
#include "evas_common_private.h"

static RGBA_Gfx_Func     op_mask_span_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST];
static RGBA_Gfx_Pt_Func  op_mask_pt_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST];

static void op_mask_init(void);
static void op_mask_shutdown(void);

static RGBA_Gfx_Func op_mask_pixel_span_get(Eina_Bool src_alpha, Eina_Bool src_sparse_alpha, Eina_Bool dst_alpha, int pixels);
static RGBA_Gfx_Func op_mask_color_span_get(DATA32 col, Eina_Bool dst_alpha, int pixels);
static RGBA_Gfx_Func op_mask_pixel_color_span_get(Eina_Bool src_alpha, Eina_Bool src_sparse_alpha, DATA32 col, Eina_Bool dst_alpha, int pixels);
static RGBA_Gfx_Func op_mask_mask_color_span_get(DATA32 col, Eina_Bool dst_alpha, int pixels);
static RGBA_Gfx_Func op_mask_pixel_mask_span_get(Eina_Bool src_alpha, Eina_Bool src_sparse_alpha, Eina_Bool dst_alpha, int pixels);

static RGBA_Gfx_Pt_Func op_mask_pixel_pt_get(Eina_Bool src_alpha, Eina_Bool dst_alpha);
static RGBA_Gfx_Pt_Func op_mask_color_pt_get(DATA32 col, Eina_Bool dst_alpha);
static RGBA_Gfx_Pt_Func op_mask_pixel_color_pt_get(Eina_Bool src_alpha, DATA32 col, Eina_Bool dst_alpha);
static RGBA_Gfx_Pt_Func op_mask_mask_color_pt_get(DATA32 col, Eina_Bool dst_alpha);
static RGBA_Gfx_Pt_Func op_mask_pixel_mask_pt_get(Eina_Bool src_alpha, Eina_Bool dst_alpha);

static RGBA_Gfx_Compositor  _composite_mask = { "mask",
 op_mask_init, op_mask_shutdown,
 op_mask_pixel_span_get, op_mask_color_span_get,
 op_mask_pixel_color_span_get, op_mask_mask_color_span_get,
 op_mask_pixel_mask_span_get,
 op_mask_pixel_pt_get, op_mask_color_pt_get,
 op_mask_pixel_color_pt_get, op_mask_mask_color_pt_get,
 op_mask_pixel_mask_pt_get
 };

RGBA_Gfx_Compositor  *
evas_common_gfx_compositor_mask_get(void)
{
   return &(_composite_mask);
}


# include "./evas_op_mask/op_mask_pixel_.c"
# include "./evas_op_mask/op_mask_color_.c"
# include "./evas_op_mask/op_mask_pixel_color_.c"
# include "./evas_op_mask/op_mask_pixel_mask_.c"
# include "./evas_op_mask/op_mask_mask_color_.c"
//# include "./evas_op_mask/op_mask_pixel_mask_color_.c"

# include "./evas_op_mask/op_mask_pixel_i386.c"
# include "./evas_op_mask/op_mask_color_i386.c"
# include "./evas_op_mask/op_mask_pixel_color_i386.c"
# include "./evas_op_mask/op_mask_pixel_mask_i386.c"
# include "./evas_op_mask/op_mask_mask_color_i386.c"
//# include "./evas_op_mask/op_mask_pixel_mask_color_i386.c"


static void
op_mask_init(void)
{
   memset(op_mask_span_funcs, 0, sizeof(op_mask_span_funcs));
   memset(op_mask_pt_funcs, 0, sizeof(op_mask_pt_funcs));
#ifdef BUILD_MMX
   if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
     {
        init_mask_pixel_span_funcs_mmx();
        init_mask_pixel_color_span_funcs_mmx();
        init_mask_pixel_mask_span_funcs_mmx();
        init_mask_color_span_funcs_mmx();
        init_mask_mask_color_span_funcs_mmx();

        init_mask_pixel_pt_funcs_mmx();
        init_mask_pixel_color_pt_funcs_mmx();
        init_mask_pixel_mask_pt_funcs_mmx();
        init_mask_color_pt_funcs_mmx();
        init_mask_mask_color_pt_funcs_mmx();
     }
#endif
   init_mask_pixel_span_funcs_c();
   init_mask_pixel_color_span_funcs_c();
   init_mask_pixel_mask_span_funcs_c();
   init_mask_color_span_funcs_c();
   init_mask_mask_color_span_funcs_c();

   init_mask_pixel_pt_funcs_c();
   init_mask_pixel_color_pt_funcs_c();
   init_mask_pixel_mask_pt_funcs_c();
   init_mask_color_pt_funcs_c();
   init_mask_mask_color_pt_funcs_c();
}

static void
op_mask_shutdown(void)
{
}

static RGBA_Gfx_Func
mask_gfx_span_func_cpu(int s, int m, int c, int d)
{
   RGBA_Gfx_Func func = NULL;
   int cpu = CPU_N;
#ifdef BUILD_MMX
   if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
    {
      cpu = CPU_MMX;
      func = op_mask_span_funcs[s][m][c][d][cpu];
      if (func) return func;
    }
#endif
   cpu = CPU_C;
   func = op_mask_span_funcs[s][m][c][d][cpu];
   if (func) return func;
   return func;
}

static RGBA_Gfx_Func
op_mask_pixel_span_get(Eina_Bool src_alpha, Eina_Bool src_sparse_alpha EINA_UNUSED, Eina_Bool dst_alpha, int pixels EINA_UNUSED)
{
   int  s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;

   if (src_alpha)
     {
	s = SP;
     }
   if (dst_alpha)
	d = DP;
   return mask_gfx_span_func_cpu(s, m, c, d);
}

static RGBA_Gfx_Func
op_mask_color_span_get(DATA32 col, Eina_Bool dst_alpha, int pixels EINA_UNUSED)
{
   int  s = SP_N, m = SM_N, c = SC_AN, d = DP_AN;

   if ((col >> 24) < 255)
     {
	c = SC;
     }
   if (col == (col | 0x00ffffff))
	c = SC_AA;
   if (col == 0xffffffff)
	c = SC_N;
   if (dst_alpha)
	d = DP;
   return mask_gfx_span_func_cpu(s, m, c, d);
}

static RGBA_Gfx_Func
op_mask_pixel_color_span_get(Eina_Bool src_alpha, Eina_Bool src_sparse_alpha EINA_UNUSED, DATA32 col, Eina_Bool dst_alpha, int pixels EINA_UNUSED)
{
   int  s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;

   if (src_alpha)
     {
	s = SP;
     }
   if ((col >> 24) < 255)
     {
	c = SC;
     }
   if (col == (col | 0x00ffffff))
	c = SC_AA;
   if (col == 0xffffffff)
	c = SC_N;
   if (dst_alpha)
	d = DP;
   return mask_gfx_span_func_cpu(s, m, c, d);
}

static RGBA_Gfx_Func
op_mask_mask_color_span_get(DATA32 col, Eina_Bool dst_alpha EINA_UNUSED, int pixels EINA_UNUSED)
{
   int  s = SP_N, m = SM_AS, c = SC_AN, d = DP;

   if ((col >> 24) < 255)
	c = SC;
   if (col == (col | 0x00ffffff))
	c = SC_AA;
   if (col == 0xffffffff)
	c = SC_N;
   return mask_gfx_span_func_cpu(s, m, c, d);
}

static RGBA_Gfx_Func
op_mask_pixel_mask_span_get(Eina_Bool src_alpha, Eina_Bool src_sparse_alpha EINA_UNUSED, Eina_Bool dst_alpha EINA_UNUSED, int pixels EINA_UNUSED)
{
   int  s = SP_AN, m = SM_AS, c = SC_N, d = DP;

   if (src_alpha)
	s = SP;
   return mask_gfx_span_func_cpu(s, m, c, d);
}

static RGBA_Gfx_Pt_Func
mask_gfx_pt_func_cpu(int s, int m, int c, int d)
{
   RGBA_Gfx_Pt_Func func = NULL;
   int cpu = CPU_N;
#ifdef BUILD_MMX
   if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
    {
      cpu = CPU_MMX;
      func = op_mask_pt_funcs[s][m][c][d][cpu];
      if (func) return func;
    }
#endif
   cpu = CPU_C;
   func = op_mask_pt_funcs[s][m][c][d][cpu];
   if (func) return func;
   return func;
}

static RGBA_Gfx_Pt_Func
op_mask_pixel_pt_get(Eina_Bool src_alpha, Eina_Bool dst_alpha)
{
   int  s = SP_AN, m = SM_N, c = SC_N, d = DP_AN;

   if (src_alpha)
     {
	s = SP;
     }
   if (dst_alpha)
	d = DP;
   return mask_gfx_pt_func_cpu(s, m, c, d);
}

static RGBA_Gfx_Pt_Func
op_mask_color_pt_get(DATA32 col, Eina_Bool dst_alpha)
{
   int  s = SP_N, m = SM_N, c = SC_AN, d = DP_AN;

   if ((col >> 24) < 255)
     {
	c = SC;
     }
   if (col == (col | 0x00ffffff))
	c = SC_AA;
   if (col == 0xffffffff)
	c = SC_N;
   if (dst_alpha)
	d = DP;
   return mask_gfx_pt_func_cpu(s, m, c, d);
}

static RGBA_Gfx_Pt_Func
op_mask_pixel_color_pt_get(Eina_Bool src_alpha, DATA32 col, Eina_Bool dst_alpha)
{
   int  s = SP_AN, m = SM_N, c = SC_AN, d = DP_AN;

   if (src_alpha)
     {
	s = SP;
     }
   if ((col >> 24) < 255)
     {
	c = SC;
     }
   if (col == (col | 0x00ffffff))
	c = SC_AA;
   if (col == 0xffffffff)
	c = SC_N;
   if (dst_alpha)
	d = DP;
   return mask_gfx_pt_func_cpu(s, m, c, d);
}

static RGBA_Gfx_Pt_Func
op_mask_mask_color_pt_get(DATA32 col, Eina_Bool dst_alpha EINA_UNUSED)
{
   int  s = SP_N, m = SM_AS, c = SC_AN, d = DP;

   if ((col >> 24) < 255)
	c = SC;
   if (col == (col | 0x00ffffff))
	c = SC_AA;
   if (col == 0xffffffff)
	c = SC_N;
   return mask_gfx_pt_func_cpu(s, m, c, d);
}

static RGBA_Gfx_Pt_Func
op_mask_pixel_mask_pt_get(Eina_Bool src_alpha, Eina_Bool dst_alpha EINA_UNUSED)
{
   int  s = SP_AN, m = SM_AS, c = SC_N, d = DP;

   if (src_alpha)
	s = SP;
   return mask_gfx_pt_func_cpu(s, m, c, d);
}