Don't assume imsg is non-NULL (as per MUI docs).
[AROS.git] / test / patchrgbconv_rgbx32.h
blob4515d324af33ca6a6cb9434606b2a8863658af03
1 CONVERTFUNC(RGBX32,RGB16) /* Untested */
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, RGBA32, RGB16);
17 src = (ULONG *)(((UBYTE *)src) + srcMod);
18 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
21 return 1;
23 CONVERTFUNC_EXIT
26 CONVERTFUNC(RGBX32,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, RGBA32, BGR16);
42 src = (ULONG *)(((UBYTE *)src) + srcMod);
43 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
46 return 1;
48 CONVERTFUNC_EXIT
51 CONVERTFUNC(RGBX32,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, RGBA32, RGB15);
67 src = (ULONG *)(((UBYTE *)src) + srcMod);
68 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
71 return 1;
73 CONVERTFUNC_EXIT
76 CONVERTFUNC(RGBX32,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, RGBA32, BGR15);
92 src = (ULONG *)(((UBYTE *)src) + srcMod);
93 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
96 return 1;
98 CONVERTFUNC_EXIT
101 CONVERTFUNC(RGBX32,RGBA32) /* Untested */
103 CONVERTFUNC_INIT
105 ULONG *src = (ULONG *)srcPixels;
106 ULONG *dst = (ULONG *)dstPixels;
107 ULONG x, y;
109 for(y = 0; y < height; y++)
111 for(x = 0; x < width; x++)
113 ULONG s = src[x];
115 dst[x] = s & 0xFFFFFF00;
117 src = (ULONG *)(((UBYTE *)src) + srcMod);
118 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
121 return 1;
123 CONVERTFUNC_EXIT
127 CONVERTFUNC(RGBX32,ABGR32) /* Untested */
129 CONVERTFUNC_INIT
131 ULONG *src = (ULONG *)srcPixels;
132 ULONG *dst = (ULONG *)dstPixels;
133 ULONG x, y;
135 for(y = 0; y < height; y++)
137 for(x = 0; x < width; x++)
139 ULONG s = src[x];
141 dst[x] = SHUFFLE24(s, RGBA32, ABGR32);
143 src = (ULONG *)(((UBYTE *)src) + srcMod);
144 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
147 return 1;
149 CONVERTFUNC_EXIT
152 CONVERTFUNC(RGBX32,ARGB32) /* Untested */
154 CONVERTFUNC_INIT
156 ULONG *src = (ULONG *)srcPixels;
157 ULONG *dst = (ULONG *)dstPixels;
158 ULONG x, y;
160 for(y = 0; y < height; y++)
162 for(x = 0; x < width; x++)
164 ULONG s = src[x];
166 dst[x] = SHUFFLE24(s, RGBA32, ARGB32);
168 src = (ULONG *)(((UBYTE *)src) + srcMod);
169 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
172 return 1;
174 CONVERTFUNC_EXIT
178 CONVERTFUNC(RGBX32,BGRA32) /* Untested */
180 CONVERTFUNC_INIT
182 ULONG *src = (ULONG *)srcPixels;
183 ULONG *dst = (ULONG *)dstPixels;
184 ULONG x, y;
186 for(y = 0; y < height; y++)
188 for(x = 0; x < width; x++)
190 ULONG s = src[x];
192 dst[x] = SHUFFLE24(s, RGBA32, BGRA32);
194 src = (ULONG *)(((UBYTE *)src) + srcMod);
195 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
198 return 1;
200 CONVERTFUNC_EXIT
203 CONVERTFUNC(RGBX32,RGB24) /* Untested */
205 CONVERTFUNC_INIT
207 ULONG *src = (ULONG *)srcPixels;
208 UBYTE *dst = (UBYTE *)dstPixels;
209 ULONG x, y;
211 for(y = 0; y < height; y++)
213 for(x = 0; x < width; x++)
215 ULONG s = src[x];
217 PUT24(dst, COMP8(s, 0), COMP8(s, 1), COMP8(s, 2))
219 src = (ULONG *)(((UBYTE *)src) + srcMod);
220 dst = (UBYTE *)(((UBYTE *)dst) + dstMod);
223 return 1;
225 CONVERTFUNC_EXIT
228 CONVERTFUNC(RGBX32,BGR24) /* Untested */
230 CONVERTFUNC_INIT
232 ULONG *src = (ULONG *)srcPixels;
233 UBYTE *dst = (UBYTE *)dstPixels;
234 ULONG x, y;
236 for(y = 0; y < height; y++)
238 for(x = 0; x < width; x++)
240 ULONG s = src[x];
242 PUT24(dst, COMP8(s, 2), COMP8(s, 1), COMP8(s, 0))
244 src = (ULONG *)(((UBYTE *)src) + srcMod);
245 dst = (UBYTE *)(((UBYTE *)dst) + dstMod);
248 return 1;
250 CONVERTFUNC_EXIT
253 CONVERTFUNC(RGBX32,RGB16OE) /* Untested */
255 CONVERTFUNC_INIT
257 ULONG *src = (ULONG *)srcPixels;
258 UWORD *dst = (UWORD *)dstPixels;
259 ULONG x, y;
261 for(y = 0; y < height; y++)
263 for(x = 0; x < width; x++)
265 ULONG s = src[x];
267 s = DOWNSHIFT16(s, RGBA32, RGB16);
268 dst[x] = INV16(s);
270 src = (ULONG *)(((UBYTE *)src) + srcMod);
271 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
274 return 1;
276 CONVERTFUNC_EXIT
279 CONVERTFUNC(RGBX32,BGR16OE) /* Untested */
281 CONVERTFUNC_INIT
283 ULONG *src = (ULONG *)srcPixels;
284 UWORD *dst = (UWORD *)dstPixels;
285 ULONG x, y;
287 for(y = 0; y < height; y++)
289 for(x = 0; x < width; x++)
291 ULONG s = src[x];
293 s = DOWNSHIFT16(s, RGBA32, BGR16);
294 dst[x] = INV16(s);
296 src = (ULONG *)(((UBYTE *)src) + srcMod);
297 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
300 return 1;
302 CONVERTFUNC_EXIT
305 CONVERTFUNC(RGBX32,RGB15OE) /* Untested */
307 CONVERTFUNC_INIT
309 ULONG *src = (ULONG *)srcPixels;
310 UWORD *dst = (UWORD *)dstPixels;
311 ULONG x, y;
313 for(y = 0; y < height; y++)
315 for(x = 0; x < width; x++)
317 ULONG s = src[x];
319 s = DOWNSHIFT16(s, RGBA32, RGB15);
320 dst[x] = INV16(s);
322 src = (ULONG *)(((UBYTE *)src) + srcMod);
323 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
326 return 1;
328 CONVERTFUNC_EXIT
331 CONVERTFUNC(RGBX32,BGR15OE) /* Untested */
333 CONVERTFUNC_INIT
335 ULONG *src = (ULONG *)srcPixels;
336 UWORD *dst = (UWORD *)dstPixels;
337 ULONG x, y;
339 for(y = 0; y < height; y++)
341 for(x = 0; x < width; x++)
343 ULONG s = src[x];
345 s = DOWNSHIFT16(s, RGBA32, BGR15);
346 dst[x] = INV16(s);
348 src = (ULONG *)(((UBYTE *)src) + srcMod);
349 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
352 return 1;
354 CONVERTFUNC_EXIT
357 CONVERTFUNC(RGBX32,BGRX32) /* Untested */
359 CONVERTFUNC_INIT
361 ULONG *src = (ULONG *)srcPixels;
362 ULONG *dst = (ULONG *)dstPixels;
363 ULONG x, y;
365 for(y = 0; y < height; y++)
367 for(x = 0; x < width; x++)
369 ULONG s = src[x];
371 dst[x] = SHUFFLE24(s, RGBA32, BGRA32);
373 src = (ULONG *)(((UBYTE *)src) + srcMod);
374 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
377 return 1;
379 CONVERTFUNC_EXIT
382 CONVERTFUNC(RGBX32,XBGR32) /* Untested */
384 CONVERTFUNC_INIT
386 SWAP32CODE
388 CONVERTFUNC_EXIT
392 CONVERTFUNC(RGBX32,XRGB32) /* Untested */
394 CONVERTFUNC_INIT
396 ULONG *src = (ULONG *)srcPixels;
397 ULONG *dst = (ULONG *)dstPixels;
398 ULONG x, y;
400 for(y = 0; y < height; y++)
402 for(x = 0; x < width; x++)
404 ULONG s = src[x];
406 dst[x] = SHUFFLE24(s, RGBA32, ARGB32);
408 src = (ULONG *)(((UBYTE *)src) + srcMod);
409 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
412 return 1;
414 CONVERTFUNC_EXIT