Tiny kprintf implementation, only decimal and hexadecimal output (unsigned).
[AROS.git] / test / patchrgbconv_bgra32.h
blobd93e55338b3401f81973e36bf72e02e733cf7c77
1 CONVERTFUNC(BGRA32,RGB16) /* Should be okay */
3 CONVERTFUNC_INIT
5 ULONG *src = (ULONG *)srcPixels;
6 UWORD *dst = (UWORD *)dstPixels;
7 ULONG x, y;
9 for(y = 0; y < height; y++)
11 for(x = 0; x < width; x++)
13 ULONG s = src[x];
15 dst[x] = DOWNSHIFT16(s, BGRA32, RGB16);
17 src = (ULONG *)(((UBYTE *)src) + srcMod);
18 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
21 return 1;
23 CONVERTFUNC_EXIT
26 CONVERTFUNC(BGRA32,BGR16) /* Untested */
28 CONVERTFUNC_INIT
30 ULONG *src = (ULONG *)srcPixels;
31 UWORD *dst = (UWORD *)dstPixels;
32 ULONG x, y;
34 for(y = 0; y < height; y++)
36 for(x = 0; x < width; x++)
38 ULONG s = src[x];
40 dst[x] = DOWNSHIFT16(s, BGRA32, BGR16);
42 src = (ULONG *)(((UBYTE *)src) + srcMod);
43 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
46 return 1;
48 CONVERTFUNC_EXIT
51 CONVERTFUNC(BGRA32,RGB15) /* Untested */
53 CONVERTFUNC_INIT
55 ULONG *src = (ULONG *)srcPixels;
56 UWORD *dst = (UWORD *)dstPixels;
57 ULONG x, y;
59 for(y = 0; y < height; y++)
61 for(x = 0; x < width; x++)
63 ULONG s = src[x];
65 dst[x] = DOWNSHIFT16(s, BGRA32, RGB15);
67 src = (ULONG *)(((UBYTE *)src) + srcMod);
68 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
71 return 1;
73 CONVERTFUNC_EXIT
76 CONVERTFUNC(BGRA32,BGR15) /* Untested */
78 CONVERTFUNC_INIT
80 ULONG *src = (ULONG *)srcPixels;
81 UWORD *dst = (UWORD *)dstPixels;
82 ULONG x, y;
84 for(y = 0; y < height; y++)
86 for(x = 0; x < width; x++)
88 ULONG s = src[x];
90 dst[x] = DOWNSHIFT16(s, BGRA32, BGR15);
92 src = (ULONG *)(((UBYTE *)src) + srcMod);
93 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
96 return 1;
98 CONVERTFUNC_EXIT
101 CONVERTFUNC(BGRA32,ARGB32) /* Untested */
103 CONVERTFUNC_INIT
105 SWAP32CODE
107 CONVERTFUNC_EXIT
110 CONVERTFUNC(BGRA32,RGBA32) /* Untested */
112 CONVERTFUNC_INIT
114 ULONG *src = (ULONG *)srcPixels;
115 ULONG *dst = (ULONG *)dstPixels;
116 ULONG x, y;
118 for(y = 0; y < height; y++)
120 for(x = 0; x < width; x++)
122 ULONG s = src[x];
124 dst[x] = SHUFFLE32(s, BGRA32, RGBA32);
126 src = (ULONG *)(((UBYTE *)src) + srcMod);
127 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
130 return 1;
132 CONVERTFUNC_EXIT
136 CONVERTFUNC(BGRA32,ABGR32) /* Untested */
138 CONVERTFUNC_INIT
140 ULONG *src = (ULONG *)srcPixels;
141 ULONG *dst = (ULONG *)dstPixels;
142 ULONG x, y;
144 for(y = 0; y < height; y++)
146 for(x = 0; x < width; x++)
148 ULONG s = src[x];
150 dst[x] = SHUFFLE32(s, BGRA32, ABGR32);
152 src = (ULONG *)(((UBYTE *)src) + srcMod);
153 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
156 return 1;
158 CONVERTFUNC_EXIT
161 CONVERTFUNC(BGRA32,RGB24) /* Untested */
163 CONVERTFUNC_INIT
165 ULONG *src = (ULONG *)srcPixels;
166 UBYTE *dst = (UBYTE *)dstPixels;
167 ULONG x, y;
169 for(y = 0; y < height; y++)
171 for(x = 0; x < width; x++)
173 ULONG s = src[x];
175 PUT24(dst, COMP8(s, 2), COMP8(s, 1), COMP8(s, 0))
177 src = (ULONG *)(((UBYTE *)src) + srcMod);
178 dst = (UBYTE *)(((UBYTE *)dst) + dstMod);
181 return 1;
183 CONVERTFUNC_EXIT
186 CONVERTFUNC(BGRA32,BGR24) /* Untested */
188 CONVERTFUNC_INIT
190 ULONG *src = (ULONG *)srcPixels;
191 UBYTE *dst = (UBYTE *)dstPixels;
192 ULONG x, y;
194 for(y = 0; y < height; y++)
196 for(x = 0; x < width; x++)
198 ULONG s = src[x];
200 PUT24(dst, COMP8(s, 0), COMP8(s, 1), COMP8(s, 2))
202 src = (ULONG *)(((UBYTE *)src) + srcMod);
203 dst = (UBYTE *)(((UBYTE *)dst) + dstMod);
206 return 1;
208 CONVERTFUNC_EXIT
211 CONVERTFUNC(BGRA32,RGB16OE) /* Untested */
213 CONVERTFUNC_INIT
215 ULONG *src = (ULONG *)srcPixels;
216 UWORD *dst = (UWORD *)dstPixels;
217 ULONG x, y;
219 for(y = 0; y < height; y++)
221 for(x = 0; x < width; x++)
223 ULONG s = src[x];
225 s = DOWNSHIFT16(s, BGRA32, RGB16);
226 dst[x] = INV16(s);
228 src = (ULONG *)(((UBYTE *)src) + srcMod);
229 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
232 return 1;
234 CONVERTFUNC_EXIT
237 CONVERTFUNC(BGRA32,BGR16OE) /* Untested */
239 CONVERTFUNC_INIT
241 ULONG *src = (ULONG *)srcPixels;
242 UWORD *dst = (UWORD *)dstPixels;
243 ULONG x, y;
245 for(y = 0; y < height; y++)
247 for(x = 0; x < width; x++)
249 ULONG s = src[x];
251 s = DOWNSHIFT16(s, BGRA32, BGR16);
252 dst[x] = INV16(s);
254 src = (ULONG *)(((UBYTE *)src) + srcMod);
255 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
258 return 1;
260 CONVERTFUNC_EXIT
263 CONVERTFUNC(BGRA32,RGB15OE) /* Untested */
265 CONVERTFUNC_INIT
267 ULONG *src = (ULONG *)srcPixels;
268 UWORD *dst = (UWORD *)dstPixels;
269 ULONG x, y;
271 for(y = 0; y < height; y++)
273 for(x = 0; x < width; x++)
275 ULONG s = src[x];
277 s = DOWNSHIFT16(s, BGRA32, RGB15);
278 dst[x] = INV16(s);
280 src = (ULONG *)(((UBYTE *)src) + srcMod);
281 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
284 return 1;
286 CONVERTFUNC_EXIT
289 CONVERTFUNC(BGRA32,BGR15OE) /* Untested */
291 CONVERTFUNC_INIT
293 ULONG *src = (ULONG *)srcPixels;
294 UWORD *dst = (UWORD *)dstPixels;
295 ULONG x, y;
297 for(y = 0; y < height; y++)
299 for(x = 0; x < width; x++)
301 ULONG s = src[x];
303 s = DOWNSHIFT16(s, BGRA32, BGR15);
304 dst[x] = INV16(s);
306 src = (ULONG *)(((UBYTE *)src) + srcMod);
307 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
310 return 1;
312 CONVERTFUNC_EXIT
315 CONVERTFUNC(BGRA32,BGRX32) /* Untested */
317 CONVERTFUNC_INIT
319 ULONG *src = (ULONG *)srcPixels;
320 ULONG *dst = (ULONG *)dstPixels;
321 ULONG x, y;
323 for(y = 0; y < height; y++)
325 for(x = 0; x < width; x++)
327 ULONG s = src[x];
329 dst[x] = s & 0xFFFFFF00;
331 src = (ULONG *)(((UBYTE *)src) + srcMod);
332 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
335 return 1;
337 CONVERTFUNC_EXIT
340 CONVERTFUNC(BGRA32,XRGB32) /* Untested */
342 CONVERTFUNC_INIT
344 ULONG *src = (ULONG *)srcPixels;
345 ULONG *dst = (ULONG *)dstPixels;
346 ULONG x, y;
348 for(y = 0; y < height; y++)
350 for(x = 0; x < width; x++)
352 ULONG s = src[x];
354 dst[x] = SHUFFLE24(s, BGRA32, ARGB32);
356 src = (ULONG *)(((UBYTE *)src) + srcMod);
357 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
360 return 1;
362 CONVERTFUNC_EXIT
365 CONVERTFUNC(BGRA32,RGBX32) /* Untested */
367 CONVERTFUNC_INIT
369 ULONG *src = (ULONG *)srcPixels;
370 ULONG *dst = (ULONG *)dstPixels;
371 ULONG x, y;
373 for(y = 0; y < height; y++)
375 for(x = 0; x < width; x++)
377 ULONG s = src[x];
379 dst[x] = SHUFFLE24(s, BGRA32, RGBA32);
381 src = (ULONG *)(((UBYTE *)src) + srcMod);
382 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
385 return 1;
387 CONVERTFUNC_EXIT
391 CONVERTFUNC(BGRA32,XBGR32) /* Untested */
393 CONVERTFUNC_INIT
395 ULONG *src = (ULONG *)srcPixels;
396 ULONG *dst = (ULONG *)dstPixels;
397 ULONG x, y;
399 for(y = 0; y < height; y++)
401 for(x = 0; x < width; x++)
403 ULONG s = src[x];
405 dst[x] = SHUFFLE24(s, BGRA32, ABGR32);
407 src = (ULONG *)(((UBYTE *)src) + srcMod);
408 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
411 return 1;
413 CONVERTFUNC_EXIT