remove erroneous double brackets
[AROS.git] / test / patchrgbconv_rgbswap.h
blob0174035486fb58f5e4d1a51ec83836f3eab82681
1 #define SWAP32CODE \
2 ULONG *src = (ULONG *)srcPixels; \
3 ULONG *dst = (ULONG *)dstPixels; \
4 ULONG x, y; \
6 for(y = 0; y < height; y++) \
7 { \
8 for(x = 0; x < width; x++) \
9 { \
10 ULONG s = src[x]; \
12 dst[x] = AROS_SWAP_BYTES_LONG(s); \
13 } \
14 src = (ULONG *)(((UBYTE *)src) + srcMod); \
15 dst = (ULONG *)(((UBYTE *)dst) + dstMod); \
16 } \
18 return 1;
20 #define SWAP16CODE \
21 UWORD *src = (UWORD *)srcPixels; \
22 UWORD *dst = (UWORD *)dstPixels; \
23 ULONG x, y; \
25 for(y = 0; y < height; y++) \
26 { \
27 for(x = 0; x < width; x++) \
28 { \
29 UWORD s = src[x]; \
31 dst[x] = AROS_SWAP_BYTES_WORD(s); \
32 } \
33 src = (UWORD *)(((UBYTE *)src) + srcMod); \
34 dst = (UWORD *)(((UBYTE *)dst) + dstMod); \
35 } \
37 return 1;
39 #define SWAP2432CODE \
40 UBYTE *src = (UBYTE *)srcPixels; \
41 ULONG *dst = (ULONG *)dstPixels; \
42 ULONG x, y; \
44 for(y = 0; y < height; y++) \
45 { \
46 for(x = 0; x < width; x++) \
47 { \
48 ULONG s = GET24_INV; \
50 dst[x] = s; \
51 } \
52 src = (UBYTE *)(((UBYTE *)src) + srcMod); \
53 dst = (ULONG *)(((UBYTE *)dst) + dstMod); \
54 } \
56 return 1;
58 #define SWAP2424CODE \
59 UBYTE *src = (UBYTE *)srcPixels; \
60 UBYTE *dst = (UBYTE *)dstPixels; \
61 ULONG x, y; \
63 for(y = 0; y < height; y++) \
64 { \
65 for(x = 0; x < width; x++) \
66 { \
67 dst[x * 3] = src[x * 3 + 2]; \
68 dst[x * 3 + 1] = src[x * 3 + 1]; \
69 dst[x * 3 + 2] = src[x * 3]; \
70 } \
71 src = (UBYTE *)(((UBYTE *)src) + srcMod); \
72 dst = (UBYTE *)(((UBYTE *)dst) + dstMod); \
73 } \
75 return 1;
77 #define SWAP1515CODE \
78 UWORD *src = (UWORD *)srcPixels; \
79 UWORD *dst = (UWORD *)dstPixels; \
80 ULONG x, y; \
82 for(y = 0; y < height; y++) \
83 { \
84 for(x = 0; x < width; x++) \
85 { \
86 UWORD s = src[x]; \
88 dst[x] = ((s & RGB15_RMASK) >> 10) | \
89 ((s & RGB15_GMASK)) | \
90 ((s & RGB15_BMASK) << 10); \
91 } \
92 src = (UWORD *)(((UBYTE *)src) + srcMod); \
93 dst = (UWORD *)(((UBYTE *)dst) + dstMod); \
94 } \
96 return 1;
98 #define SWAP15OE15CODE \
99 UWORD *src = (UWORD *)srcPixels; \
100 UWORD *dst = (UWORD *)dstPixels; \
101 ULONG x, y; \
103 for(y = 0; y < height; y++) \
105 for(x = 0; x < width; x++) \
107 UWORD s = INV16(src[x]); \
109 dst[x] = ((s & RGB15_RMASK) >> 10) | \
110 ((s & RGB15_GMASK)) | \
111 ((s & RGB15_BMASK) << 10); \
113 src = (UWORD *)(((UBYTE *)src) + srcMod); \
114 dst = (UWORD *)(((UBYTE *)dst) + dstMod); \
117 return 1;
119 #define SWAP1515OECODE \
120 UWORD *src = (UWORD *)srcPixels; \
121 UWORD *dst = (UWORD *)dstPixels; \
122 ULONG x, y; \
124 for(y = 0; y < height; y++) \
126 for(x = 0; x < width; x++) \
128 UWORD s = src[x]; \
130 s = ((s & RGB15_RMASK) >> 10) | \
131 ((s & RGB15_GMASK)) | \
132 ((s & RGB15_BMASK) << 10); \
133 dst[x] = INV16(s); \
135 src = (UWORD *)(((UBYTE *)src) + srcMod); \
136 dst = (UWORD *)(((UBYTE *)dst) + dstMod); \
139 return 1;
141 #define SWAP15OE15OECODE \
142 UWORD *src = (UWORD *)srcPixels; \
143 UWORD *dst = (UWORD *)dstPixels; \
144 ULONG x, y; \
146 for(y = 0; y < height; y++) \
148 for(x = 0; x < width; x++) \
150 UWORD s = INV16(src[x]); \
152 s = ((s & RGB15_RMASK) >> 10) | \
153 ((s & RGB15_GMASK)) | \
154 ((s & RGB15_BMASK) << 10); \
155 dst[x] = INV16(s); \
157 src = (UWORD *)(((UBYTE *)src) + srcMod); \
158 dst = (UWORD *)(((UBYTE *)dst) + dstMod); \
161 return 1;
163 #define SWAP1616CODE \
164 UWORD *src = (UWORD *)srcPixels; \
165 UWORD *dst = (UWORD *)dstPixels; \
166 ULONG x, y; \
168 for(y = 0; y < height; y++) \
170 for(x = 0; x < width; x++) \
172 UWORD s = src[x]; \
174 dst[x] = ((s & RGB16_RMASK) >> 11) | \
175 ((s & RGB16_GMASK)) | \
176 ((s & RGB16_BMASK) << 11); \
178 src = (UWORD *)(((UBYTE *)src) + srcMod); \
179 dst = (UWORD *)(((UBYTE *)dst) + dstMod); \
182 return 1;
184 #define SWAP16OE16CODE \
185 UWORD *src = (UWORD *)srcPixels; \
186 UWORD *dst = (UWORD *)dstPixels; \
187 ULONG x, y; \
189 for(y = 0; y < height; y++) \
191 for(x = 0; x < width; x++) \
193 UWORD s = INV16(src[x]); \
195 dst[x] = ((s & RGB16_RMASK) >> 11) | \
196 ((s & RGB16_GMASK)) | \
197 ((s & RGB16_BMASK) << 11); \
199 src = (UWORD *)(((UBYTE *)src) + srcMod); \
200 dst = (UWORD *)(((UBYTE *)dst) + dstMod); \
203 return 1;
205 #define SWAP1616OECODE \
206 UWORD *src = (UWORD *)srcPixels; \
207 UWORD *dst = (UWORD *)dstPixels; \
208 ULONG x, y; \
210 for(y = 0; y < height; y++) \
212 for(x = 0; x < width; x++) \
214 UWORD s = src[x]; \
216 s = ((s & RGB16_RMASK) >> 11) | \
217 ((s & RGB16_GMASK)) | \
218 ((s & RGB16_BMASK) << 11); \
219 dst[x] = INV16(s); \
221 src = (UWORD *)(((UBYTE *)src) + srcMod); \
222 dst = (UWORD *)(((UBYTE *)dst) + dstMod); \
225 return 1;
227 #define SWAP16OE16OECODE \
228 UWORD *src = (UWORD *)srcPixels; \
229 UWORD *dst = (UWORD *)dstPixels; \
230 ULONG x, y; \
232 for(y = 0; y < height; y++) \
234 for(x = 0; x < width; x++) \
236 UWORD s = INV16(src[x]); \
238 s = ((s & RGB16_RMASK) >> 11) | \
239 ((s & RGB16_GMASK)) | \
240 ((s & RGB16_BMASK) << 11); \
241 dst[x] = INV16(s); \
243 src = (UWORD *)(((UBYTE *)src) + srcMod); \
244 dst = (UWORD *)(((UBYTE *)dst) + dstMod); \
247 return 1;
249 #define SWAP1516CODE \
250 UWORD *src = (UWORD *)srcPixels; \
251 UWORD *dst = (UWORD *)dstPixels; \
252 ULONG x, y; \
254 for(y = 0; y < height; y++) \
256 for(x = 0; x < width; x++) \
258 UWORD s = src[x]; \
260 dst[x] = ((s & RGB15_RMASK) >> 10) | \
261 ((s & RGB15_GMASK) << 1) | \
262 ((s & RGB15_BMASK) << 11); \
264 src = (UWORD *)(((UBYTE *)src) + srcMod); \
265 dst = (UWORD *)(((UBYTE *)dst) + dstMod); \
268 return 1;
270 #define SWAP15OE16CODE \
271 UWORD *src = (UWORD *)srcPixels; \
272 UWORD *dst = (UWORD *)dstPixels; \
273 ULONG x, y; \
275 for(y = 0; y < height; y++) \
277 for(x = 0; x < width; x++) \
279 UWORD s = INV16(src[x]); \
281 dst[x] = ((s & RGB15_RMASK) >> 10) | \
282 ((s & RGB15_GMASK) << 1) | \
283 ((s & RGB15_BMASK) << 11); \
285 src = (UWORD *)(((UBYTE *)src) + srcMod); \
286 dst = (UWORD *)(((UBYTE *)dst) + dstMod); \
289 return 1;
291 #define SWAP1516OECODE \
292 UWORD *src = (UWORD *)srcPixels; \
293 UWORD *dst = (UWORD *)dstPixels; \
294 ULONG x, y; \
296 for(y = 0; y < height; y++) \
298 for(x = 0; x < width; x++) \
300 UWORD s = src[x]; \
302 s = ((s & RGB15_RMASK) >> 10) | \
303 ((s & RGB15_GMASK) << 1) | \
304 ((s & RGB15_BMASK) << 11); \
305 dst[x] = INV16(s); \
307 src = (UWORD *)(((UBYTE *)src) + srcMod); \
308 dst = (UWORD *)(((UBYTE *)dst) + dstMod); \
311 return 1;
313 #define SWAP15OE16OECODE \
314 UWORD *src = (UWORD *)srcPixels; \
315 UWORD *dst = (UWORD *)dstPixels; \
316 ULONG x, y; \
318 for(y = 0; y < height; y++) \
320 for(x = 0; x < width; x++) \
322 UWORD s = INV16(src[x]); \
324 s = ((s & RGB15_RMASK) >> 10) | \
325 ((s & RGB15_GMASK) << 1) | \
326 ((s & RGB15_BMASK) << 11); \
327 dst[x] = INV16(s); \
329 src = (UWORD *)(((UBYTE *)src) + srcMod); \
330 dst = (UWORD *)(((UBYTE *)dst) + dstMod); \
333 return 1;
335 #define SWAP1615CODE \
336 UWORD *src = (UWORD *)srcPixels; \
337 UWORD *dst = (UWORD *)dstPixels; \
338 ULONG x, y; \
340 for(y = 0; y < height; y++) \
342 for(x = 0; x < width; x++) \
344 UWORD s = src[x]; \
346 dst[x] = ((s >> 11) & RGB15_BMASK) | \
347 ((s >> 1) & RGB15_GMASK) | \
348 ((s << 10) & RGB15_RMASK); \
350 src = (UWORD *)(((UBYTE *)src) + srcMod); \
351 dst = (UWORD *)(((UBYTE *)dst) + dstMod); \
354 return 1;
356 #define SWAP16OE15CODE \
357 UWORD *src = (UWORD *)srcPixels; \
358 UWORD *dst = (UWORD *)dstPixels; \
359 ULONG x, y; \
361 for(y = 0; y < height; y++) \
363 for(x = 0; x < width; x++) \
365 UWORD s = INV16(src[x]); \
367 dst[x] = ((s >> 11) & RGB15_BMASK) | \
368 ((s >> 1) & RGB15_GMASK) | \
369 ((s << 10) & RGB15_RMASK); \
371 src = (UWORD *)(((UBYTE *)src) + srcMod); \
372 dst = (UWORD *)(((UBYTE *)dst) + dstMod); \
375 return 1;
377 #define SWAP1615OECODE \
378 UWORD *src = (UWORD *)srcPixels; \
379 UWORD *dst = (UWORD *)dstPixels; \
380 ULONG x, y; \
382 for(y = 0; y < height; y++) \
384 for(x = 0; x < width; x++) \
386 UWORD s = src[x]; \
388 s = ((s >> 11) & RGB15_BMASK) | \
389 ((s >> 1) & RGB15_GMASK) | \
390 ((s << 10) & RGB15_RMASK); \
391 dst[x] = INV16(s); \
393 src = (UWORD *)(((UBYTE *)src) + srcMod); \
394 dst = (UWORD *)(((UBYTE *)dst) + dstMod); \
397 return 1;
400 #define SWAP16OE15OECODE \
401 UWORD *src = (UWORD *)srcPixels; \
402 UWORD *dst = (UWORD *)dstPixels; \
403 ULONG x, y; \
405 for(y = 0; y < height; y++) \
407 for(x = 0; x < width; x++) \
409 UWORD s = INV16(src[x]); \
411 s = ((s >> 11) & RGB15_BMASK) | \
412 ((s >> 1) & RGB15_GMASK) | \
413 ((s << 10) & RGB15_RMASK); \
414 dst[x] = INV16(s); \
416 src = (UWORD *)(((UBYTE *)src) + srcMod); \
417 dst = (UWORD *)(((UBYTE *)dst) + dstMod); \
420 return 1;