2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
5 #include "evas_common.h"
6 #include "evas_convert_rgb_16.h"
8 #ifndef BUILD_NO_DITHER_MASK
10 extern const DATA8 _evas_dither_44[4][4];
12 #ifdef USE_DITHER_128128
13 extern const DATA8 _evas_dither_128128[128][128];
17 #ifdef BUILD_CONVERT_16_RGB_565
18 #ifdef BUILD_CONVERT_16_RGB_ROT0
20 evas_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)
27 #ifndef BUILD_NO_DITHER_MASK
31 dst_ptr = (DATA16 *)dst;
33 CONVERT_LOOP2_START_ROT_0();
35 r1 = (R_VAL(src_ptr)) >> 3;
36 g1 = (G_VAL(src_ptr)) >> 2;
37 b1 = (B_VAL(src_ptr)) >> 3;
38 #ifndef BUILD_NO_DITHER_MASK
39 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
40 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
41 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++;
42 if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++;
43 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++;
45 CONVERT_LOOP2_INC_ROT_0();
47 r2 = (R_VAL(src_ptr)) >> 3;
48 g2 = (G_VAL(src_ptr)) >> 2;
49 b2 = (B_VAL(src_ptr)) >> 3;
50 #ifndef BUILD_NO_DITHER_MASK
51 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
52 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
53 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++;
54 if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++;
55 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++;
58 #ifndef WORDS_BIGENDIAN
59 *((DATA32 *)dst_ptr) =
60 (r2 << 27) | (g2 << 21) | (b2 << 16) |
61 (r1 << 11) | (g1 << 5 ) | (b1 );
63 *((DATA32 *)dst_ptr) =
64 (r1 << 27) | (g1 << 21) | (b1 << 16) |
65 (r2 << 11) | (g2 << 5 ) | (b2 );
68 CONVERT_LOOP2_END_ROT_0();
75 #ifdef BUILD_CONVERT_16_RGB_565
76 #ifdef BUILD_CONVERT_16_RGB_ROT0
78 evas_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)
84 #ifndef BUILD_NO_DITHER_MASK
88 dst_ptr = (DATA16 *)dst;
90 CONVERT_LOOP_START_ROT_0();
92 r = (R_VAL(src_ptr)) >> 3;
93 g = (G_VAL(src_ptr)) >> 2;
94 b = (B_VAL(src_ptr)) >> 3;
96 #ifndef BUILD_NO_DITHER_MASK
97 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
98 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
99 if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++;
100 if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++;
101 if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++;
104 *dst_ptr = (r << 11) | (g << 5) | (b);
106 CONVERT_LOOP_END_ROT_0();
113 #ifdef BUILD_CONVERT_16_RGB_565
114 #ifdef BUILD_CONVERT_16_RGB_ROT180
116 evas_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)
123 #ifndef BUILD_NO_DITHER_MASK
127 dst_ptr = (DATA16 *)dst;
129 CONVERT_LOOP2_START_ROT_180();
131 r1 = (R_VAL(src_ptr)) >> 3;
132 g1 = (G_VAL(src_ptr)) >> 2;
133 b1 = (B_VAL(src_ptr)) >> 3;
135 #ifndef BUILD_NO_DITHER_MASK
136 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
137 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
138 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++;
139 if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++;
140 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++;
143 CONVERT_LOOP2_INC_ROT_180();
145 r2 = (R_VAL(src_ptr)) >> 3;
146 g2 = (G_VAL(src_ptr)) >> 2;
147 b2 = (B_VAL(src_ptr)) >> 3;
149 #ifndef BUILD_NO_DITHER_MASK
150 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
151 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
152 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++;
153 if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++;
154 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++;
157 #ifndef WORDS_BIGENDIAN
158 *((DATA32 *)dst_ptr) =
159 (r2 << 27) | (g2 << 21) | (b2 << 16) |
160 (r1 << 11) | (g1 << 5 ) | (b1 );
162 *((DATA32 *)dst_ptr) =
163 (r1 << 27) | (g1 << 21) | (b1 << 16) |
164 (r2 << 11) | (g2 << 5 ) | (b2 );
167 CONVERT_LOOP2_END_ROT_180();
174 #ifdef BUILD_CONVERT_16_RGB_565
175 #ifdef BUILD_CONVERT_16_RGB_ROT180
177 evas_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)
183 #ifndef BUILD_NO_DITHER_MASK
187 dst_ptr = (DATA16 *)dst;
189 CONVERT_LOOP_START_ROT_180();
191 r = (R_VAL(src_ptr)) >> 3;
192 g = (G_VAL(src_ptr)) >> 2;
193 b = (B_VAL(src_ptr)) >> 3;
195 #ifndef BUILD_NO_DITHER_MASK
196 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
197 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
198 if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++;
199 if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++;
200 if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++;
203 *dst_ptr = (r << 11) | (g << 5) | (b);
205 CONVERT_LOOP_END_ROT_180();
212 #ifdef BUILD_CONVERT_16_RGB_565
213 #ifdef BUILD_CONVERT_16_RGB_ROT270
215 evas_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)
222 #ifndef BUILD_NO_DITHER_MASK
226 dst_ptr = (DATA16 *)dst;
228 CONVERT_LOOP2_START_ROT_270();
230 r1 = (R_VAL(src_ptr)) >> 3;
231 g1 = (G_VAL(src_ptr)) >> 2;
232 b1 = (B_VAL(src_ptr)) >> 3;
234 #ifndef BUILD_NO_DITHER_MASK
235 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
236 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
237 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++;
238 if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++;
239 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++;
242 CONVERT_LOOP2_INC_ROT_270();
244 r2 = (R_VAL(src_ptr)) >> 3;
245 g2 = (G_VAL(src_ptr)) >> 2;
246 b2 = (B_VAL(src_ptr)) >> 3;
248 #ifndef BUILD_NO_DITHER_MASK
249 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
250 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
251 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++;
252 if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++;
253 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++;
256 #ifndef WORDS_BIGENDIAN
257 *((DATA32 *)dst_ptr) =
258 (r2 << 27) | (g2 << 21) | (b2 << 16) |
259 (r1 << 11) | (g1 << 5 ) | (b1 );
261 *((DATA32 *)dst_ptr) =
262 (r1 << 27) | (g1 << 21) | (b1 << 16) |
263 (r2 << 11) | (g2 << 5 ) | (b2 );
266 CONVERT_LOOP2_END_ROT_270();
273 #ifdef BUILD_CONVERT_16_RGB_565
274 #ifdef BUILD_CONVERT_16_RGB_ROT270
276 evas_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)
282 #ifndef BUILD_NO_DITHER_MASK
286 dst_ptr = (DATA16 *)dst;
288 CONVERT_LOOP_START_ROT_270();
290 r = (R_VAL(src_ptr)) >> 3;
291 g = (G_VAL(src_ptr)) >> 2;
292 b = (B_VAL(src_ptr)) >> 3;
294 #ifndef BUILD_NO_DITHER_MASK
295 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
296 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
297 if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++;
298 if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++;
299 if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++;
302 *dst_ptr = (r << 11) | (g << 5) | (b);
304 CONVERT_LOOP_END_ROT_270();
311 #ifdef BUILD_CONVERT_16_RGB_565
312 #ifdef BUILD_CONVERT_16_RGB_ROT90
314 evas_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)
321 #ifndef BUILD_NO_DITHER_MASK
325 dst_ptr = (DATA16 *)dst;
327 CONVERT_LOOP2_START_ROT_90();
329 r1 = (R_VAL(src_ptr)) >> 3;
330 g1 = (G_VAL(src_ptr)) >> 2;
331 b1 = (B_VAL(src_ptr)) >> 3;
333 #ifndef BUILD_NO_DITHER_MASK
334 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
335 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
336 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++;
337 if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++;
338 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++;
341 CONVERT_LOOP2_INC_ROT_90();
343 r2 = (R_VAL(src_ptr)) >> 3;
344 g2 = (G_VAL(src_ptr)) >> 2;
345 b2 = (B_VAL(src_ptr)) >> 3;
347 #ifndef BUILD_NO_DITHER_MASK
348 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
349 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
350 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++;
351 if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++;
352 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++;
355 #ifndef WORDS_BIGENDIAN
356 *((DATA32 *)dst_ptr) =
357 (r2 << 27) | (g2 << 21) | (b2 << 16) |
358 (r1 << 11) | (g1 << 5 ) | (b1 );
360 *((DATA32 *)dst_ptr) =
361 (r1 << 27) | (g1 << 21) | (b1 << 16) |
362 (r2 << 11) | (g2 << 5 ) | (b2 );
365 CONVERT_LOOP2_END_ROT_90();
372 #ifdef BUILD_CONVERT_16_RGB_565
373 #ifdef BUILD_CONVERT_16_RGB_ROT90
375 evas_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)
381 #ifndef BUILD_NO_DITHER_MASK
385 dst_ptr = (DATA16 *)dst;
387 CONVERT_LOOP_START_ROT_90();
389 r = (R_VAL(src_ptr)) >> 3;
390 g = (G_VAL(src_ptr)) >> 2;
391 b = (B_VAL(src_ptr)) >> 3;
393 #ifndef BUILD_NO_DITHER_MASK
394 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
395 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
396 if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++;
397 if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++;
398 if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++;
401 *dst_ptr = (r << 11) | (g << 5) | (b);
403 CONVERT_LOOP_END_ROT_90();
410 #ifdef BUILD_CONVERT_16_BGR_565
411 #ifdef BUILD_CONVERT_16_RGB_ROT0
413 evas_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)
420 #ifndef BUILD_NO_DITHER_MASK
424 dst_ptr = (DATA16 *)dst;
426 CONVERT_LOOP2_START_ROT_0();
428 r1 = (R_VAL(src_ptr)) >> 3;
429 g1 = (G_VAL(src_ptr)) >> 2;
430 b1 = (B_VAL(src_ptr)) >> 3;
432 #ifndef BUILD_NO_DITHER_MASK
433 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
434 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
435 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++;
436 if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++;
437 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++;
440 CONVERT_LOOP2_INC_ROT_0();
442 r2 = (R_VAL(src_ptr)) >> 3;
443 g2 = (G_VAL(src_ptr)) >> 2;
444 b2 = (B_VAL(src_ptr)) >> 3;
446 #ifndef BUILD_NO_DITHER_MASK
447 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
448 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
449 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++;
450 if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++;
451 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++;
454 #ifndef WORDS_BIGENDIAN
455 *((DATA32 *)dst_ptr) =
456 (b2 << 27) | (g2 << 21) | (r2 << 16) |
457 (b1 << 11) | (g1 << 5 ) | (r1 );
459 *((DATA32 *)dst_ptr) =
460 (b1 << 27) | (g1 << 21) | (r1 << 16) |
461 (b2 << 11) | (g2 << 5 ) | (r2 );
464 CONVERT_LOOP2_END_ROT_0();
471 #ifdef BUILD_CONVERT_16_BGR_565
472 #ifdef BUILD_CONVERT_16_RGB_ROT0
474 evas_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)
480 #ifndef BUILD_NO_DITHER_MASK
484 dst_ptr = (DATA16 *)dst;
486 CONVERT_LOOP_START_ROT_0();
488 r = (R_VAL(src_ptr)) >> 3;
489 g = (G_VAL(src_ptr)) >> 2;
490 b = (B_VAL(src_ptr)) >> 3;
492 #ifndef BUILD_NO_DITHER_MASK
493 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
494 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
495 if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++;
496 if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++;
497 if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++;
500 *dst_ptr = (b << 11) | (g << 5) | (r);
502 CONVERT_LOOP_END_ROT_0();
509 #ifdef BUILD_CONVERT_16_BGR_565
510 #ifdef BUILD_CONVERT_16_RGB_ROT180
512 evas_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)
519 #ifndef BUILD_NO_DITHER_MASK
523 dst_ptr = (DATA16 *)dst;
525 CONVERT_LOOP2_START_ROT_180();
527 r1 = (R_VAL(src_ptr)) >> 3;
528 g1 = (G_VAL(src_ptr)) >> 2;
529 b1 = (B_VAL(src_ptr)) >> 3;
531 #ifndef BUILD_NO_DITHER_MASK
532 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
533 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
534 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++;
535 if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++;
536 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++;
539 CONVERT_LOOP2_INC_ROT_180();
541 r2 = (R_VAL(src_ptr)) >> 3;
542 g2 = (G_VAL(src_ptr)) >> 2;
543 b2 = (B_VAL(src_ptr)) >> 3;
545 #ifndef BUILD_NO_DITHER_MASK
546 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
547 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
548 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++;
549 if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++;
550 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++;
553 #ifndef WORDS_BIGENDIAN
554 *((DATA32 *)dst_ptr) =
555 (b2 << 27) | (g2 << 21) | (r2 << 16) |
556 (b1 << 11) | (g1 << 5 ) | (r1 );
558 *((DATA32 *)dst_ptr) =
559 (b1 << 27) | (g1 << 21) | (r1 << 16) |
560 (b2 << 11) | (g2 << 5 ) | (r2 );
563 CONVERT_LOOP2_END_ROT_180();
570 #ifdef BUILD_CONVERT_16_BGR_565
571 #ifdef BUILD_CONVERT_16_RGB_ROT180
573 evas_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)
579 #ifndef BUILD_NO_DITHER_MASK
583 dst_ptr = (DATA16 *)dst;
585 fprintf(stderr, "evas_common_convert_rgba_to_16bpp_bgr_565_dith_rot_180\n");
587 CONVERT_LOOP_START_ROT_180();
589 r = (R_VAL(src_ptr)) >> 3;
590 g = (G_VAL(src_ptr)) >> 2;
591 b = (B_VAL(src_ptr)) >> 3;
593 #ifndef BUILD_NO_DITHER_MASK
594 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
595 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
596 if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++;
597 if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++;
598 if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++;
601 *dst_ptr = (b << 11) | (g << 5) | (r);
603 CONVERT_LOOP_END_ROT_180();
610 #ifdef BUILD_CONVERT_16_BGR_565
611 #ifdef BUILD_CONVERT_16_RGB_ROT270
613 evas_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)
620 #ifndef BUILD_NO_DITHER_MASK
624 dst_ptr = (DATA16 *)dst;
626 CONVERT_LOOP2_START_ROT_270();
628 r1 = (R_VAL(src_ptr)) >> 3;
629 g1 = (G_VAL(src_ptr)) >> 2;
630 b1 = (B_VAL(src_ptr)) >> 3;
632 #ifndef BUILD_NO_DITHER_MASK
633 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
634 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
635 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++;
636 if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++;
637 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++;
640 CONVERT_LOOP2_INC_ROT_270();
642 r2 = (R_VAL(src_ptr)) >> 3;
643 g2 = (G_VAL(src_ptr)) >> 2;
644 b2 = (B_VAL(src_ptr)) >> 3;
646 #ifndef BUILD_NO_DITHER_MASK
647 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
648 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
649 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++;
650 if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++;
651 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++;
654 #ifndef WORDS_BIGENDIAN
655 *((DATA32 *)dst_ptr) =
656 (b2 << 27) | (g2 << 21) | (r2 << 16) |
657 (b1 << 11) | (g1 << 5 ) | (r1 );
659 *((DATA32 *)dst_ptr) =
660 (b1 << 27) | (g1 << 21) | (r1 << 16) |
661 (b2 << 11) | (g2 << 5 ) | (r2 );
664 CONVERT_LOOP2_END_ROT_270();
671 #ifdef BUILD_CONVERT_16_BGR_565
672 #ifdef BUILD_CONVERT_16_RGB_ROT270
674 evas_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)
680 #ifndef BUILD_NO_DITHER_MASK
684 dst_ptr = (DATA16 *)dst;
686 CONVERT_LOOP_START_ROT_270();
688 r = (R_VAL(src_ptr)) >> 3;
689 g = (G_VAL(src_ptr)) >> 2;
690 b = (B_VAL(src_ptr)) >> 3;
692 #ifndef BUILD_NO_DITHER_MASK
693 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
694 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
695 if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++;
696 if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++;
697 if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++;
700 *dst_ptr = (b << 11) | (g << 5) | (r);
702 CONVERT_LOOP_END_ROT_270();
709 #ifdef BUILD_CONVERT_16_BGR_565
710 #ifdef BUILD_CONVERT_16_RGB_ROT90
712 evas_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)
719 #ifndef BUILD_NO_DITHER_MASK
723 dst_ptr = (DATA16 *)dst;
725 CONVERT_LOOP2_START_ROT_90();
727 r1 = (R_VAL(src_ptr)) >> 3;
728 g1 = (G_VAL(src_ptr)) >> 2;
729 b1 = (B_VAL(src_ptr)) >> 3;
731 #ifndef BUILD_NO_DITHER_MASK
732 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
733 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
734 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith ) && (r1 < 0x1f)) r1++;
735 if (((G_VAL(src_ptr) - (g1 << 2)) >= dith2) && (g1 < 0x3f)) g1++;
736 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith ) && (b1 < 0x1f)) b1++;
739 CONVERT_LOOP2_INC_ROT_90();
741 r2 = (R_VAL(src_ptr)) >> 3;
742 g2 = (G_VAL(src_ptr)) >> 2;
743 b2 = (B_VAL(src_ptr)) >> 3;
745 #ifndef BUILD_NO_DITHER_MASK
746 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
747 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
748 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith ) && (r2 < 0x1f)) r2++;
749 if (((G_VAL(src_ptr) - (g2 << 2)) >= dith2) && (g2 < 0x3f)) g2++;
750 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith ) && (b2 < 0x1f)) b2++;
753 #ifndef WORDS_BIGENDIAN
754 *((DATA32 *)dst_ptr) =
755 (b2 << 27) | (g2 << 21) | (r2 << 16) |
756 (b1 << 11) | (g1 << 5 ) | (r1 );
758 *((DATA32 *)dst_ptr) =
759 (b1 << 27) | (g1 << 21) | (r1 << 16) |
760 (b2 << 11) | (g2 << 5 ) | (r2 );
763 CONVERT_LOOP2_END_ROT_90();
770 #ifdef BUILD_CONVERT_16_BGR_565
771 #ifdef BUILD_CONVERT_16_RGB_ROT90
773 evas_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)
779 #ifndef BUILD_NO_DITHER_MASK
783 dst_ptr = (DATA16 *)dst;
785 CONVERT_LOOP_START_ROT_90();
787 r = (R_VAL(src_ptr)) >> 3;
788 g = (G_VAL(src_ptr)) >> 2;
789 b = (B_VAL(src_ptr)) >> 3;
791 #ifndef BUILD_NO_DITHER_MASK
792 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
793 dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(6);
794 if (((R_VAL(src_ptr) - (r << 3)) >= dith ) && (r < 0x1f)) r++;
795 if (((G_VAL(src_ptr) - (g << 2)) >= dith2) && (g < 0x3f)) g++;
796 if (((B_VAL(src_ptr) - (b << 3)) >= dith ) && (b < 0x1f)) b++;
799 *dst_ptr = (b << 11) | (g << 5) | (r);
801 CONVERT_LOOP_END_ROT_90();
808 #ifdef BUILD_CONVERT_16_RGB_444
809 #ifdef BUILD_CONVERT_16_RGB_ROT0
811 evas_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)
818 #ifndef BUILD_NO_DITHER_MASK
822 dst_ptr = (DATA16 *)dst;
824 CONVERT_LOOP2_START_ROT_0();
826 r1 = (R_VAL(src_ptr)) >> 4;
827 g1 = (G_VAL(src_ptr)) >> 4;
828 b1 = (B_VAL(src_ptr)) >> 4;
830 #ifndef BUILD_NO_DITHER_MASK
831 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
832 if (((R_VAL(src_ptr) - (r1 << 4)) >= dith ) && (r1 < 0x0f)) r1++;
833 if (((G_VAL(src_ptr) - (g1 << 4)) >= dith ) && (g1 < 0x0f)) g1++;
834 if (((B_VAL(src_ptr) - (b1 << 4)) >= dith ) && (b1 < 0x0f)) b1++;
837 CONVERT_LOOP2_INC_ROT_0();
839 r2 = (R_VAL(src_ptr)) >> 4;
840 g2 = (G_VAL(src_ptr)) >> 4;
841 b2 = (B_VAL(src_ptr)) >> 4;
843 #ifndef BUILD_NO_DITHER_MASK
844 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
845 if (((R_VAL(src_ptr) - (r2 << 4)) >= dith ) && (r2 < 0x0f)) r2++;
846 if (((G_VAL(src_ptr) - (g2 << 4)) >= dith ) && (g2 < 0x0f)) g2++;
847 if (((B_VAL(src_ptr) - (b2 << 4)) >= dith ) && (b2 < 0x0f)) b2++;
850 #ifndef WORDS_BIGENDIAN
851 *((DATA32 *)dst_ptr) =
852 (r2 << 24) | (g2 << 20) | (b2 << 16) |
853 (r1 << 8 ) | (g1 << 4 ) | (b1 );
855 *((DATA32 *)dst_ptr) =
856 (r1 << 24) | (g1 << 20) | (b1 << 16) |
857 (r2 << 8 ) | (g2 << 4 ) | (b2 );
860 CONVERT_LOOP2_END_ROT_0();
867 #ifdef BUILD_CONVERT_16_RGB_444
868 #ifdef BUILD_CONVERT_16_RGB_ROT0
870 evas_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)
876 #ifndef BUILD_NO_DITHER_MASK
880 dst_ptr = (DATA16 *)dst;
882 CONVERT_LOOP_START_ROT_0();
884 r = (R_VAL(src_ptr)) >> 4;
885 g = (G_VAL(src_ptr)) >> 4;
886 b = (B_VAL(src_ptr)) >> 4;
888 #ifndef BUILD_NO_DITHER_MASK
889 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
890 if (((R_VAL(src_ptr) - (r << 4)) >= dith ) && (r < 0x0f)) r++;
891 if (((G_VAL(src_ptr) - (g << 4)) >= dith ) && (g < 0x0f)) g++;
892 if (((B_VAL(src_ptr) - (b << 4)) >= dith ) && (b < 0x0f)) b++;
895 *dst_ptr = (r << 8) | (g << 4) | (b);
897 CONVERT_LOOP_END_ROT_0();
904 #ifdef BUILD_CONVERT_16_RGB_444
905 #ifdef BUILD_CONVERT_16_RGB_ROT180
907 evas_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)
914 #ifndef BUILD_NO_DITHER_MASK
918 dst_ptr = (DATA16 *)dst;
920 CONVERT_LOOP2_START_ROT_180();
922 r1 = (R_VAL(src_ptr)) >> 4;
923 g1 = (G_VAL(src_ptr)) >> 4;
924 b1 = (B_VAL(src_ptr)) >> 4;
926 #ifndef BUILD_NO_DITHER_MASK
927 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
928 if (((R_VAL(src_ptr) - (r1 << 4)) >= dith ) && (r1 < 0x0f)) r1++;
929 if (((G_VAL(src_ptr) - (g1 << 4)) >= dith ) && (g1 < 0x0f)) g1++;
930 if (((B_VAL(src_ptr) - (b1 << 4)) >= dith ) && (b1 < 0x0f)) b1++;
933 CONVERT_LOOP2_INC_ROT_180();
935 r2 = (R_VAL(src_ptr)) >> 4;
936 g2 = (G_VAL(src_ptr)) >> 4;
937 b2 = (B_VAL(src_ptr)) >> 4;
939 #ifndef BUILD_NO_DITHER_MASK
940 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
941 if (((R_VAL(src_ptr) - (r2 << 4)) >= dith ) && (r2 < 0x0f)) r2++;
942 if (((G_VAL(src_ptr) - (g2 << 4)) >= dith ) && (g2 < 0x0f)) g2++;
943 if (((B_VAL(src_ptr) - (b2 << 4)) >= dith ) && (b2 < 0x0f)) b2++;
946 #ifndef WORDS_BIGENDIAN
947 *((DATA32 *)dst_ptr) =
948 (r2 << 24) | (g2 << 20) | (b2 << 16) |
949 (r1 << 8 ) | (g1 << 4 ) | (b1 );
951 *((DATA32 *)dst_ptr) =
952 (r1 << 24) | (g1 << 20) | (b1 << 16) |
953 (r2 << 8 ) | (g2 << 4 ) | (b2 );
956 CONVERT_LOOP2_END_ROT_180();
963 #ifdef BUILD_CONVERT_16_RGB_444
964 #ifdef BUILD_CONVERT_16_RGB_ROT180
966 evas_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)
972 #ifndef BUILD_NO_DITHER_MASK
976 dst_ptr = (DATA16 *)dst;
978 CONVERT_LOOP_START_ROT_180();
980 r = (R_VAL(src_ptr)) >> 4;
981 g = (G_VAL(src_ptr)) >> 4;
982 b = (B_VAL(src_ptr)) >> 4;
984 #ifndef BUILD_NO_DITHER_MASK
985 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
986 if (((R_VAL(src_ptr) - (r << 4)) >= dith ) && (r < 0x0f)) r++;
987 if (((G_VAL(src_ptr) - (g << 4)) >= dith ) && (g < 0x0f)) g++;
988 if (((B_VAL(src_ptr) - (b << 4)) >= dith ) && (b < 0x0f)) b++;
991 *dst_ptr = (r << 8) | (g << 4) | (b);
993 CONVERT_LOOP_END_ROT_180();
1000 #ifdef BUILD_CONVERT_16_RGB_444
1001 #ifdef BUILD_CONVERT_16_RGB_ROT270
1003 evas_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)
1010 #ifndef BUILD_NO_DITHER_MASK
1014 dst_ptr = (DATA16 *)dst;
1016 CONVERT_LOOP2_START_ROT_270();
1018 r1 = (R_VAL(src_ptr)) >> 4;
1019 g1 = (G_VAL(src_ptr)) >> 4;
1020 b1 = (B_VAL(src_ptr)) >> 4;
1022 #ifndef BUILD_NO_DITHER_MASK
1023 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1024 if (((R_VAL(src_ptr) - (r1 << 4)) >= dith ) && (r1 < 0x0f)) r1++;
1025 if (((G_VAL(src_ptr) - (g1 << 4)) >= dith ) && (g1 < 0x0f)) g1++;
1026 if (((B_VAL(src_ptr) - (b1 << 4)) >= dith ) && (b1 < 0x0f)) b1++;
1029 CONVERT_LOOP2_INC_ROT_270();
1031 r2 = (R_VAL(src_ptr)) >> 4;
1032 g2 = (G_VAL(src_ptr)) >> 4;
1033 b2 = (B_VAL(src_ptr)) >> 4;
1035 #ifndef BUILD_NO_DITHER_MASK
1036 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1037 if (((R_VAL(src_ptr) - (r2 << 4)) >= dith ) && (r2 < 0x0f)) r2++;
1038 if (((G_VAL(src_ptr) - (g2 << 4)) >= dith ) && (g2 < 0x0f)) g2++;
1039 if (((B_VAL(src_ptr) - (b2 << 4)) >= dith ) && (b2 < 0x0f)) b2++;
1042 #ifndef WORDS_BIGENDIAN
1043 *((DATA32 *)dst_ptr) =
1044 (r2 << 24) | (g2 << 20) | (b2 << 16) |
1045 (r1 << 8 ) | (g1 << 4 ) | (b1 );
1047 *((DATA32 *)dst_ptr) =
1048 (r1 << 24) | (g1 << 20) | (b1 << 16) |
1049 (r2 << 8 ) | (g2 << 4 ) | (b2 );
1052 CONVERT_LOOP2_END_ROT_270();
1059 #ifdef BUILD_CONVERT_16_RGB_444
1060 #ifdef BUILD_CONVERT_16_RGB_ROT270
1062 evas_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)
1068 #ifndef BUILD_NO_DITHER_MASK
1072 dst_ptr = (DATA16 *)dst;
1074 CONVERT_LOOP_START_ROT_270();
1076 r = (R_VAL(src_ptr)) >> 4;
1077 g = (G_VAL(src_ptr)) >> 4;
1078 b = (B_VAL(src_ptr)) >> 4;
1080 #ifndef BUILD_NO_DITHER_MASK
1081 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1082 if (((R_VAL(src_ptr) - (r << 4)) >= dith ) && (r < 0x0f)) r++;
1083 if (((G_VAL(src_ptr) - (g << 4)) >= dith ) && (g < 0x0f)) g++;
1084 if (((B_VAL(src_ptr) - (b << 4)) >= dith ) && (b < 0x0f)) b++;
1087 *dst_ptr = (r << 8) | (g << 4) | (b);
1089 CONVERT_LOOP_END_ROT_270();
1096 #ifdef BUILD_CONVERT_16_RGB_444
1097 #ifdef BUILD_CONVERT_16_RGB_ROT90
1099 evas_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)
1106 #ifndef BUILD_NO_DITHER_MASK
1110 dst_ptr = (DATA16 *)dst;
1112 CONVERT_LOOP2_START_ROT_90();
1114 r1 = (R_VAL(src_ptr)) >> 4;
1115 g1 = (G_VAL(src_ptr)) >> 4;
1116 b1 = (B_VAL(src_ptr)) >> 4;
1118 #ifndef BUILD_NO_DITHER_MASK
1119 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1120 if (((R_VAL(src_ptr) - (r1 << 4)) >= dith ) && (r1 < 0x0f)) r1++;
1121 if (((G_VAL(src_ptr) - (g1 << 4)) >= dith ) && (g1 < 0x0f)) g1++;
1122 if (((B_VAL(src_ptr) - (b1 << 4)) >= dith ) && (b1 < 0x0f)) b1++;
1125 CONVERT_LOOP2_INC_ROT_90();
1127 r2 = (R_VAL(src_ptr)) >> 4;
1128 g2 = (G_VAL(src_ptr)) >> 4;
1129 b2 = (B_VAL(src_ptr)) >> 4;
1131 #ifndef BUILD_NO_DITHER_MASK
1132 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1133 if (((R_VAL(src_ptr) - (r2 << 4)) >= dith ) && (r2 < 0x0f)) r2++;
1134 if (((G_VAL(src_ptr) - (g2 << 4)) >= dith ) && (g2 < 0x0f)) g2++;
1135 if (((B_VAL(src_ptr) - (b2 << 4)) >= dith ) && (b2 < 0x0f)) b2++;
1138 #ifndef WORDS_BIGENDIAN
1139 *((DATA32 *)dst_ptr) =
1140 (r2 << 24) | (g2 << 20) | (b2 << 16) |
1141 (r1 << 8 ) | (g1 << 4 ) | (b1 );
1143 *((DATA32 *)dst_ptr) =
1144 (r1 << 24) | (g1 << 20) | (b1 << 16) |
1145 (r2 << 8 ) | (g2 << 4 ) | (b2 );
1148 CONVERT_LOOP2_END_ROT_90();
1155 #ifdef BUILD_CONVERT_16_RGB_444
1156 #ifdef BUILD_CONVERT_16_RGB_ROT90
1158 evas_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)
1164 #ifndef BUILD_NO_DITHER_MASK
1168 dst_ptr = (DATA16 *)dst;
1170 CONVERT_LOOP_START_ROT_90();
1172 r = (R_VAL(src_ptr)) >> 4;
1173 g = (G_VAL(src_ptr)) >> 4;
1174 b = (B_VAL(src_ptr)) >> 4;
1176 #ifndef BUILD_NO_DITHER_MASK
1177 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1178 if (((R_VAL(src_ptr) - (r << 4)) >= dith ) && (r < 0x0f)) r++;
1179 if (((G_VAL(src_ptr) - (g << 4)) >= dith ) && (g < 0x0f)) g++;
1180 if (((B_VAL(src_ptr) - (b << 4)) >= dith ) && (b < 0x0f)) b++;
1183 *dst_ptr = (r << 8) | (g << 4) | (b);
1185 CONVERT_LOOP_END_ROT_90();
1192 #ifdef BUILD_CONVERT_16_RGB_454645
1193 #ifdef BUILD_CONVERT_16_RGB_ROT0
1195 evas_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)
1202 #ifndef BUILD_NO_DITHER_MASK
1206 dst_ptr = (DATA16 *)dst;
1208 CONVERT_LOOP2_START_ROT_0();
1210 r1 = (R_VAL(src_ptr)) >> 4;
1211 g1 = (G_VAL(src_ptr)) >> 4;
1212 b1 = (B_VAL(src_ptr)) >> 4;
1214 #ifndef BUILD_NO_DITHER_MASK
1215 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1216 if (((R_VAL(src_ptr) - (r1 << 4)) >= dith ) && (r1 < 0x0f)) r1++;
1217 if (((G_VAL(src_ptr) - (g1 << 4)) >= dith ) && (g1 < 0x0f)) g1++;
1218 if (((B_VAL(src_ptr) - (b1 << 4)) >= dith ) && (b1 < 0x0f)) b1++;
1221 CONVERT_LOOP2_INC_ROT_0();
1223 r2 = (R_VAL(src_ptr)) >> 4;
1224 g2 = (G_VAL(src_ptr)) >> 4;
1225 b2 = (B_VAL(src_ptr)) >> 4;
1227 #ifndef BUILD_NO_DITHER_MASK
1228 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1229 if (((R_VAL(src_ptr) - (r2 << 4)) >= dith ) && (r2 < 0x0f)) r2++;
1230 if (((G_VAL(src_ptr) - (g2 << 4)) >= dith ) && (g2 < 0x0f)) g2++;
1231 if (((B_VAL(src_ptr) - (b2 << 4)) >= dith ) && (b2 < 0x0f)) b2++;
1234 #ifndef WORDS_BIGENDIAN
1235 *((DATA32 *)dst_ptr) =
1236 (r2 << 28) | (g2 << 23) | (b2 << 17) |
1237 (r1 << 12) | (g1 << 7 ) | (b1 << 1 );
1239 *((DATA32 *)dst_ptr) =
1240 (r1 << 28) | (g1 << 23) | (b1 << 17) |
1241 (r2 << 12) | (g2 << 7 ) | (b2 << 1 );
1244 CONVERT_LOOP2_END_ROT_0();
1251 #ifdef BUILD_CONVERT_16_RGB_454645
1252 #ifdef BUILD_CONVERT_16_RGB_ROT0
1254 evas_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)
1260 #ifndef BUILD_NO_DITHER_MASK
1264 dst_ptr = (DATA16 *)dst;
1266 CONVERT_LOOP_START_ROT_0();
1268 r = (R_VAL(src_ptr)) >> 4;
1269 g = (G_VAL(src_ptr)) >> 4;
1270 b = (B_VAL(src_ptr)) >> 4;
1272 #ifndef BUILD_NO_DITHER_MASK
1273 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1274 if (((R_VAL(src_ptr) - (r << 4)) >= dith ) && (r < 0x0f)) r++;
1275 if (((G_VAL(src_ptr) - (g << 4)) >= dith ) && (g < 0x0f)) g++;
1276 if (((B_VAL(src_ptr) - (b << 4)) >= dith ) && (b < 0x0f)) b++;
1279 *dst_ptr = (r << 12) | (g << 7) | (b << 1);
1281 CONVERT_LOOP_END_ROT_0();
1288 #ifdef BUILD_CONVERT_16_RGB_454645
1289 #ifdef BUILD_CONVERT_16_RGB_ROT180
1291 evas_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)
1298 #ifndef BUILD_NO_DITHER_MASK
1302 dst_ptr = (DATA16 *)dst;
1304 CONVERT_LOOP2_START_ROT_180();
1306 r1 = (R_VAL(src_ptr)) >> 4;
1307 g1 = (G_VAL(src_ptr)) >> 4;
1308 b1 = (B_VAL(src_ptr)) >> 4;
1310 #ifndef BUILD_NO_DITHER_MASK
1311 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1312 if (((R_VAL(src_ptr) - (r1 << 4)) >= dith ) && (r1 < 0x0f)) r1++;
1313 if (((G_VAL(src_ptr) - (g1 << 4)) >= dith ) && (g1 < 0x0f)) g1++;
1314 if (((B_VAL(src_ptr) - (b1 << 4)) >= dith ) && (b1 < 0x0f)) b1++;
1317 CONVERT_LOOP2_INC_ROT_180();
1319 r2 = (R_VAL(src_ptr)) >> 4;
1320 g2 = (G_VAL(src_ptr)) >> 4;
1321 b2 = (B_VAL(src_ptr)) >> 4;
1323 #ifndef BUILD_NO_DITHER_MASK
1324 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1325 if (((R_VAL(src_ptr) - (r2 << 4)) >= dith ) && (r2 < 0x0f)) r2++;
1326 if (((G_VAL(src_ptr) - (g2 << 4)) >= dith ) && (g2 < 0x0f)) g2++;
1327 if (((B_VAL(src_ptr) - (b2 << 4)) >= dith ) && (b2 < 0x0f)) b2++;
1330 #ifndef WORDS_BIGENDIAN
1331 *((DATA32 *)dst_ptr) =
1332 (r2 << 28) | (g2 << 23) | (b2 << 17) |
1333 (r1 << 12) | (g1 << 7 ) | (b1 << 1 );
1335 *((DATA32 *)dst_ptr) =
1336 (r1 << 28) | (g1 << 23) | (b1 << 17) |
1337 (r2 << 12) | (g2 << 7 ) | (b2 << 1 );
1340 CONVERT_LOOP2_END_ROT_180();
1347 #ifdef BUILD_CONVERT_16_RGB_454645
1348 #ifdef BUILD_CONVERT_16_RGB_ROT180
1350 evas_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)
1356 #ifndef BUILD_NO_DITHER_MASK
1360 dst_ptr = (DATA16 *)dst;
1362 CONVERT_LOOP_START_ROT_180();
1364 r = (R_VAL(src_ptr)) >> 4;
1365 g = (G_VAL(src_ptr)) >> 4;
1366 b = (B_VAL(src_ptr)) >> 4;
1368 #ifndef BUILD_NO_DITHER_MASK
1369 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1370 if (((R_VAL(src_ptr) - (r << 4)) >= dith ) && (r < 0x0f)) r++;
1371 if (((G_VAL(src_ptr) - (g << 4)) >= dith ) && (g < 0x0f)) g++;
1372 if (((B_VAL(src_ptr) - (b << 4)) >= dith ) && (b < 0x0f)) b++;
1375 *dst_ptr = (r << 12) | (g << 7) | (b << 1);
1377 CONVERT_LOOP_END_ROT_180();
1385 #ifdef BUILD_CONVERT_16_RGB_454645
1386 #ifdef BUILD_CONVERT_16_RGB_ROT270
1388 evas_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)
1395 #ifndef BUILD_NO_DITHER_MASK
1399 dst_ptr = (DATA16 *)dst;
1401 CONVERT_LOOP2_START_ROT_270();
1403 r1 = (R_VAL(src_ptr)) >> 4;
1404 g1 = (G_VAL(src_ptr)) >> 4;
1405 b1 = (B_VAL(src_ptr)) >> 4;
1407 #ifndef BUILD_NO_DITHER_MASK
1408 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1409 if (((R_VAL(src_ptr) - (r1 << 4)) >= dith ) && (r1 < 0x0f)) r1++;
1410 if (((G_VAL(src_ptr) - (g1 << 4)) >= dith ) && (g1 < 0x0f)) g1++;
1411 if (((B_VAL(src_ptr) - (b1 << 4)) >= dith ) && (b1 < 0x0f)) b1++;
1414 CONVERT_LOOP2_INC_ROT_270();
1416 r2 = (R_VAL(src_ptr)) >> 4;
1417 g2 = (G_VAL(src_ptr)) >> 4;
1418 b2 = (B_VAL(src_ptr)) >> 4;
1420 #ifndef BUILD_NO_DITHER_MASK
1421 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1422 if (((R_VAL(src_ptr) - (r2 << 4)) >= dith ) && (r2 < 0x0f)) r2++;
1423 if (((G_VAL(src_ptr) - (g2 << 4)) >= dith ) && (g2 < 0x0f)) g2++;
1424 if (((B_VAL(src_ptr) - (b2 << 4)) >= dith ) && (b2 < 0x0f)) b2++;
1427 #ifndef WORDS_BIGENDIAN
1428 *((DATA32 *)dst_ptr) =
1429 (r2 << 28) | (g2 << 23) | (b2 << 17) |
1430 (r1 << 12) | (g1 << 7 ) | (b1 << 1 );
1432 *((DATA32 *)dst_ptr) =
1433 (r1 << 28) | (g1 << 23) | (b1 << 17) |
1434 (r2 << 12) | (g2 << 7 ) | (b2 << 1 );
1437 CONVERT_LOOP2_END_ROT_270();
1444 #ifdef BUILD_CONVERT_16_RGB_454645
1445 #ifdef BUILD_CONVERT_16_RGB_ROT270
1447 evas_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)
1453 #ifndef BUILD_NO_DITHER_MASK
1457 dst_ptr = (DATA16 *)dst;
1459 CONVERT_LOOP_START_ROT_270();
1461 r = (R_VAL(src_ptr)) >> 4;
1462 g = (G_VAL(src_ptr)) >> 4;
1463 b = (B_VAL(src_ptr)) >> 4;
1465 #ifndef BUILD_NO_DITHER_MASK
1466 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1467 if (((R_VAL(src_ptr) - (r << 4)) >= dith ) && (r < 0x0f)) r++;
1468 if (((G_VAL(src_ptr) - (g << 4)) >= dith ) && (g < 0x0f)) g++;
1469 if (((B_VAL(src_ptr) - (b << 4)) >= dith ) && (b < 0x0f)) b++;
1472 *dst_ptr = (r << 12) | (g << 7) | (b << 1);
1474 CONVERT_LOOP_END_ROT_270();
1481 #ifdef BUILD_CONVERT_16_RGB_454645
1482 #ifdef BUILD_CONVERT_16_RGB_ROT90
1484 evas_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)
1491 #ifndef BUILD_NO_DITHER_MASK
1495 dst_ptr = (DATA16 *)dst;
1497 CONVERT_LOOP2_START_ROT_90();
1499 r1 = (R_VAL(src_ptr)) >> 4;
1500 g1 = (G_VAL(src_ptr)) >> 4;
1501 b1 = (B_VAL(src_ptr)) >> 4;
1503 #ifndef BUILD_NO_DITHER_MASK
1504 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1505 if (((R_VAL(src_ptr) - (r1 << 4)) >= dith ) && (r1 < 0x0f)) r1++;
1506 if (((G_VAL(src_ptr) - (g1 << 4)) >= dith ) && (g1 < 0x0f)) g1++;
1507 if (((B_VAL(src_ptr) - (b1 << 4)) >= dith ) && (b1 < 0x0f)) b1++;
1510 CONVERT_LOOP2_INC_ROT_90();
1512 r2 = (R_VAL(src_ptr)) >> 4;
1513 g2 = (G_VAL(src_ptr)) >> 4;
1514 b2 = (B_VAL(src_ptr)) >> 4;
1516 #ifndef BUILD_NO_DITHER_MASK
1517 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1518 if (((R_VAL(src_ptr) - (r2 << 4)) >= dith ) && (r2 < 0x0f)) r2++;
1519 if (((G_VAL(src_ptr) - (g2 << 4)) >= dith ) && (g2 < 0x0f)) g2++;
1520 if (((B_VAL(src_ptr) - (b2 << 4)) >= dith ) && (b2 < 0x0f)) b2++;
1523 #ifndef WORDS_BIGENDIAN
1524 *((DATA32 *)dst_ptr) =
1525 (r2 << 28) | (g2 << 23) | (b2 << 17) |
1526 (r1 << 12) | (g1 << 7 ) | (b1 << 1 );
1528 *((DATA32 *)dst_ptr) =
1529 (r1 << 28) | (g1 << 23) | (b1 << 17) |
1530 (r2 << 12) | (g2 << 7 ) | (b2 << 1 );
1533 CONVERT_LOOP2_END_ROT_90();
1540 #ifdef BUILD_CONVERT_16_RGB_454645
1541 #ifdef BUILD_CONVERT_16_RGB_ROT90
1543 evas_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)
1549 #ifndef BUILD_NO_DITHER_MASK
1553 dst_ptr = (DATA16 *)dst;
1555 CONVERT_LOOP_START_ROT_90();
1557 r = (R_VAL(src_ptr)) >> 4;
1558 g = (G_VAL(src_ptr)) >> 4;
1559 b = (B_VAL(src_ptr)) >> 4;
1561 #ifndef BUILD_NO_DITHER_MASK
1562 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(4);
1563 if (((R_VAL(src_ptr) - (r << 4)) >= dith ) && (r < 0x0f)) r++;
1564 if (((G_VAL(src_ptr) - (g << 4)) >= dith ) && (g < 0x0f)) g++;
1565 if (((B_VAL(src_ptr) - (b << 4)) >= dith ) && (b < 0x0f)) b++;
1568 *dst_ptr = (r << 12) | (g << 7) | (b << 1);
1570 CONVERT_LOOP_END_ROT_90();
1577 #ifdef BUILD_CONVERT_16_RGB_555
1578 #ifdef BUILD_CONVERT_16_RGB_ROT0
1580 evas_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)
1587 #ifndef BUILD_NO_DITHER_MASK
1591 dst_ptr = (DATA16 *)dst;
1593 CONVERT_LOOP2_START_ROT_0();
1595 r1 = (R_VAL(src_ptr)) >> 3;
1596 g1 = (G_VAL(src_ptr)) >> 3;
1597 b1 = (B_VAL(src_ptr)) >> 3;
1599 #ifndef BUILD_NO_DITHER_MASK
1600 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1601 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith) && (r1 < 0x1f)) r1++;
1602 if (((G_VAL(src_ptr) - (g1 << 3)) >= dith) && (g1 < 0x1f)) g1++;
1603 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith) && (b1 < 0x1f)) b1++;
1606 CONVERT_LOOP2_INC_ROT_0();
1608 r2 = (R_VAL(src_ptr)) >> 3;
1609 g2 = (G_VAL(src_ptr)) >> 3;
1610 b2 = (B_VAL(src_ptr)) >> 3;
1612 #ifndef BUILD_NO_DITHER_MASK
1613 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1614 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith) && (r2 < 0x1f)) r2++;
1615 if (((G_VAL(src_ptr) - (g2 << 3)) >= dith) && (g2 < 0x1f)) g2++;
1616 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith) && (b2 < 0x1f)) b2++;
1619 #ifndef WORDS_BIGENDIAN
1620 *((DATA32 *)dst_ptr) =
1621 (r2 << 26) | (g2 << 21) | (b2 << 16) |
1622 (r1 << 10) | (g1 << 5 ) | (b1 );
1624 *((DATA32 *)dst_ptr) =
1625 (r1 << 26) | (g1 << 21) | (b1 << 16) |
1626 (r2 << 10) | (g2 << 5 ) | (b2 );
1629 CONVERT_LOOP2_END_ROT_0();
1636 #ifdef BUILD_CONVERT_16_RGB_555
1637 #ifdef BUILD_CONVERT_16_RGB_ROT0
1639 evas_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)
1645 #ifndef BUILD_NO_DITHER_MASK
1649 dst_ptr = (DATA16 *)dst;
1651 CONVERT_LOOP_START_ROT_0();
1653 r = (R_VAL(src_ptr)) >> 3;
1654 g = (G_VAL(src_ptr)) >> 3;
1655 b = (B_VAL(src_ptr)) >> 3;
1657 #ifndef BUILD_NO_DITHER_MASK
1658 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1659 if (((R_VAL(src_ptr) - (r << 3)) >= dith) && (r < 0x1f)) r++;
1660 if (((G_VAL(src_ptr) - (g << 3)) >= dith) && (g < 0x1f)) g++;
1661 if (((B_VAL(src_ptr) - (b << 3)) >= dith) && (b < 0x1f)) b++;
1664 *dst_ptr = (r << 10) | (g << 5) | (b);
1666 CONVERT_LOOP_END_ROT_0();
1673 #ifdef BUILD_CONVERT_16_RGB_555
1674 #ifdef BUILD_CONVERT_16_RGB_ROT180
1676 evas_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)
1683 #ifndef BUILD_NO_DITHER_MASK
1687 dst_ptr = (DATA16 *)dst;
1689 CONVERT_LOOP2_START_ROT_180();
1691 r1 = (R_VAL(src_ptr)) >> 3;
1692 g1 = (G_VAL(src_ptr)) >> 3;
1693 b1 = (B_VAL(src_ptr)) >> 3;
1695 #ifndef BUILD_NO_DITHER_MASK
1696 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1697 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith) && (r1 < 0x1f)) r1++;
1698 if (((G_VAL(src_ptr) - (g1 << 3)) >= dith) && (g1 < 0x1f)) g1++;
1699 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith) && (b1 < 0x1f)) b1++;
1702 CONVERT_LOOP2_INC_ROT_180();
1704 r2 = (R_VAL(src_ptr)) >> 3;
1705 g2 = (G_VAL(src_ptr)) >> 3;
1706 b2 = (B_VAL(src_ptr)) >> 3;
1708 #ifndef BUILD_NO_DITHER_MASK
1709 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1710 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith) && (r2 < 0x1f)) r2++;
1711 if (((G_VAL(src_ptr) - (g2 << 3)) >= dith) && (g2 < 0x1f)) g2++;
1712 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith) && (b2 < 0x1f)) b2++;
1715 #ifndef WORDS_BIGENDIAN
1716 *((DATA32 *)dst_ptr) =
1717 (r2 << 26) | (g2 << 21) | (b2 << 16) |
1718 (r1 << 10) | (g1 << 5 ) | (b1 );
1720 *((DATA32 *)dst_ptr) =
1721 (r1 << 26) | (g1 << 21) | (b1 << 16) |
1722 (r2 << 10) | (g2 << 5 ) | (b2 );
1725 CONVERT_LOOP2_END_ROT_180();
1732 #ifdef BUILD_CONVERT_16_RGB_555
1733 #ifdef BUILD_CONVERT_16_RGB_ROT180
1735 evas_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)
1741 #ifndef BUILD_NO_DITHER_MASK
1745 dst_ptr = (DATA16 *)dst;
1747 CONVERT_LOOP_START_ROT_180();
1749 r = (R_VAL(src_ptr)) >> 3;
1750 g = (G_VAL(src_ptr)) >> 3;
1751 b = (B_VAL(src_ptr)) >> 3;
1753 #ifndef BUILD_NO_DITHER_MASK
1754 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1755 if (((R_VAL(src_ptr) - (r << 3)) >= dith) && (r < 0x1f)) r++;
1756 if (((G_VAL(src_ptr) - (g << 3)) >= dith) && (g < 0x1f)) g++;
1757 if (((B_VAL(src_ptr) - (b << 3)) >= dith) && (b < 0x1f)) b++;
1760 *dst_ptr = (r << 10) | (g << 5) | (b);
1762 CONVERT_LOOP_END_ROT_180();
1769 #ifdef BUILD_CONVERT_16_RGB_555
1770 #ifdef BUILD_CONVERT_16_RGB_ROT270
1772 evas_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)
1779 #ifndef BUILD_NO_DITHER_MASK
1783 dst_ptr = (DATA16 *)dst;
1785 CONVERT_LOOP2_START_ROT_270();
1787 r1 = (R_VAL(src_ptr)) >> 3;
1788 g1 = (G_VAL(src_ptr)) >> 3;
1789 b1 = (B_VAL(src_ptr)) >> 3;
1791 #ifndef BUILD_NO_DITHER_MASK
1792 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1793 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith) && (r1 < 0x1f)) r1++;
1794 if (((G_VAL(src_ptr) - (g1 << 3)) >= dith) && (g1 < 0x1f)) g1++;
1795 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith) && (b1 < 0x1f)) b1++;
1798 CONVERT_LOOP2_INC_ROT_270();
1800 r2 = (R_VAL(src_ptr)) >> 3;
1801 g2 = (G_VAL(src_ptr)) >> 3;
1802 b2 = (B_VAL(src_ptr)) >> 3;
1804 #ifndef BUILD_NO_DITHER_MASK
1805 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1806 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith) && (r2 < 0x1f)) r2++;
1807 if (((G_VAL(src_ptr) - (g2 << 3)) >= dith) && (g2 < 0x1f)) g2++;
1808 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith) && (b2 < 0x1f)) b2++;
1811 #ifndef WORDS_BIGENDIAN
1812 *((DATA32 *)dst_ptr) =
1813 (r2 << 26) | (g2 << 21) | (b2 << 16) |
1814 (r1 << 10) | (g1 << 5 ) | (b1 );
1816 *((DATA32 *)dst_ptr) =
1817 (r1 << 26) | (g1 << 21) | (b1 << 16) |
1818 (r2 << 10) | (g2 << 5 ) | (b2 );
1821 CONVERT_LOOP2_END_ROT_270();
1828 #ifdef BUILD_CONVERT_16_RGB_555
1829 #ifdef BUILD_CONVERT_16_RGB_ROT270
1831 evas_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)
1837 #ifndef BUILD_NO_DITHER_MASK
1841 dst_ptr = (DATA16 *)dst;
1843 CONVERT_LOOP_START_ROT_270();
1845 r = (R_VAL(src_ptr)) >> 3;
1846 g = (G_VAL(src_ptr)) >> 3;
1847 b = (B_VAL(src_ptr)) >> 3;
1849 #ifndef BUILD_NO_DITHER_MASK
1850 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1851 if (((R_VAL(src_ptr) - (r << 3)) >= dith) && (r < 0x1f)) r++;
1852 if (((G_VAL(src_ptr) - (g << 3)) >= dith) && (g < 0x1f)) g++;
1853 if (((B_VAL(src_ptr) - (b << 3)) >= dith) && (b < 0x1f)) b++;
1856 *dst_ptr = (r << 10) | (g << 5) | (b);
1858 CONVERT_LOOP_END_ROT_270();
1865 #ifdef BUILD_CONVERT_16_RGB_555
1866 #ifdef BUILD_CONVERT_16_RGB_ROT90
1868 evas_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)
1875 #ifndef BUILD_NO_DITHER_MASK
1879 dst_ptr = (DATA16 *)dst;
1881 CONVERT_LOOP2_START_ROT_90();
1883 r1 = (R_VAL(src_ptr)) >> 3;
1884 g1 = (G_VAL(src_ptr)) >> 3;
1885 b1 = (B_VAL(src_ptr)) >> 3;
1887 #ifndef BUILD_NO_DITHER_MASK
1888 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1889 if (((R_VAL(src_ptr) - (r1 << 3)) >= dith) && (r1 < 0x1f)) r1++;
1890 if (((G_VAL(src_ptr) - (g1 << 3)) >= dith) && (g1 < 0x1f)) g1++;
1891 if (((B_VAL(src_ptr) - (b1 << 3)) >= dith) && (b1 < 0x1f)) b1++;
1894 CONVERT_LOOP2_INC_ROT_90();
1896 r2 = (R_VAL(src_ptr)) >> 3;
1897 g2 = (G_VAL(src_ptr)) >> 3;
1898 b2 = (B_VAL(src_ptr)) >> 3;
1900 #ifndef BUILD_NO_DITHER_MASK
1901 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1902 if (((R_VAL(src_ptr) - (r2 << 3)) >= dith) && (r2 < 0x1f)) r2++;
1903 if (((G_VAL(src_ptr) - (g2 << 3)) >= dith) && (g2 < 0x1f)) g2++;
1904 if (((B_VAL(src_ptr) - (b2 << 3)) >= dith) && (b2 < 0x1f)) b2++;
1907 #ifndef WORDS_BIGENDIAN
1908 *((DATA32 *)dst_ptr) =
1909 (r2 << 26) | (g2 << 21) | (b2 << 16) |
1910 (r1 << 10) | (g1 << 5 ) | (b1 );
1912 *((DATA32 *)dst_ptr) =
1913 (r1 << 26) | (g1 << 21) | (b1 << 16) |
1914 (r2 << 10) | (g2 << 5 ) | (b2 );
1917 CONVERT_LOOP2_END_ROT_90();
1924 #ifdef BUILD_CONVERT_16_RGB_555
1925 #ifdef BUILD_CONVERT_16_RGB_ROT90
1927 evas_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)
1933 #ifndef BUILD_NO_DITHER_MASK
1937 dst_ptr = (DATA16 *)dst;
1939 CONVERT_LOOP_START_ROT_90();
1941 r = (R_VAL(src_ptr)) >> 3;
1942 g = (G_VAL(src_ptr)) >> 3;
1943 b = (B_VAL(src_ptr)) >> 3;
1945 #ifndef BUILD_NO_DITHER_MASK
1946 dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(5);
1947 if (((R_VAL(src_ptr) - (r << 3)) >= dith) && (r < 0x1f)) r++;
1948 if (((G_VAL(src_ptr) - (g << 3)) >= dith) && (g < 0x1f)) g++;
1949 if (((B_VAL(src_ptr) - (b << 3)) >= dith) && (b < 0x1f)) b++;
1952 *dst_ptr = (r << 10) | (g << 5) | (b);
1954 CONVERT_LOOP_END_ROT_90();