aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/engines/common/evas_convert_rgb_16.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/evas/src/lib/engines/common/evas_convert_rgb_16.c')
-rw-r--r--libraries/evas/src/lib/engines/common/evas_convert_rgb_16.c2089
1 files changed, 2089 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/engines/common/evas_convert_rgb_16.c b/libraries/evas/src/lib/engines/common/evas_convert_rgb_16.c
new file mode 100644
index 0000000..b30ec1e
--- /dev/null
+++ b/libraries/evas/src/lib/engines/common/evas_convert_rgb_16.c
@@ -0,0 +1,2089 @@
1#include "evas_common.h"
2#include "evas_convert_rgb_16.h"
3
4#ifndef BUILD_NO_DITHER_MASK
5#ifdef USE_DITHER_44
6extern const DATA8 _evas_dither_44[4][4];
7#endif
8#ifdef USE_DITHER_128128
9extern const DATA8 _evas_dither_128128[128][128];
10#endif
11#endif
12
13#ifdef BUILD_CONVERT_16_RGB_565
14#ifdef BUILD_CONVERT_16_RGB_ROT0
15void
16evas_common_convert_rgba2_to_16bpp_rgb_565_dith (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
17{
18#ifndef BUILD_NO_DITHER_MASK
19 DATA16 *d = (DATA16 *)dst;
20 DATA32 r1, g1, b1;
21 DATA32 r2, g2, b2;
22 unsigned int dith, dith2;
23 int x, y;
24
25#ifdef BUILD_LINE_DITHER_MASK
26 for (y = 0; y < h; y++)
27 {
28 if ((y + dith_y) & 0x1)
29 {
30 for (x = 0; x < w; x+=2)
31 {
32 DATA32 p = *src++, q = *src++;
33 r1 = ((p & 0xff0000) + 0x030000) >> 19;
34 if (r1 > 0x1f) r1 = 0x1f;
35 g1 = ((p & 0xff00) + 0x000100) >> 10;
36 if (g1 > 0x3f) g1 = 0x3f;
37 b1 = ((p & 0xff) + 0x000003) >> 3;
38 if (b1 > 0x1f) b1 = 0x1f;
39 r2 = ((q & 0xff0000) + 0x030000) >> 19;
40 if (r2 > 0x1f) r2 = 0x1f;
41 g2 = ((q & 0xff00) + 0x000100) >> 10;
42 if (g2 > 0x3f) g2 = 0x3f;
43 b2 = ((q & 0xff) + 0x000003) >> 3;
44 if (b2 > 0x1f) b2 = 0x1f;
45#ifndef WORDS_BIGENDIAN
46 *((DATA32 *)d) = (r2 << 27) | (g2 << 21) | (b2 << 16) |
47 (r1 << 11) | (g1 << 5) | (b1);
48#else
49 *((DATA32 *)d) = (r1 << 27) | (g1 << 21) | (b1 << 16) |
50 (r2 << 11) | (g2 << 5) | (b2);
51#endif
52 d += 2;
53 }
54 }
55 else
56 {
57 x = w;
58 while (w > 0)
59 {
60 DATA32 p = *src++, q = *src++;
61
62#ifndef WORDS_BIGENDIAN
63 *((DATA32 *)d) =
64 (((q & 0xff0000) >> 19) << 27) | (((q & 0xff00) >> 10) << 21) | (((q & 0xff) >> 3) << 16) |
65 (((p & 0xff0000) >> 19) << 11) | (((p & 0xff00) >> 10) << 5) | ((p & 0xff) >> 3);
66#else
67 *((DATA32 *)d) =
68 (((p & 0xff0000) >> 19) << 27) | (((p & 0xff00) >> 10) << 21) | (((p & 0xff) >> 3) << 16) |
69 (((q & 0xff0000) >> 19) << 11) | (((q & 0xff00) >> 10) << 5) | ((q & 0xff) >> 3);
70#endif
71 d += 2; w -= 2;
72 }
73 w = x;
74 }
75 src += src_jump;
76 d += dst_jump;
77 }
78#else
79 for (y = 0; y < h; y++)
80 {
81 for (x = 0; x < w; x++)
82 {
83 DATA32 p = *src++, q = *src++;
84
85 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK];
86 dith2 = dith >> DM_SHF(6);
87 dith >>= DM_SHF(5);
88 r1 = (p & 0xff0000) >> 19;
89 g1 = (p & 0xff00) >> 10;
90 b1 = (p & 0xff) >> 3;
91 if ((r1 < 0x1f) && ((((p & 0xff0000) >> 16) - (r1 << 3)) >= dith )) r1++;
92 if ((g1 < 0x3f) && ((((p & 0xff00) >> 8) - (g1 << 2)) >= dith2)) g1++;
93 if ((b1 < 0x1f) && (((p & 0xff) - (b1 << 3)) >= dith )) b1++;
94
95 x++;
96 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK];
97 dith2 = dith >> DM_SHF(6);
98 dith >>= DM_SHF(5);
99 r2 = (q & 0xff0000) >> 19;
100 g2 = (q & 0xff00) >> 10;
101 b2 = (q & 0xff) >> 3;
102 if ((r2 < 0x1f) && ((((q & 0xff0000) >> 16) - (r2 << 3)) >= dith )) r2++;
103 if ((g2 < 0x3f) && ((((q & 0xff00) >> 8) - (g2 << 2)) >= dith2)) g2++;
104 if ((b2 < 0x1f) && (((q & 0xff) - (b2 << 3)) >= dith )) b2++;
105
106#ifndef WORDS_BIGENDIAN
107 *((DATA32 *)d) = (r2 << 27) | (g2 << 21) | (b2 << 16) |
108 (r1 << 11) | (g1 << 5) | (b1);
109#else
110 *((DATA32 *)d) = (r1 << 27) | (g1 << 21) | (b1 << 16) |
111 (r2 << 11) | (g2 << 5) | (b2);
112#endif
113 d += 2;
114 }
115 src += src_jump;
116 d += dst_jump;
117 }
118#endif
119 return;
120 pal = 0;
121#else
122 DATA16 *d = (DATA16 *)dst;
123 int w0 = w;
124
125 while (h--)
126 {
127 while (w > 0)
128 {
129 DATA32 p = *src++, q = *src++;
130
131#ifndef WORDS_BIGENDIAN
132 *((DATA32 *)d) =
133 (((q & 0xff0000) >> 19) << 27) | (((q & 0xff00) >> 10) << 21) | (((q & 0xff) >> 3) << 16) |
134 (((p & 0xff0000) >> 19) << 11) | (((p & 0xff00) >> 10) << 5) | ((p & 0xff) >> 3);
135#else
136 *((DATA32 *)d) =
137 (((p & 0xff0000) >> 19) << 27) | (((p & 0xff00) >> 10) << 21) | (((p & 0xff) >> 3) << 16) |
138 (((q & 0xff0000) >> 19) << 11) | (((q & 0xff00) >> 10) << 5) | ((q & 0xff) >> 3);
139#endif
140 d += 2; w -= 2;
141 }
142 w = w0;
143 src += src_jump;
144 d += dst_jump;
145 }
146 return;
147 pal = 0;
148#endif
149}
150#endif
151#endif
152
153#ifdef BUILD_CONVERT_16_RGB_565
154#ifdef BUILD_CONVERT_16_RGB_ROT0
155void
156evas_common_convert_rgba_to_16bpp_rgb_565_dith (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
157{
158#ifndef BUILD_NO_DITHER_MASK
159 DATA16 *d = (DATA16 *)dst;
160 DATA32 r, g, b;
161 unsigned int dith, dith2;
162 int x, y;
163
164#ifdef BUILD_LINE_DITHER_MASK
165 for (y = 0; y < h; y++)
166 {
167 if ((y + dith_y) & 0x1)
168 {
169 for (x = 0; x < w; x++)
170 {
171 DATA32 p = *src++;
172
173 r = (p & 0xff0000) >> 19;
174 if (r > 0x1f) r = 0x1f;
175 g = (p & 0xff00) >> 10;
176 if (g > 0x3f) g = 0x3f;
177 b = (p & 0xff) >> 3;
178 if (b > 0x1f) b = 0x1f;
179 *d++ = (r << 11) | (g << 5) | b;
180 }
181 }
182 else
183 {
184 x = w;
185 while (w--)
186 {
187 *d++ = (((*src & 0xff0000) >> 19) << 11) | (((*src & 0xff00) >> 10) << 5) | ((*src & 0xff) >> 3);
188 src++;
189 }
190 w = x;
191 }
192 src += src_jump;
193 d += dst_jump;
194 }
195#else
196 for (y = 0; y < h; y++)
197 {
198 for (x = 0; x < w; x++)
199 {
200 DATA32 p = *src++;
201
202 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK];
203 dith2 = dith >> DM_SHF(6);
204 dith >>= DM_SHF(5);
205 r = (p & 0xff0000) >> 19;
206 g = (p & 0xff00) >> 10;
207 b = (p & 0xff) >> 3;
208 if ((r < 0x1f) && ((((p & 0xff0000) >> 16) - (r << 3)) >= dith )) r++;
209 if ((g < 0x3f) && ((((p & 0xff00) >> 8) - (g << 2)) >= dith2)) g++;
210 if ((b < 0x1f) && (((p & 0xff) - (b << 3)) >= dith )) b++;
211
212 *d++ = (r << 11) | (g << 5) | b;
213 }
214 src += src_jump;
215 d += dst_jump;
216 }
217#endif
218 return;
219 pal = 0;
220#else
221 DATA16 *d = (DATA16 *)dst;
222 int w0 = w;
223
224 while (h--)
225 {
226 while (w--)
227 {
228 *d++ = (((*src & 0xff0000) >> 19) << 11) | (((*src & 0xff00) >> 10) << 5) | ((*src & 0xff) >> 3);
229 src++;
230 }
231 w = w0;
232 src += src_jump;
233 d += dst_jump;
234 }
235 return;
236 pal = 0;
237#endif
238}
239#endif
240#endif
241
242#ifdef BUILD_CONVERT_16_RGB_565
243#ifdef BUILD_CONVERT_16_RGB_ROT180
244void
245evas_common_convert_rgba2_to_16bpp_rgb_565_dith_rot_180 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
246{
247 DATA32 *src_ptr;
248 DATA16 *dst_ptr;
249 int x, y;
250 DATA8 r1, g1, b1;
251 DATA8 r2, g2, b2;
252#ifndef BUILD_NO_DITHER_MASK
253 DATA8 dith, dith2;
254#endif
255
256 dst_ptr = (DATA16 *)dst;
257
258 CONVERT_LOOP2_START_ROT_180();
259
260 r1 = (R_VAL(src_ptr)) >> 3;
261 g1 = (G_VAL(src_ptr)) >> 2;
262 b1 = (B_VAL(src_ptr)) >> 3;
263
264#ifndef BUILD_NO_DITHER_MASK
265 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
266 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
267 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++;
268 if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++;
269 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++;
270#endif
271
272 CONVERT_LOOP2_INC_ROT_180();
273
274 r2 = (R_VAL(src_ptr)) >> 3;
275 g2 = (G_VAL(src_ptr)) >> 2;
276 b2 = (B_VAL(src_ptr)) >> 3;
277
278#ifndef BUILD_NO_DITHER_MASK
279 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
280 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
281 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++;
282 if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++;
283 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++;
284#endif
285
286#ifndef WORDS_BIGENDIAN
287 *((DATA32 *)dst_ptr) =
288 (r2 << 27) | (g2 << 21) | (b2 << 16) |
289 (r1 << 11) | (g1 << 5 ) | (b1 );
290#else
291 *((DATA32 *)dst_ptr) =
292 (r1 << 27) | (g1 << 21) | (b1 << 16) |
293 (r2 << 11) | (g2 << 5 ) | (b2 );
294#endif
295
296 CONVERT_LOOP2_END_ROT_180();
297 return;
298 pal = 0;
299}
300#endif
301#endif
302
303#ifdef BUILD_CONVERT_16_RGB_565
304#ifdef BUILD_CONVERT_16_RGB_ROT180
305void
306evas_common_convert_rgba_to_16bpp_rgb_565_dith_rot_180 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
307{
308 DATA32 *src_ptr;
309 DATA16 *dst_ptr;
310 int x, y;
311 DATA8 r, g, b;
312#ifndef BUILD_NO_DITHER_MASK
313 DATA8 dith, dith2;
314#endif
315
316 dst_ptr = (DATA16 *)dst;
317
318 CONVERT_LOOP_START_ROT_180();
319
320 r = (R_VAL(src_ptr)) >> 3;
321 g = (G_VAL(src_ptr)) >> 2;
322 b = (B_VAL(src_ptr)) >> 3;
323
324#ifndef BUILD_NO_DITHER_MASK
325 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
326 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
327 if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++;
328 if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++;
329 if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++;
330#endif
331
332 *dst_ptr = (r << 11) | (g << 5) | (b);
333
334 CONVERT_LOOP_END_ROT_180();
335 return;
336 pal = 0;
337}
338#endif
339#endif
340
341#ifdef BUILD_CONVERT_16_RGB_565
342#ifdef BUILD_CONVERT_16_RGB_ROT270
343void
344evas_common_convert_rgba2_to_16bpp_rgb_565_dith_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
345{
346 DATA32 *src_ptr;
347 DATA16 *dst_ptr;
348 int x, y;
349 DATA8 r1, g1, b1;
350 DATA8 r2, g2, b2;
351#ifndef BUILD_NO_DITHER_MASK
352 DATA8 dith, dith2;
353#endif
354
355 dst_ptr = (DATA16 *)dst;
356
357 CONVERT_LOOP2_START_ROT_270();
358
359 r1 = (R_VAL(src_ptr)) >> 3;
360 g1 = (G_VAL(src_ptr)) >> 2;
361 b1 = (B_VAL(src_ptr)) >> 3;
362
363#ifndef BUILD_NO_DITHER_MASK
364 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
365 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
366 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++;
367 if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++;
368 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++;
369#endif
370
371 CONVERT_LOOP2_INC_ROT_270();
372
373 r2 = (R_VAL(src_ptr)) >> 3;
374 g2 = (G_VAL(src_ptr)) >> 2;
375 b2 = (B_VAL(src_ptr)) >> 3;
376
377#ifndef BUILD_NO_DITHER_MASK
378 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
379 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
380 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++;
381 if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++;
382 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++;
383#endif
384
385#ifndef WORDS_BIGENDIAN
386 *((DATA32 *)dst_ptr) =
387 (r2 << 27) | (g2 << 21) | (b2 << 16) |
388 (r1 << 11) | (g1 << 5 ) | (b1 );
389#else
390 *((DATA32 *)dst_ptr) =
391 (r1 << 27) | (g1 << 21) | (b1 << 16) |
392 (r2 << 11) | (g2 << 5 ) | (b2 );
393#endif
394
395 CONVERT_LOOP2_END_ROT_270();
396 return;
397 pal = 0;
398}
399#endif
400#endif
401
402#ifdef BUILD_CONVERT_16_RGB_565
403#ifdef BUILD_CONVERT_16_RGB_ROT270
404void
405evas_common_convert_rgba_to_16bpp_rgb_565_dith_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
406{
407 DATA32 *src_ptr;
408 DATA16 *dst_ptr;
409 int x, y;
410 DATA8 r, g, b;
411#ifndef BUILD_NO_DITHER_MASK
412 DATA8 dith, dith2;
413#endif
414
415 dst_ptr = (DATA16 *)dst;
416
417 CONVERT_LOOP_START_ROT_270();
418
419 r = (R_VAL(src_ptr)) >> 3;
420 g = (G_VAL(src_ptr)) >> 2;
421 b = (B_VAL(src_ptr)) >> 3;
422
423#ifndef BUILD_NO_DITHER_MASK
424 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
425 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
426 if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++;
427 if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++;
428 if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++;
429#endif
430
431 *dst_ptr = (r << 11) | (g << 5) | (b);
432
433 CONVERT_LOOP_END_ROT_270();
434 return;
435 pal = 0;
436}
437#endif
438#endif
439
440#ifdef BUILD_CONVERT_16_RGB_565
441#ifdef BUILD_CONVERT_16_RGB_ROT90
442void
443evas_common_convert_rgba2_to_16bpp_rgb_565_dith_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
444{
445 DATA32 *src_ptr;
446 DATA16 *dst_ptr;
447 int x, y;
448 DATA8 r1, g1, b1;
449 DATA8 r2, g2, b2;
450#ifndef BUILD_NO_DITHER_MASK
451 DATA8 dith, dith2;
452#endif
453
454 dst_ptr = (DATA16 *)dst;
455
456 CONVERT_LOOP2_START_ROT_90();
457
458 r1 = (R_VAL(src_ptr)) >> 3;
459 g1 = (G_VAL(src_ptr)) >> 2;
460 b1 = (B_VAL(src_ptr)) >> 3;
461
462#ifndef BUILD_NO_DITHER_MASK
463 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
464 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
465 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++;
466 if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++;
467 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++;
468#endif
469
470 CONVERT_LOOP2_INC_ROT_90();
471
472 r2 = (R_VAL(src_ptr)) >> 3;
473 g2 = (G_VAL(src_ptr)) >> 2;
474 b2 = (B_VAL(src_ptr)) >> 3;
475
476#ifndef BUILD_NO_DITHER_MASK
477 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
478 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
479 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++;
480 if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++;
481 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++;
482#endif
483
484#ifndef WORDS_BIGENDIAN
485 *((DATA32 *)dst_ptr) =
486 (r2 << 27) | (g2 << 21) | (b2 << 16) |
487 (r1 << 11) | (g1 << 5 ) | (b1 );
488#else
489 *((DATA32 *)dst_ptr) =
490 (r1 << 27) | (g1 << 21) | (b1 << 16) |
491 (r2 << 11) | (g2 << 5 ) | (b2 );
492#endif
493
494 CONVERT_LOOP2_END_ROT_90();
495 return;
496 pal = 0;
497}
498#endif
499#endif
500
501#ifdef BUILD_CONVERT_16_RGB_565
502#ifdef BUILD_CONVERT_16_RGB_ROT90
503void
504evas_common_convert_rgba_to_16bpp_rgb_565_dith_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
505{
506 DATA32 *src_ptr;
507 DATA16 *dst_ptr;
508 int x, y;
509 DATA8 r, g, b;
510#ifndef BUILD_NO_DITHER_MASK
511 DATA8 dith, dith2;
512#endif
513
514 dst_ptr = (DATA16 *)dst;
515
516 CONVERT_LOOP_START_ROT_90();
517
518 r = (R_VAL(src_ptr)) >> 3;
519 g = (G_VAL(src_ptr)) >> 2;
520 b = (B_VAL(src_ptr)) >> 3;
521
522#ifndef BUILD_NO_DITHER_MASK
523 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
524 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
525 if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++;
526 if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++;
527 if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++;
528#endif
529
530 *dst_ptr = (r << 11) | (g << 5) | (b);
531
532 CONVERT_LOOP_END_ROT_90();
533 return;
534 pal = 0;
535}
536#endif
537#endif
538
539#ifdef BUILD_CONVERT_16_BGR_565
540#ifdef BUILD_CONVERT_16_RGB_ROT0
541void
542evas_common_convert_rgba2_to_16bpp_bgr_565_dith (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
543{
544 DATA32 *src_ptr;
545 DATA16 *dst_ptr;
546 int x, y;
547 DATA8 r1, g1, b1;
548 DATA8 r2, g2, b2;
549#ifndef BUILD_NO_DITHER_MASK
550 DATA8 dith, dith2;
551#endif
552
553 dst_ptr = (DATA16 *)dst;
554
555 CONVERT_LOOP2_START_ROT_0();
556
557 r1 = (R_VAL(src_ptr)) >> 3;
558 g1 = (G_VAL(src_ptr)) >> 2;
559 b1 = (B_VAL(src_ptr)) >> 3;
560
561#ifndef BUILD_NO_DITHER_MASK
562 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
563 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
564 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++;
565 if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++;
566 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++;
567#endif
568
569 CONVERT_LOOP2_INC_ROT_0();
570
571 r2 = (R_VAL(src_ptr)) >> 3;
572 g2 = (G_VAL(src_ptr)) >> 2;
573 b2 = (B_VAL(src_ptr)) >> 3;
574
575#ifndef BUILD_NO_DITHER_MASK
576 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
577 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
578 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++;
579 if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++;
580 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++;
581#endif
582
583#ifndef WORDS_BIGENDIAN
584 *((DATA32 *)dst_ptr) =
585 (b2 << 27) | (g2 << 21) | (r2 << 16) |
586 (b1 << 11) | (g1 << 5 ) | (r1 );
587#else
588 *((DATA32 *)dst_ptr) =
589 (b1 << 27) | (g1 << 21) | (r1 << 16) |
590 (b2 << 11) | (g2 << 5 ) | (r2 );
591#endif
592
593 CONVERT_LOOP2_END_ROT_0();
594 return;
595 pal = 0;
596}
597#endif
598#endif
599
600#ifdef BUILD_CONVERT_16_BGR_565
601#ifdef BUILD_CONVERT_16_RGB_ROT0
602void
603evas_common_convert_rgba_to_16bpp_bgr_565_dith (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
604{
605 DATA32 *src_ptr;
606 DATA16 *dst_ptr;
607 int x, y;
608 DATA8 r, g, b;
609#ifndef BUILD_NO_DITHER_MASK
610 DATA8 dith, dith2;
611#endif
612
613 dst_ptr = (DATA16 *)dst;
614
615 CONVERT_LOOP_START_ROT_0();
616
617 r = (R_VAL(src_ptr)) >> 3;
618 g = (G_VAL(src_ptr)) >> 2;
619 b = (B_VAL(src_ptr)) >> 3;
620
621#ifndef BUILD_NO_DITHER_MASK
622 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
623 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
624 if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++;
625 if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++;
626 if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++;
627#endif
628
629 *dst_ptr = (b << 11) | (g << 5) | (r);
630
631 CONVERT_LOOP_END_ROT_0();
632 return;
633 pal = 0;
634}
635#endif
636#endif
637
638#ifdef BUILD_CONVERT_16_BGR_565
639#ifdef BUILD_CONVERT_16_RGB_ROT180
640void
641evas_common_convert_rgba2_to_16bpp_bgr_565_dith_rot_180 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
642{
643 DATA32 *src_ptr;
644 DATA16 *dst_ptr;
645 int x, y;
646 DATA8 r1, g1, b1;
647 DATA8 r2, g2, b2;
648#ifndef BUILD_NO_DITHER_MASK
649 DATA8 dith, dith2;
650#endif
651
652 dst_ptr = (DATA16 *)dst;
653
654 CONVERT_LOOP2_START_ROT_180();
655
656 r1 = (R_VAL(src_ptr)) >> 3;
657 g1 = (G_VAL(src_ptr)) >> 2;
658 b1 = (B_VAL(src_ptr)) >> 3;
659
660#ifndef BUILD_NO_DITHER_MASK
661 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
662 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
663 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++;
664 if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++;
665 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++;
666#endif
667
668 CONVERT_LOOP2_INC_ROT_180();
669
670 r2 = (R_VAL(src_ptr)) >> 3;
671 g2 = (G_VAL(src_ptr)) >> 2;
672 b2 = (B_VAL(src_ptr)) >> 3;
673
674#ifndef BUILD_NO_DITHER_MASK
675 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
676 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
677 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++;
678 if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++;
679 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++;
680#endif
681
682#ifndef WORDS_BIGENDIAN
683 *((DATA32 *)dst_ptr) =
684 (b2 << 27) | (g2 << 21) | (r2 << 16) |
685 (b1 << 11) | (g1 << 5 ) | (r1 );
686#else
687 *((DATA32 *)dst_ptr) =
688 (b1 << 27) | (g1 << 21) | (r1 << 16) |
689 (b2 << 11) | (g2 << 5 ) | (r2 );
690#endif
691
692 CONVERT_LOOP2_END_ROT_180();
693 return;
694 pal = 0;
695}
696#endif
697#endif
698
699#ifdef BUILD_CONVERT_16_BGR_565
700#ifdef BUILD_CONVERT_16_RGB_ROT180
701void
702evas_common_convert_rgba_to_16bpp_bgr_565_dith_rot_180 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
703{
704 DATA32 *src_ptr;
705 DATA16 *dst_ptr;
706 int x, y;
707 DATA8 r, g, b;
708#ifndef BUILD_NO_DITHER_MASK
709 DATA8 dith, dith2;
710#endif
711
712 dst_ptr = (DATA16 *)dst;
713
714 ERR("evas_common_convert_rgba_to_16bpp_bgr_565_dith_rot_180");
715
716 CONVERT_LOOP_START_ROT_180();
717
718 r = (R_VAL(src_ptr)) >> 3;
719 g = (G_VAL(src_ptr)) >> 2;
720 b = (B_VAL(src_ptr)) >> 3;
721
722#ifndef BUILD_NO_DITHER_MASK
723 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
724 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
725 if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++;
726 if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++;
727 if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++;
728#endif
729
730 *dst_ptr = (b << 11) | (g << 5) | (r);
731
732 CONVERT_LOOP_END_ROT_180();
733 return;
734 pal = 0;
735}
736#endif
737#endif
738
739#ifdef BUILD_CONVERT_16_BGR_565
740#ifdef BUILD_CONVERT_16_RGB_ROT270
741void
742evas_common_convert_rgba2_to_16bpp_bgr_565_dith_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
743{
744 DATA32 *src_ptr;
745 DATA16 *dst_ptr;
746 int x, y;
747 DATA8 r1, g1, b1;
748 DATA8 r2, g2, b2;
749#ifndef BUILD_NO_DITHER_MASK
750 DATA8 dith, dith2;
751#endif
752
753 dst_ptr = (DATA16 *)dst;
754
755 CONVERT_LOOP2_START_ROT_270();
756
757 r1 = (R_VAL(src_ptr)) >> 3;
758 g1 = (G_VAL(src_ptr)) >> 2;
759 b1 = (B_VAL(src_ptr)) >> 3;
760
761#ifndef BUILD_NO_DITHER_MASK
762 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
763 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
764 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++;
765 if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++;
766 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++;
767#endif
768
769 CONVERT_LOOP2_INC_ROT_270();
770
771 r2 = (R_VAL(src_ptr)) >> 3;
772 g2 = (G_VAL(src_ptr)) >> 2;
773 b2 = (B_VAL(src_ptr)) >> 3;
774
775#ifndef BUILD_NO_DITHER_MASK
776 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
777 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
778 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++;
779 if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++;
780 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++;
781#endif
782
783#ifndef WORDS_BIGENDIAN
784 *((DATA32 *)dst_ptr) =
785 (b2 << 27) | (g2 << 21) | (r2 << 16) |
786 (b1 << 11) | (g1 << 5 ) | (r1 );
787#else
788 *((DATA32 *)dst_ptr) =
789 (b1 << 27) | (g1 << 21) | (r1 << 16) |
790 (b2 << 11) | (g2 << 5 ) | (r2 );
791#endif
792
793 CONVERT_LOOP2_END_ROT_270();
794 return;
795 pal = 0;
796}
797#endif
798#endif
799
800#ifdef BUILD_CONVERT_16_BGR_565
801#ifdef BUILD_CONVERT_16_RGB_ROT270
802void
803evas_common_convert_rgba_to_16bpp_bgr_565_dith_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
804{
805 DATA32 *src_ptr;
806 DATA16 *dst_ptr;
807 int x, y;
808 DATA8 r, g, b;
809#ifndef BUILD_NO_DITHER_MASK
810 DATA8 dith, dith2;
811#endif
812
813 dst_ptr = (DATA16 *)dst;
814
815 CONVERT_LOOP_START_ROT_270();
816
817 r = (R_VAL(src_ptr)) >> 3;
818 g = (G_VAL(src_ptr)) >> 2;
819 b = (B_VAL(src_ptr)) >> 3;
820
821#ifndef BUILD_NO_DITHER_MASK
822 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
823 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
824 if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++;
825 if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++;
826 if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++;
827#endif
828
829 *dst_ptr = (b << 11) | (g << 5) | (r);
830
831 CONVERT_LOOP_END_ROT_270();
832 return;
833 pal = 0;
834}
835#endif
836#endif
837
838#ifdef BUILD_CONVERT_16_BGR_565
839#ifdef BUILD_CONVERT_16_RGB_ROT90
840void
841evas_common_convert_rgba2_to_16bpp_bgr_565_dith_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
842{
843 DATA32 *src_ptr;
844 DATA16 *dst_ptr;
845 int x, y;
846 DATA8 r1, g1, b1;
847 DATA8 r2, g2, b2;
848#ifndef BUILD_NO_DITHER_MASK
849 DATA8 dith, dith2;
850#endif
851
852 dst_ptr = (DATA16 *)dst;
853
854 CONVERT_LOOP2_START_ROT_90();
855
856 r1 = (R_VAL(src_ptr)) >> 3;
857 g1 = (G_VAL(src_ptr)) >> 2;
858 b1 = (B_VAL(src_ptr)) >> 3;
859
860#ifndef BUILD_NO_DITHER_MASK
861 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
862 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
863 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++;
864 if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++;
865 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++;
866#endif
867
868 CONVERT_LOOP2_INC_ROT_90();
869
870 r2 = (R_VAL(src_ptr)) >> 3;
871 g2 = (G_VAL(src_ptr)) >> 2;
872 b2 = (B_VAL(src_ptr)) >> 3;
873
874#ifndef BUILD_NO_DITHER_MASK
875 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
876 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
877 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++;
878 if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++;
879 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++;
880#endif
881
882#ifndef WORDS_BIGENDIAN
883 *((DATA32 *)dst_ptr) =
884 (b2 << 27) | (g2 << 21) | (r2 << 16) |
885 (b1 << 11) | (g1 << 5 ) | (r1 );
886#else
887 *((DATA32 *)dst_ptr) =
888 (b1 << 27) | (g1 << 21) | (r1 << 16) |
889 (b2 << 11) | (g2 << 5 ) | (r2 );
890#endif
891
892 CONVERT_LOOP2_END_ROT_90();
893 return;
894 pal = 0;
895}
896#endif
897#endif
898
899#ifdef BUILD_CONVERT_16_BGR_565
900#ifdef BUILD_CONVERT_16_RGB_ROT90
901void
902evas_common_convert_rgba_to_16bpp_bgr_565_dith_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
903{
904 DATA32 *src_ptr;
905 DATA16 *dst_ptr;
906 int x, y;
907 DATA8 r, g, b;
908#ifndef BUILD_NO_DITHER_MASK
909 DATA8 dith, dith2;
910#endif
911
912 dst_ptr = (DATA16 *)dst;
913
914 CONVERT_LOOP_START_ROT_90();
915
916 r = (R_VAL(src_ptr)) >> 3;
917 g = (G_VAL(src_ptr)) >> 2;
918 b = (B_VAL(src_ptr)) >> 3;
919
920#ifndef BUILD_NO_DITHER_MASK
921 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
922 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
923 if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++;
924 if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++;
925 if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++;
926#endif
927
928 *dst_ptr = (b << 11) | (g << 5) | (r);
929
930 CONVERT_LOOP_END_ROT_90();
931 return;
932 pal = 0;
933}
934#endif
935#endif
936
937#ifdef BUILD_CONVERT_16_RGB_444
938#ifdef BUILD_CONVERT_16_RGB_ROT0
939void
940evas_common_convert_rgba2_to_16bpp_rgb_444_dith (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
941{
942 DATA32 *src_ptr;
943 DATA16 *dst_ptr;
944 int x, y;
945 DATA8 r1, g1, b1;
946 DATA8 r2, g2, b2;
947#ifndef BUILD_NO_DITHER_MASK
948 DATA8 dith;
949#endif
950
951 dst_ptr = (DATA16 *)dst;
952
953 CONVERT_LOOP2_START_ROT_0();
954
955 r1 = (R_VAL(src_ptr)) >> 4;
956 g1 = (G_VAL(src_ptr)) >> 4;
957 b1 = (B_VAL(src_ptr)) >> 4;
958
959#ifndef BUILD_NO_DITHER_MASK
960 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
961 if (((R_VAL(src_ptr) - (r1 << 4)) >= dith ) && (r1 < 0x0f)) r1++;
962 if (((G_VAL(src_ptr) - (g1 << 4)) >= dith ) && (g1 < 0x0f)) g1++;
963 if (((B_VAL(src_ptr) - (b1 << 4)) >= dith ) && (b1 < 0x0f)) b1++;
964#endif
965
966 CONVERT_LOOP2_INC_ROT_0();
967
968 r2 = (R_VAL(src_ptr)) >> 4;
969 g2 = (G_VAL(src_ptr)) >> 4;
970 b2 = (B_VAL(src_ptr)) >> 4;
971
972#ifndef BUILD_NO_DITHER_MASK
973 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
974 if (((R_VAL(src_ptr) - (r2 << 4)) >= dith ) && (r2 < 0x0f)) r2++;
975 if (((G_VAL(src_ptr) - (g2 << 4)) >= dith ) && (g2 < 0x0f)) g2++;
976 if (((B_VAL(src_ptr) - (b2 << 4)) >= dith ) && (b2 < 0x0f)) b2++;
977#endif
978
979#ifndef WORDS_BIGENDIAN
980 *((DATA32 *)dst_ptr) =
981 (r2 << 24) | (g2 << 20) | (b2 << 16) |
982 (r1 << 8 ) | (g1 << 4 ) | (b1 );
983#else
984 *((DATA32 *)dst_ptr) =
985 (r1 << 24) | (g1 << 20) | (b1 << 16) |
986 (r2 << 8 ) | (g2 << 4 ) | (b2 );
987#endif
988
989 CONVERT_LOOP2_END_ROT_0();
990 return;
991 pal = 0;
992}
993#endif
994#endif
995
996#ifdef BUILD_CONVERT_16_RGB_444
997#ifdef BUILD_CONVERT_16_RGB_ROT0
998void
999evas_common_convert_rgba_to_16bpp_rgb_444_dith (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1000{
1001 DATA32 *src_ptr;
1002 DATA16 *dst_ptr;
1003 int x, y;
1004 DATA8 r, g, b;
1005#ifndef BUILD_NO_DITHER_MASK
1006 DATA8 dith;
1007#endif
1008
1009 dst_ptr = (DATA16 *)dst;
1010
1011 CONVERT_LOOP_START_ROT_0();
1012
1013 r = (R_VAL(src_ptr)) >> 4;
1014 g = (G_VAL(src_ptr)) >> 4;
1015 b = (B_VAL(src_ptr)) >> 4;
1016
1017#ifndef BUILD_NO_DITHER_MASK
1018 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1019 if (((R_VAL(src_ptr) - (r << 4)) >= dith ) && (r < 0x0f)) r++;
1020 if (((G_VAL(src_ptr) - (g << 4)) >= dith ) && (g < 0x0f)) g++;
1021 if (((B_VAL(src_ptr) - (b << 4)) >= dith ) && (b < 0x0f)) b++;
1022#endif
1023
1024 *dst_ptr = (r << 8) | (g << 4) | (b);
1025
1026 CONVERT_LOOP_END_ROT_0();
1027 return;
1028 pal = 0;
1029}
1030#endif
1031#endif
1032
1033#ifdef BUILD_CONVERT_16_RGB_444
1034#ifdef BUILD_CONVERT_16_RGB_ROT180
1035void
1036evas_common_convert_rgba2_to_16bpp_rgb_444_dith_rot_180 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1037{
1038 DATA32 *src_ptr;
1039 DATA16 *dst_ptr;
1040 int x, y;
1041 DATA8 r1, g1, b1;
1042 DATA8 r2, g2, b2;
1043#ifndef BUILD_NO_DITHER_MASK
1044 DATA8 dith;
1045#endif
1046
1047 dst_ptr = (DATA16 *)dst;
1048
1049 CONVERT_LOOP2_START_ROT_180();
1050
1051 r1 = (R_VAL(src_ptr)) >> 4;
1052 g1 = (G_VAL(src_ptr)) >> 4;
1053 b1 = (B_VAL(src_ptr)) >> 4;
1054
1055#ifndef BUILD_NO_DITHER_MASK
1056 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1057 if (((R_VAL(src_ptr) - (r1 << 4)) >= dith ) && (r1 < 0x0f)) r1++;
1058 if (((G_VAL(src_ptr) - (g1 << 4)) >= dith ) && (g1 < 0x0f)) g1++;
1059 if (((B_VAL(src_ptr) - (b1 << 4)) >= dith ) && (b1 < 0x0f)) b1++;
1060#endif
1061
1062 CONVERT_LOOP2_INC_ROT_180();
1063
1064 r2 = (R_VAL(src_ptr)) >> 4;
1065 g2 = (G_VAL(src_ptr)) >> 4;
1066 b2 = (B_VAL(src_ptr)) >> 4;
1067
1068#ifndef BUILD_NO_DITHER_MASK
1069 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1070 if (((R_VAL(src_ptr) - (r2 << 4)) >= dith ) && (r2 < 0x0f)) r2++;
1071 if (((G_VAL(src_ptr) - (g2 << 4)) >= dith ) && (g2 < 0x0f)) g2++;
1072 if (((B_VAL(src_ptr) - (b2 << 4)) >= dith ) && (b2 < 0x0f)) b2++;
1073#endif
1074
1075#ifndef WORDS_BIGENDIAN
1076 *((DATA32 *)dst_ptr) =
1077 (r2 << 24) | (g2 << 20) | (b2 << 16) |
1078 (r1 << 8 ) | (g1 << 4 ) | (b1 );
1079#else
1080 *((DATA32 *)dst_ptr) =
1081 (r1 << 24) | (g1 << 20) | (b1 << 16) |
1082 (r2 << 8 ) | (g2 << 4 ) | (b2 );
1083#endif
1084
1085 CONVERT_LOOP2_END_ROT_180();
1086 return;
1087 pal = 0;
1088}
1089#endif
1090#endif
1091
1092#ifdef BUILD_CONVERT_16_RGB_444
1093#ifdef BUILD_CONVERT_16_RGB_ROT180
1094void
1095evas_common_convert_rgba_to_16bpp_rgb_444_dith_rot_180 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1096{
1097 DATA32 *src_ptr;
1098 DATA16 *dst_ptr;
1099 int x, y;
1100 DATA8 r, g, b;
1101#ifndef BUILD_NO_DITHER_MASK
1102 DATA8 dith;
1103#endif
1104
1105 dst_ptr = (DATA16 *)dst;
1106
1107 CONVERT_LOOP_START_ROT_180();
1108
1109 r = (R_VAL(src_ptr)) >> 4;
1110 g = (G_VAL(src_ptr)) >> 4;
1111 b = (B_VAL(src_ptr)) >> 4;
1112
1113#ifndef BUILD_NO_DITHER_MASK
1114 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1115 if (((R_VAL(src_ptr) - (r << 4)) >= dith ) && (r < 0x0f)) r++;
1116 if (((G_VAL(src_ptr) - (g << 4)) >= dith ) && (g < 0x0f)) g++;
1117 if (((B_VAL(src_ptr) - (b << 4)) >= dith ) && (b < 0x0f)) b++;
1118#endif
1119
1120 *dst_ptr = (r << 8) | (g << 4) | (b);
1121
1122 CONVERT_LOOP_END_ROT_180();
1123 return;
1124 pal = 0;
1125}
1126#endif
1127#endif
1128
1129#ifdef BUILD_CONVERT_16_RGB_444
1130#ifdef BUILD_CONVERT_16_RGB_ROT270
1131void
1132evas_common_convert_rgba2_to_16bpp_rgb_444_dith_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1133{
1134 DATA32 *src_ptr;
1135 DATA16 *dst_ptr;
1136 int x, y;
1137 DATA8 r1, g1, b1;
1138 DATA8 r2, g2, b2;
1139#ifndef BUILD_NO_DITHER_MASK
1140 DATA8 dith;
1141#endif
1142
1143 dst_ptr = (DATA16 *)dst;
1144
1145 CONVERT_LOOP2_START_ROT_270();
1146
1147 r1 = (R_VAL(src_ptr)) >> 4;
1148 g1 = (G_VAL(src_ptr)) >> 4;
1149 b1 = (B_VAL(src_ptr)) >> 4;
1150
1151#ifndef BUILD_NO_DITHER_MASK
1152 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1153 if (((R_VAL(src_ptr) - (r1 << 4)) >= dith ) && (r1 < 0x0f)) r1++;
1154 if (((G_VAL(src_ptr) - (g1 << 4)) >= dith ) && (g1 < 0x0f)) g1++;
1155 if (((B_VAL(src_ptr) - (b1 << 4)) >= dith ) && (b1 < 0x0f)) b1++;
1156#endif
1157
1158 CONVERT_LOOP2_INC_ROT_270();
1159
1160 r2 = (R_VAL(src_ptr)) >> 4;
1161 g2 = (G_VAL(src_ptr)) >> 4;
1162 b2 = (B_VAL(src_ptr)) >> 4;
1163
1164#ifndef BUILD_NO_DITHER_MASK
1165 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1166 if (((R_VAL(src_ptr) - (r2 << 4)) >= dith ) && (r2 < 0x0f)) r2++;
1167 if (((G_VAL(src_ptr) - (g2 << 4)) >= dith ) && (g2 < 0x0f)) g2++;
1168 if (((B_VAL(src_ptr) - (b2 << 4)) >= dith ) && (b2 < 0x0f)) b2++;
1169#endif
1170
1171#ifndef WORDS_BIGENDIAN
1172 *((DATA32 *)dst_ptr) =
1173 (r2 << 24) | (g2 << 20) | (b2 << 16) |
1174 (r1 << 8 ) | (g1 << 4 ) | (b1 );
1175#else
1176 *((DATA32 *)dst_ptr) =
1177 (r1 << 24) | (g1 << 20) | (b1 << 16) |
1178 (r2 << 8 ) | (g2 << 4 ) | (b2 );
1179#endif
1180
1181 CONVERT_LOOP2_END_ROT_270();
1182 return;
1183 pal = 0;
1184}
1185#endif
1186#endif
1187
1188#ifdef BUILD_CONVERT_16_RGB_444
1189#ifdef BUILD_CONVERT_16_RGB_ROT270
1190void
1191evas_common_convert_rgba_to_16bpp_rgb_444_dith_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1192{
1193 DATA32 *src_ptr;
1194 DATA16 *dst_ptr;
1195 int x, y;
1196 DATA8 r, g, b;
1197#ifndef BUILD_NO_DITHER_MASK
1198 DATA8 dith;
1199#endif
1200
1201 dst_ptr = (DATA16 *)dst;
1202
1203 CONVERT_LOOP_START_ROT_270();
1204
1205 r = (R_VAL(src_ptr)) >> 4;
1206 g = (G_VAL(src_ptr)) >> 4;
1207 b = (B_VAL(src_ptr)) >> 4;
1208
1209#ifndef BUILD_NO_DITHER_MASK
1210 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1211 if (((R_VAL(src_ptr) - (r << 4)) >= dith ) && (r < 0x0f)) r++;
1212 if (((G_VAL(src_ptr) - (g << 4)) >= dith ) && (g < 0x0f)) g++;
1213 if (((B_VAL(src_ptr) - (b << 4)) >= dith ) && (b < 0x0f)) b++;
1214#endif
1215
1216 *dst_ptr = (r << 8) | (g << 4) | (b);
1217
1218 CONVERT_LOOP_END_ROT_270();
1219 return;
1220 pal = 0;
1221}
1222#endif
1223#endif
1224
1225#ifdef BUILD_CONVERT_16_RGB_444
1226#ifdef BUILD_CONVERT_16_RGB_ROT90
1227void
1228evas_common_convert_rgba2_to_16bpp_rgb_444_dith_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1229{
1230 DATA32 *src_ptr;
1231 DATA16 *dst_ptr;
1232 int x, y;
1233 DATA8 r1, g1, b1;
1234 DATA8 r2, g2, b2;
1235#ifndef BUILD_NO_DITHER_MASK
1236 DATA8 dith;
1237#endif
1238
1239 dst_ptr = (DATA16 *)dst;
1240
1241 CONVERT_LOOP2_START_ROT_90();
1242
1243 r1 = (R_VAL(src_ptr)) >> 4;
1244 g1 = (G_VAL(src_ptr)) >> 4;
1245 b1 = (B_VAL(src_ptr)) >> 4;
1246
1247#ifndef BUILD_NO_DITHER_MASK
1248 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1249 if (((R_VAL(src_ptr) - (r1 << 4)) >= dith ) && (r1 < 0x0f)) r1++;
1250 if (((G_VAL(src_ptr) - (g1 << 4)) >= dith ) && (g1 < 0x0f)) g1++;
1251 if (((B_VAL(src_ptr) - (b1 << 4)) >= dith ) && (b1 < 0x0f)) b1++;
1252#endif
1253
1254 CONVERT_LOOP2_INC_ROT_90();
1255
1256 r2 = (R_VAL(src_ptr)) >> 4;
1257 g2 = (G_VAL(src_ptr)) >> 4;
1258 b2 = (B_VAL(src_ptr)) >> 4;
1259
1260#ifndef BUILD_NO_DITHER_MASK
1261 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1262 if (((R_VAL(src_ptr) - (r2 << 4)) >= dith ) && (r2 < 0x0f)) r2++;
1263 if (((G_VAL(src_ptr) - (g2 << 4)) >= dith ) && (g2 < 0x0f)) g2++;
1264 if (((B_VAL(src_ptr) - (b2 << 4)) >= dith ) && (b2 < 0x0f)) b2++;
1265#endif
1266
1267#ifndef WORDS_BIGENDIAN
1268 *((DATA32 *)dst_ptr) =
1269 (r2 << 24) | (g2 << 20) | (b2 << 16) |
1270 (r1 << 8 ) | (g1 << 4 ) | (b1 );
1271#else
1272 *((DATA32 *)dst_ptr) =
1273 (r1 << 24) | (g1 << 20) | (b1 << 16) |
1274 (r2 << 8 ) | (g2 << 4 ) | (b2 );
1275#endif
1276
1277 CONVERT_LOOP2_END_ROT_90();
1278 return;
1279 pal = 0;
1280}
1281#endif
1282#endif
1283
1284#ifdef BUILD_CONVERT_16_RGB_444
1285#ifdef BUILD_CONVERT_16_RGB_ROT90
1286void
1287evas_common_convert_rgba_to_16bpp_rgb_444_dith_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1288{
1289 DATA32 *src_ptr;
1290 DATA16 *dst_ptr;
1291 int x, y;
1292 DATA8 r, g, b;
1293#ifndef BUILD_NO_DITHER_MASK
1294 DATA8 dith;
1295#endif
1296
1297 dst_ptr = (DATA16 *)dst;
1298
1299 CONVERT_LOOP_START_ROT_90();
1300
1301 r = (R_VAL(src_ptr)) >> 4;
1302 g = (G_VAL(src_ptr)) >> 4;
1303 b = (B_VAL(src_ptr)) >> 4;
1304
1305#ifndef BUILD_NO_DITHER_MASK
1306 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1307 if (((R_VAL(src_ptr) - (r << 4)) >= dith ) && (r < 0x0f)) r++;
1308 if (((G_VAL(src_ptr) - (g << 4)) >= dith ) && (g < 0x0f)) g++;
1309 if (((B_VAL(src_ptr) - (b << 4)) >= dith ) && (b < 0x0f)) b++;
1310#endif
1311
1312 *dst_ptr = (r << 8) | (g << 4) | (b);
1313
1314 CONVERT_LOOP_END_ROT_90();
1315 return;
1316 pal = 0;
1317}
1318#endif
1319#endif
1320
1321#ifdef BUILD_CONVERT_16_RGB_454645
1322#ifdef BUILD_CONVERT_16_RGB_ROT0
1323void
1324evas_common_convert_rgba2_to_16bpp_rgb_454645_dith (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1325{
1326 DATA32 *src_ptr;
1327 DATA16 *dst_ptr;
1328 int x, y;
1329 DATA8 r1, g1, b1;
1330 DATA8 r2, g2, b2;
1331#ifndef BUILD_NO_DITHER_MASK
1332 DATA8 dith;
1333#endif
1334
1335 dst_ptr = (DATA16 *)dst;
1336
1337 CONVERT_LOOP2_START_ROT_0();
1338
1339 r1 = (R_VAL(src_ptr)) >> 4;
1340 g1 = (G_VAL(src_ptr)) >> 4;
1341 b1 = (B_VAL(src_ptr)) >> 4;
1342
1343#ifndef BUILD_NO_DITHER_MASK
1344 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1345 if (((R_VAL(src_ptr) - (r1 << 4)) >= dith ) && (r1 < 0x0f)) r1++;
1346 if (((G_VAL(src_ptr) - (g1 << 4)) >= dith ) && (g1 < 0x0f)) g1++;
1347 if (((B_VAL(src_ptr) - (b1 << 4)) >= dith ) && (b1 < 0x0f)) b1++;
1348#endif
1349
1350 CONVERT_LOOP2_INC_ROT_0();
1351
1352 r2 = (R_VAL(src_ptr)) >> 4;
1353 g2 = (G_VAL(src_ptr)) >> 4;
1354 b2 = (B_VAL(src_ptr)) >> 4;
1355
1356#ifndef BUILD_NO_DITHER_MASK
1357 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1358 if (((R_VAL(src_ptr) - (r2 << 4)) >= dith ) && (r2 < 0x0f)) r2++;
1359 if (((G_VAL(src_ptr) - (g2 << 4)) >= dith ) && (g2 < 0x0f)) g2++;
1360 if (((B_VAL(src_ptr) - (b2 << 4)) >= dith ) && (b2 < 0x0f)) b2++;
1361#endif
1362
1363#ifndef WORDS_BIGENDIAN
1364 *((DATA32 *)dst_ptr) =
1365 (r2 << 28) | (g2 << 23) | (b2 << 17) |
1366 (r1 << 12) | (g1 << 7 ) | (b1 << 1 );
1367#else
1368 *((DATA32 *)dst_ptr) =
1369 (r1 << 28) | (g1 << 23) | (b1 << 17) |
1370 (r2 << 12) | (g2 << 7 ) | (b2 << 1 );
1371#endif
1372
1373 CONVERT_LOOP2_END_ROT_0();
1374 return;
1375 pal = 0;
1376}
1377#endif
1378#endif
1379
1380#ifdef BUILD_CONVERT_16_RGB_454645
1381#ifdef BUILD_CONVERT_16_RGB_ROT0
1382void
1383evas_common_convert_rgba_to_16bpp_rgb_454645_dith (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1384{
1385 DATA32 *src_ptr;
1386 DATA16 *dst_ptr;
1387 int x, y;
1388 DATA8 r, g, b;
1389#ifndef BUILD_NO_DITHER_MASK
1390 DATA8 dith;
1391#endif
1392
1393 dst_ptr = (DATA16 *)dst;
1394
1395 CONVERT_LOOP_START_ROT_0();
1396
1397 r = (R_VAL(src_ptr)) >> 4;
1398 g = (G_VAL(src_ptr)) >> 4;
1399 b = (B_VAL(src_ptr)) >> 4;
1400
1401#ifndef BUILD_NO_DITHER_MASK
1402 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1403 if (((R_VAL(src_ptr) - (r << 4)) >= dith ) && (r < 0x0f)) r++;
1404 if (((G_VAL(src_ptr) - (g << 4)) >= dith ) && (g < 0x0f)) g++;
1405 if (((B_VAL(src_ptr) - (b << 4)) >= dith ) && (b < 0x0f)) b++;
1406#endif
1407
1408 *dst_ptr = (r << 12) | (g << 7) | (b << 1);
1409
1410 CONVERT_LOOP_END_ROT_0();
1411 return;
1412 pal = 0;
1413}
1414#endif
1415#endif
1416
1417#ifdef BUILD_CONVERT_16_RGB_454645
1418#ifdef BUILD_CONVERT_16_RGB_ROT180
1419void
1420evas_common_convert_rgba2_to_16bpp_rgb_454645_dith_rot_180 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1421{
1422 DATA32 *src_ptr;
1423 DATA16 *dst_ptr;
1424 int x, y;
1425 DATA8 r1, g1, b1;
1426 DATA8 r2, g2, b2;
1427#ifndef BUILD_NO_DITHER_MASK
1428 DATA8 dith;
1429#endif
1430
1431 dst_ptr = (DATA16 *)dst;
1432
1433 CONVERT_LOOP2_START_ROT_180();
1434
1435 r1 = (R_VAL(src_ptr)) >> 4;
1436 g1 = (G_VAL(src_ptr)) >> 4;
1437 b1 = (B_VAL(src_ptr)) >> 4;
1438
1439#ifndef BUILD_NO_DITHER_MASK
1440 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1441 if (((R_VAL(src_ptr) - (r1 << 4)) >= dith ) && (r1 < 0x0f)) r1++;
1442 if (((G_VAL(src_ptr) - (g1 << 4)) >= dith ) && (g1 < 0x0f)) g1++;
1443 if (((B_VAL(src_ptr) - (b1 << 4)) >= dith ) && (b1 < 0x0f)) b1++;
1444#endif
1445
1446 CONVERT_LOOP2_INC_ROT_180();
1447
1448 r2 = (R_VAL(src_ptr)) >> 4;
1449 g2 = (G_VAL(src_ptr)) >> 4;
1450 b2 = (B_VAL(src_ptr)) >> 4;
1451
1452#ifndef BUILD_NO_DITHER_MASK
1453 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1454 if (((R_VAL(src_ptr) - (r2 << 4)) >= dith ) && (r2 < 0x0f)) r2++;
1455 if (((G_VAL(src_ptr) - (g2 << 4)) >= dith ) && (g2 < 0x0f)) g2++;
1456 if (((B_VAL(src_ptr) - (b2 << 4)) >= dith ) && (b2 < 0x0f)) b2++;
1457#endif
1458
1459#ifndef WORDS_BIGENDIAN
1460 *((DATA32 *)dst_ptr) =
1461 (r2 << 28) | (g2 << 23) | (b2 << 17) |
1462 (r1 << 12) | (g1 << 7 ) | (b1 << 1 );
1463#else
1464 *((DATA32 *)dst_ptr) =
1465 (r1 << 28) | (g1 << 23) | (b1 << 17) |
1466 (r2 << 12) | (g2 << 7 ) | (b2 << 1 );
1467#endif
1468
1469 CONVERT_LOOP2_END_ROT_180();
1470 return;
1471 pal = 0;
1472}
1473#endif
1474#endif
1475
1476#ifdef BUILD_CONVERT_16_RGB_454645
1477#ifdef BUILD_CONVERT_16_RGB_ROT180
1478void
1479evas_common_convert_rgba_to_16bpp_rgb_454645_dith_rot_180 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1480{
1481 DATA32 *src_ptr;
1482 DATA16 *dst_ptr;
1483 int x, y;
1484 DATA8 r, g, b;
1485#ifndef BUILD_NO_DITHER_MASK
1486 DATA8 dith;
1487#endif
1488
1489 dst_ptr = (DATA16 *)dst;
1490
1491 CONVERT_LOOP_START_ROT_180();
1492
1493 r = (R_VAL(src_ptr)) >> 4;
1494 g = (G_VAL(src_ptr)) >> 4;
1495 b = (B_VAL(src_ptr)) >> 4;
1496
1497#ifndef BUILD_NO_DITHER_MASK
1498 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1499 if (((R_VAL(src_ptr) - (r << 4)) >= dith ) && (r < 0x0f)) r++;
1500 if (((G_VAL(src_ptr) - (g << 4)) >= dith ) && (g < 0x0f)) g++;
1501 if (((B_VAL(src_ptr) - (b << 4)) >= dith ) && (b < 0x0f)) b++;
1502#endif
1503
1504 *dst_ptr = (r << 12) | (g << 7) | (b << 1);
1505
1506 CONVERT_LOOP_END_ROT_180();
1507 return;
1508 pal = 0;
1509}
1510#endif
1511#endif
1512
1513
1514#ifdef BUILD_CONVERT_16_RGB_454645
1515#ifdef BUILD_CONVERT_16_RGB_ROT270
1516void
1517evas_common_convert_rgba2_to_16bpp_rgb_454645_dith_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1518{
1519 DATA32 *src_ptr;
1520 DATA16 *dst_ptr;
1521 int x, y;
1522 DATA8 r1, g1, b1;
1523 DATA8 r2, g2, b2;
1524#ifndef BUILD_NO_DITHER_MASK
1525 DATA8 dith;
1526#endif
1527
1528 dst_ptr = (DATA16 *)dst;
1529
1530 CONVERT_LOOP2_START_ROT_270();
1531
1532 r1 = (R_VAL(src_ptr)) >> 4;
1533 g1 = (G_VAL(src_ptr)) >> 4;
1534 b1 = (B_VAL(src_ptr)) >> 4;
1535
1536#ifndef BUILD_NO_DITHER_MASK
1537 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1538 if (((R_VAL(src_ptr) - (r1 << 4)) >= dith ) && (r1 < 0x0f)) r1++;
1539 if (((G_VAL(src_ptr) - (g1 << 4)) >= dith ) && (g1 < 0x0f)) g1++;
1540 if (((B_VAL(src_ptr) - (b1 << 4)) >= dith ) && (b1 < 0x0f)) b1++;
1541#endif
1542
1543 CONVERT_LOOP2_INC_ROT_270();
1544
1545 r2 = (R_VAL(src_ptr)) >> 4;
1546 g2 = (G_VAL(src_ptr)) >> 4;
1547 b2 = (B_VAL(src_ptr)) >> 4;
1548
1549#ifndef BUILD_NO_DITHER_MASK
1550 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1551 if (((R_VAL(src_ptr) - (r2 << 4)) >= dith ) && (r2 < 0x0f)) r2++;
1552 if (((G_VAL(src_ptr) - (g2 << 4)) >= dith ) && (g2 < 0x0f)) g2++;
1553 if (((B_VAL(src_ptr) - (b2 << 4)) >= dith ) && (b2 < 0x0f)) b2++;
1554#endif
1555
1556#ifndef WORDS_BIGENDIAN
1557 *((DATA32 *)dst_ptr) =
1558 (r2 << 28) | (g2 << 23) | (b2 << 17) |
1559 (r1 << 12) | (g1 << 7 ) | (b1 << 1 );
1560#else
1561 *((DATA32 *)dst_ptr) =
1562 (r1 << 28) | (g1 << 23) | (b1 << 17) |
1563 (r2 << 12) | (g2 << 7 ) | (b2 << 1 );
1564#endif
1565
1566 CONVERT_LOOP2_END_ROT_270();
1567 return;
1568 pal = 0;
1569}
1570#endif
1571#endif
1572
1573#ifdef BUILD_CONVERT_16_RGB_454645
1574#ifdef BUILD_CONVERT_16_RGB_ROT270
1575void
1576evas_common_convert_rgba_to_16bpp_rgb_454645_dith_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1577{
1578 DATA32 *src_ptr;
1579 DATA16 *dst_ptr;
1580 int x, y;
1581 DATA8 r, g, b;
1582#ifndef BUILD_NO_DITHER_MASK
1583 DATA8 dith;
1584#endif
1585
1586 dst_ptr = (DATA16 *)dst;
1587
1588 CONVERT_LOOP_START_ROT_270();
1589
1590 r = (R_VAL(src_ptr)) >> 4;
1591 g = (G_VAL(src_ptr)) >> 4;
1592 b = (B_VAL(src_ptr)) >> 4;
1593
1594#ifndef BUILD_NO_DITHER_MASK
1595 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1596 if (((R_VAL(src_ptr) - (r << 4)) >= dith ) && (r < 0x0f)) r++;
1597 if (((G_VAL(src_ptr) - (g << 4)) >= dith ) && (g < 0x0f)) g++;
1598 if (((B_VAL(src_ptr) - (b << 4)) >= dith ) && (b < 0x0f)) b++;
1599#endif
1600
1601 *dst_ptr = (r << 12) | (g << 7) | (b << 1);
1602
1603 CONVERT_LOOP_END_ROT_270();
1604 return;
1605 pal = 0;
1606}
1607#endif
1608#endif
1609
1610#ifdef BUILD_CONVERT_16_RGB_454645
1611#ifdef BUILD_CONVERT_16_RGB_ROT90
1612void
1613evas_common_convert_rgba2_to_16bpp_rgb_454645_dith_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1614{
1615 DATA32 *src_ptr;
1616 DATA16 *dst_ptr;
1617 int x, y;
1618 DATA8 r1, g1, b1;
1619 DATA8 r2, g2, b2;
1620#ifndef BUILD_NO_DITHER_MASK
1621 DATA8 dith;
1622#endif
1623
1624 dst_ptr = (DATA16 *)dst;
1625
1626 CONVERT_LOOP2_START_ROT_90();
1627
1628 r1 = (R_VAL(src_ptr)) >> 4;
1629 g1 = (G_VAL(src_ptr)) >> 4;
1630 b1 = (B_VAL(src_ptr)) >> 4;
1631
1632#ifndef BUILD_NO_DITHER_MASK
1633 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1634 if (((R_VAL(src_ptr) - (r1 << 4)) >= dith ) && (r1 < 0x0f)) r1++;
1635 if (((G_VAL(src_ptr) - (g1 << 4)) >= dith ) && (g1 < 0x0f)) g1++;
1636 if (((B_VAL(src_ptr) - (b1 << 4)) >= dith ) && (b1 < 0x0f)) b1++;
1637#endif
1638
1639 CONVERT_LOOP2_INC_ROT_90();
1640
1641 r2 = (R_VAL(src_ptr)) >> 4;
1642 g2 = (G_VAL(src_ptr)) >> 4;
1643 b2 = (B_VAL(src_ptr)) >> 4;
1644
1645#ifndef BUILD_NO_DITHER_MASK
1646 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1647 if (((R_VAL(src_ptr) - (r2 << 4)) >= dith ) && (r2 < 0x0f)) r2++;
1648 if (((G_VAL(src_ptr) - (g2 << 4)) >= dith ) && (g2 < 0x0f)) g2++;
1649 if (((B_VAL(src_ptr) - (b2 << 4)) >= dith ) && (b2 < 0x0f)) b2++;
1650#endif
1651
1652#ifndef WORDS_BIGENDIAN
1653 *((DATA32 *)dst_ptr) =
1654 (r2 << 28) | (g2 << 23) | (b2 << 17) |
1655 (r1 << 12) | (g1 << 7 ) | (b1 << 1 );
1656#else
1657 *((DATA32 *)dst_ptr) =
1658 (r1 << 28) | (g1 << 23) | (b1 << 17) |
1659 (r2 << 12) | (g2 << 7 ) | (b2 << 1 );
1660#endif
1661
1662 CONVERT_LOOP2_END_ROT_90();
1663 return;
1664 pal = 0;
1665}
1666#endif
1667#endif
1668
1669#ifdef BUILD_CONVERT_16_RGB_454645
1670#ifdef BUILD_CONVERT_16_RGB_ROT90
1671void
1672evas_common_convert_rgba_to_16bpp_rgb_454645_dith_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1673{
1674 DATA32 *src_ptr;
1675 DATA16 *dst_ptr;
1676 int x, y;
1677 DATA8 r, g, b;
1678#ifndef BUILD_NO_DITHER_MASK
1679 DATA8 dith;
1680#endif
1681
1682 dst_ptr = (DATA16 *)dst;
1683
1684 CONVERT_LOOP_START_ROT_90();
1685
1686 r = (R_VAL(src_ptr)) >> 4;
1687 g = (G_VAL(src_ptr)) >> 4;
1688 b = (B_VAL(src_ptr)) >> 4;
1689
1690#ifndef BUILD_NO_DITHER_MASK
1691 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1692 if (((R_VAL(src_ptr) - (r << 4)) >= dith ) && (r < 0x0f)) r++;
1693 if (((G_VAL(src_ptr) - (g << 4)) >= dith ) && (g < 0x0f)) g++;
1694 if (((B_VAL(src_ptr) - (b << 4)) >= dith ) && (b < 0x0f)) b++;
1695#endif
1696
1697 *dst_ptr = (r << 12) | (g << 7) | (b << 1);
1698
1699 CONVERT_LOOP_END_ROT_90();
1700 return;
1701 pal = 0;
1702}
1703#endif
1704#endif
1705
1706#ifdef BUILD_CONVERT_16_RGB_555
1707#ifdef BUILD_CONVERT_16_RGB_ROT0
1708void
1709evas_common_convert_rgba2_to_16bpp_rgb_555_dith (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1710{
1711 DATA32 *src_ptr;
1712 DATA16 *dst_ptr;
1713 int x, y;
1714 DATA8 r1, g1, b1;
1715 DATA8 r2, g2, b2;
1716#ifndef BUILD_NO_DITHER_MASK
1717 DATA8 dith;
1718#endif
1719
1720 dst_ptr = (DATA16 *)dst;
1721
1722 CONVERT_LOOP2_START_ROT_0();
1723
1724 r1 = (R_VAL(src_ptr)) >> 3;
1725 g1 = (G_VAL(src_ptr)) >> 3;
1726 b1 = (B_VAL(src_ptr)) >> 3;
1727
1728#ifndef BUILD_NO_DITHER_MASK
1729 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1730 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith) && (r1 < 0x1f)) r1++;
1731 if (((G_VAL(src_ptr) - (g1 << 3)) >= dith) && (g1 < 0x1f)) g1++;
1732 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith) && (b1 < 0x1f)) b1++;
1733#endif
1734
1735 CONVERT_LOOP2_INC_ROT_0();
1736
1737 r2 = (R_VAL(src_ptr)) >> 3;
1738 g2 = (G_VAL(src_ptr)) >> 3;
1739 b2 = (B_VAL(src_ptr)) >> 3;
1740
1741#ifndef BUILD_NO_DITHER_MASK
1742 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1743 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith) && (r2 < 0x1f)) r2++;
1744 if (((G_VAL(src_ptr) - (g2 << 3)) >= dith) && (g2 < 0x1f)) g2++;
1745 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith) && (b2 < 0x1f)) b2++;
1746#endif
1747
1748#ifndef WORDS_BIGENDIAN
1749 *((DATA32 *)dst_ptr) =
1750 (r2 << 26) | (g2 << 21) | (b2 << 16) |
1751 (r1 << 10) | (g1 << 5 ) | (b1 );
1752#else
1753 *((DATA32 *)dst_ptr) =
1754 (r1 << 26) | (g1 << 21) | (b1 << 16) |
1755 (r2 << 10) | (g2 << 5 ) | (b2 );
1756#endif
1757
1758 CONVERT_LOOP2_END_ROT_0();
1759 return;
1760 pal = 0;
1761}
1762#endif
1763#endif
1764
1765#ifdef BUILD_CONVERT_16_RGB_555
1766#ifdef BUILD_CONVERT_16_RGB_ROT0
1767void
1768evas_common_convert_rgba_to_16bpp_rgb_555_dith (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1769{
1770 DATA32 *src_ptr;
1771 DATA16 *dst_ptr;
1772 int x, y;
1773 DATA8 r, g, b;
1774#ifndef BUILD_NO_DITHER_MASK
1775 DATA8 dith;
1776#endif
1777
1778 dst_ptr = (DATA16 *)dst;
1779
1780 CONVERT_LOOP_START_ROT_0();
1781
1782 r = (R_VAL(src_ptr)) >> 3;
1783 g = (G_VAL(src_ptr)) >> 3;
1784 b = (B_VAL(src_ptr)) >> 3;
1785
1786#ifndef BUILD_NO_DITHER_MASK
1787 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1788 if (((R_VAL(src_ptr) - (r << 3)) >= dith) && (r < 0x1f)) r++;
1789 if (((G_VAL(src_ptr) - (g << 3)) >= dith) && (g < 0x1f)) g++;
1790 if (((B_VAL(src_ptr) - (b << 3)) >= dith) && (b < 0x1f)) b++;
1791#endif
1792
1793 *dst_ptr = (r << 10) | (g << 5) | (b);
1794
1795 CONVERT_LOOP_END_ROT_0();
1796 return;
1797 pal = 0;
1798}
1799#endif
1800#endif
1801
1802#ifdef BUILD_CONVERT_16_RGB_555
1803#ifdef BUILD_CONVERT_16_RGB_ROT180
1804void
1805evas_common_convert_rgba2_to_16bpp_rgb_555_dith_rot_180 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1806{
1807 DATA32 *src_ptr;
1808 DATA16 *dst_ptr;
1809 int x, y;
1810 DATA8 r1, g1, b1;
1811 DATA8 r2, g2, b2;
1812#ifndef BUILD_NO_DITHER_MASK
1813 DATA8 dith;
1814#endif
1815
1816 dst_ptr = (DATA16 *)dst;
1817
1818 CONVERT_LOOP2_START_ROT_180();
1819
1820 r1 = (R_VAL(src_ptr)) >> 3;
1821 g1 = (G_VAL(src_ptr)) >> 3;
1822 b1 = (B_VAL(src_ptr)) >> 3;
1823
1824#ifndef BUILD_NO_DITHER_MASK
1825 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1826 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith) && (r1 < 0x1f)) r1++;
1827 if (((G_VAL(src_ptr) - (g1 << 3)) >= dith) && (g1 < 0x1f)) g1++;
1828 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith) && (b1 < 0x1f)) b1++;
1829#endif
1830
1831 CONVERT_LOOP2_INC_ROT_180();
1832
1833 r2 = (R_VAL(src_ptr)) >> 3;
1834 g2 = (G_VAL(src_ptr)) >> 3;
1835 b2 = (B_VAL(src_ptr)) >> 3;
1836
1837#ifndef BUILD_NO_DITHER_MASK
1838 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1839 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith) && (r2 < 0x1f)) r2++;
1840 if (((G_VAL(src_ptr) - (g2 << 3)) >= dith) && (g2 < 0x1f)) g2++;
1841 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith) && (b2 < 0x1f)) b2++;
1842#endif
1843
1844#ifndef WORDS_BIGENDIAN
1845 *((DATA32 *)dst_ptr) =
1846 (r2 << 26) | (g2 << 21) | (b2 << 16) |
1847 (r1 << 10) | (g1 << 5 ) | (b1 );
1848#else
1849 *((DATA32 *)dst_ptr) =
1850 (r1 << 26) | (g1 << 21) | (b1 << 16) |
1851 (r2 << 10) | (g2 << 5 ) | (b2 );
1852#endif
1853
1854 CONVERT_LOOP2_END_ROT_180();
1855 return;
1856 pal = 0;
1857}
1858#endif
1859#endif
1860
1861#ifdef BUILD_CONVERT_16_RGB_555
1862#ifdef BUILD_CONVERT_16_RGB_ROT180
1863void
1864evas_common_convert_rgba_to_16bpp_rgb_555_dith_rot_180 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1865{
1866 DATA32 *src_ptr;
1867 DATA16 *dst_ptr;
1868 int x, y;
1869 DATA8 r, g, b;
1870#ifndef BUILD_NO_DITHER_MASK
1871 DATA8 dith;
1872#endif
1873
1874 dst_ptr = (DATA16 *)dst;
1875
1876 CONVERT_LOOP_START_ROT_180();
1877
1878 r = (R_VAL(src_ptr)) >> 3;
1879 g = (G_VAL(src_ptr)) >> 3;
1880 b = (B_VAL(src_ptr)) >> 3;
1881
1882#ifndef BUILD_NO_DITHER_MASK
1883 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1884 if (((R_VAL(src_ptr) - (r << 3)) >= dith) && (r < 0x1f)) r++;
1885 if (((G_VAL(src_ptr) - (g << 3)) >= dith) && (g < 0x1f)) g++;
1886 if (((B_VAL(src_ptr) - (b << 3)) >= dith) && (b < 0x1f)) b++;
1887#endif
1888
1889 *dst_ptr = (r << 10) | (g << 5) | (b);
1890
1891 CONVERT_LOOP_END_ROT_180();
1892 return;
1893 pal = 0;
1894}
1895#endif
1896#endif
1897
1898#ifdef BUILD_CONVERT_16_RGB_555
1899#ifdef BUILD_CONVERT_16_RGB_ROT270
1900void
1901evas_common_convert_rgba2_to_16bpp_rgb_555_dith_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1902{
1903 DATA32 *src_ptr;
1904 DATA16 *dst_ptr;
1905 int x, y;
1906 DATA8 r1, g1, b1;
1907 DATA8 r2, g2, b2;
1908#ifndef BUILD_NO_DITHER_MASK
1909 DATA8 dith;
1910#endif
1911
1912 dst_ptr = (DATA16 *)dst;
1913
1914 CONVERT_LOOP2_START_ROT_270();
1915
1916 r1 = (R_VAL(src_ptr)) >> 3;
1917 g1 = (G_VAL(src_ptr)) >> 3;
1918 b1 = (B_VAL(src_ptr)) >> 3;
1919
1920#ifndef BUILD_NO_DITHER_MASK
1921 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1922 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith) && (r1 < 0x1f)) r1++;
1923 if (((G_VAL(src_ptr) - (g1 << 3)) >= dith) && (g1 < 0x1f)) g1++;
1924 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith) && (b1 < 0x1f)) b1++;
1925#endif
1926
1927 CONVERT_LOOP2_INC_ROT_270();
1928
1929 r2 = (R_VAL(src_ptr)) >> 3;
1930 g2 = (G_VAL(src_ptr)) >> 3;
1931 b2 = (B_VAL(src_ptr)) >> 3;
1932
1933#ifndef BUILD_NO_DITHER_MASK
1934 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1935 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith) && (r2 < 0x1f)) r2++;
1936 if (((G_VAL(src_ptr) - (g2 << 3)) >= dith) && (g2 < 0x1f)) g2++;
1937 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith) && (b2 < 0x1f)) b2++;
1938#endif
1939
1940#ifndef WORDS_BIGENDIAN
1941 *((DATA32 *)dst_ptr) =
1942 (r2 << 26) | (g2 << 21) | (b2 << 16) |
1943 (r1 << 10) | (g1 << 5 ) | (b1 );
1944#else
1945 *((DATA32 *)dst_ptr) =
1946 (r1 << 26) | (g1 << 21) | (b1 << 16) |
1947 (r2 << 10) | (g2 << 5 ) | (b2 );
1948#endif
1949
1950 CONVERT_LOOP2_END_ROT_270();
1951 return;
1952 pal = 0;
1953}
1954#endif
1955#endif
1956
1957#ifdef BUILD_CONVERT_16_RGB_555
1958#ifdef BUILD_CONVERT_16_RGB_ROT270
1959void
1960evas_common_convert_rgba_to_16bpp_rgb_555_dith_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1961{
1962 DATA32 *src_ptr;
1963 DATA16 *dst_ptr;
1964 int x, y;
1965 DATA8 r, g, b;
1966#ifndef BUILD_NO_DITHER_MASK
1967 DATA8 dith;
1968#endif
1969
1970 dst_ptr = (DATA16 *)dst;
1971
1972 CONVERT_LOOP_START_ROT_270();
1973
1974 r = (R_VAL(src_ptr)) >> 3;
1975 g = (G_VAL(src_ptr)) >> 3;
1976 b = (B_VAL(src_ptr)) >> 3;
1977
1978#ifndef BUILD_NO_DITHER_MASK
1979 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1980 if (((R_VAL(src_ptr) - (r << 3)) >= dith) && (r < 0x1f)) r++;
1981 if (((G_VAL(src_ptr) - (g << 3)) >= dith) && (g < 0x1f)) g++;
1982 if (((B_VAL(src_ptr) - (b << 3)) >= dith) && (b < 0x1f)) b++;
1983#endif
1984
1985 *dst_ptr = (r << 10) | (g << 5) | (b);
1986
1987 CONVERT_LOOP_END_ROT_270();
1988 return;
1989 pal = 0;
1990}
1991#endif
1992#endif
1993
1994#ifdef BUILD_CONVERT_16_RGB_555
1995#ifdef BUILD_CONVERT_16_RGB_ROT90
1996void
1997evas_common_convert_rgba2_to_16bpp_rgb_555_dith_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
1998{
1999 DATA32 *src_ptr;
2000 DATA16 *dst_ptr;
2001 int x, y;
2002 DATA8 r1, g1, b1;
2003 DATA8 r2, g2, b2;
2004#ifndef BUILD_NO_DITHER_MASK
2005 DATA8 dith;
2006#endif
2007
2008 dst_ptr = (DATA16 *)dst;
2009
2010 CONVERT_LOOP2_START_ROT_90();
2011
2012 r1 = (R_VAL(src_ptr)) >> 3;
2013 g1 = (G_VAL(src_ptr)) >> 3;
2014 b1 = (B_VAL(src_ptr)) >> 3;
2015
2016#ifndef BUILD_NO_DITHER_MASK
2017 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
2018 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith) && (r1 < 0x1f)) r1++;
2019 if (((G_VAL(src_ptr) - (g1 << 3)) >= dith) && (g1 < 0x1f)) g1++;
2020 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith) && (b1 < 0x1f)) b1++;
2021#endif
2022
2023 CONVERT_LOOP2_INC_ROT_90();
2024
2025 r2 = (R_VAL(src_ptr)) >> 3;
2026 g2 = (G_VAL(src_ptr)) >> 3;
2027 b2 = (B_VAL(src_ptr)) >> 3;
2028
2029#ifndef BUILD_NO_DITHER_MASK
2030 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
2031 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith) && (r2 < 0x1f)) r2++;
2032 if (((G_VAL(src_ptr) - (g2 << 3)) >= dith) && (g2 < 0x1f)) g2++;
2033 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith) && (b2 < 0x1f)) b2++;
2034#endif
2035
2036#ifndef WORDS_BIGENDIAN
2037 *((DATA32 *)dst_ptr) =
2038 (r2 << 26) | (g2 << 21) | (b2 << 16) |
2039 (r1 << 10) | (g1 << 5 ) | (b1 );
2040#else
2041 *((DATA32 *)dst_ptr) =
2042 (r1 << 26) | (g1 << 21) | (b1 << 16) |
2043 (r2 << 10) | (g2 << 5 ) | (b2 );
2044#endif
2045
2046 CONVERT_LOOP2_END_ROT_90();
2047 return;
2048 pal = 0;
2049}
2050#endif
2051#endif
2052
2053#ifdef BUILD_CONVERT_16_RGB_555
2054#ifdef BUILD_CONVERT_16_RGB_ROT90
2055void
2056evas_common_convert_rgba_to_16bpp_rgb_555_dith_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal)
2057{
2058 DATA32 *src_ptr;
2059 DATA16 *dst_ptr;
2060 int x, y;
2061 DATA8 r, g, b;
2062#ifndef BUILD_NO_DITHER_MASK
2063 DATA8 dith;
2064#endif
2065
2066 dst_ptr = (DATA16 *)dst;
2067
2068 CONVERT_LOOP_START_ROT_90();
2069
2070 r = (R_VAL(src_ptr)) >> 3;
2071 g = (G_VAL(src_ptr)) >> 3;
2072 b = (B_VAL(src_ptr)) >> 3;
2073
2074#ifndef BUILD_NO_DITHER_MASK
2075 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
2076 if (((R_VAL(src_ptr) - (r << 3)) >= dith) && (r < 0x1f)) r++;
2077 if (((G_VAL(src_ptr) - (g << 3)) >= dith) && (g < 0x1f)) g++;
2078 if (((B_VAL(src_ptr) - (b << 3)) >= dith) && (b < 0x1f)) b++;
2079#endif
2080
2081 *dst_ptr = (r << 10) | (g << 5) | (b);
2082
2083 CONVERT_LOOP_END_ROT_90();
2084 return;
2085 pal = 0;
2086}
2087#endif
2088#endif
2089