dos.library: Fix race condition caught by mungwall in CreateNewProc()
[AROS.git] / test / patchrgbconv_xrgb32.h
blobdcfaa127e6b2db642b8c57e527d81a5af2ed3204
1 CONVERTFUNC(XRGB32,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, ARGB32, RGB16);
17 src = (ULONG *)(((UBYTE *)src) + srcMod);
18 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
21 return 1;
23 CONVERTFUNC_EXIT
26 CONVERTFUNC(XRGB32,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, ARGB32, BGR16);
42 src = (ULONG *)(((UBYTE *)src) + srcMod);
43 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
46 return 1;
48 CONVERTFUNC_EXIT
51 CONVERTFUNC(XRGB32,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, ARGB32, RGB15);
67 src = (ULONG *)(((UBYTE *)src) + srcMod);
68 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
71 return 1;
73 CONVERTFUNC_EXIT
76 CONVERTFUNC(XRGB32,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, ARGB32, BGR15);
92 src = (ULONG *)(((UBYTE *)src) + srcMod);
93 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
96 return 1;
98 CONVERTFUNC_EXIT
101 CONVERTFUNC(XRGB32,ARGB32) /* 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 & 0x00FFFFFF;
117 src = (ULONG *)(((UBYTE *)src) + srcMod);
118 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
121 return 1;
123 CONVERTFUNC_EXIT
126 CONVERTFUNC(XRGB32,BGRA32) /* Untested */
128 CONVERTFUNC_INIT
130 ULONG *src = (ULONG *)srcPixels;
131 ULONG *dst = (ULONG *)dstPixels;
132 ULONG x, y;
134 for(y = 0; y < height; y++)
136 for(x = 0; x < width; x++)
138 ULONG s = src[x];
140 dst[x] = SHUFFLE24(s, ARGB32, BGRA32);
142 src = (ULONG *)(((UBYTE *)src) + srcMod);
143 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
146 return 1;
148 CONVERTFUNC_EXIT
151 CONVERTFUNC(XRGB32,RGBA32) /* Untested */
153 CONVERTFUNC_INIT
155 ULONG *src = (ULONG *)srcPixels;
156 ULONG *dst = (ULONG *)dstPixels;
157 ULONG x, y;
159 for(y = 0; y < height; y++)
161 for(x = 0; x < width; x++)
163 ULONG s = src[x];
165 dst[x] = SHUFFLE24(s, ARGB32, RGBA32);
167 src = (ULONG *)(((UBYTE *)src) + srcMod);
168 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
171 return 1;
173 CONVERTFUNC_EXIT
177 CONVERTFUNC(XRGB32,ABGR32) /* Untested */
179 CONVERTFUNC_INIT
181 ULONG *src = (ULONG *)srcPixels;
182 ULONG *dst = (ULONG *)dstPixels;
183 ULONG x, y;
185 for(y = 0; y < height; y++)
187 for(x = 0; x < width; x++)
189 ULONG s = src[x];
191 dst[x] = SHUFFLE24(s, ARGB32, ABGR32);
193 src = (ULONG *)(((UBYTE *)src) + srcMod);
194 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
197 return 1;
199 CONVERTFUNC_EXIT
202 CONVERTFUNC(XRGB32,RGB24) /* Untested */
204 CONVERTFUNC_INIT
206 ULONG *src = (ULONG *)srcPixels;
207 UBYTE *dst = (UBYTE *)dstPixels;
208 ULONG x, y;
210 for(y = 0; y < height; y++)
212 for(x = 0; x < width; x++)
214 ULONG s = src[x];
216 PUT24(dst, COMP8(s, 1), COMP8(s, 2), COMP8(s, 3))
218 src = (ULONG *)(((UBYTE *)src) + srcMod);
219 dst = (UBYTE *)(((UBYTE *)dst) + dstMod);
222 return 1;
224 CONVERTFUNC_EXIT
227 CONVERTFUNC(XRGB32,BGR24) /* Untested */
229 CONVERTFUNC_INIT
231 ULONG *src = (ULONG *)srcPixels;
232 UBYTE *dst = (UBYTE *)dstPixels;
233 ULONG x, y;
235 for(y = 0; y < height; y++)
237 for(x = 0; x < width; x++)
239 ULONG s = src[x];
241 PUT24(dst, COMP8(s, 3), COMP8(s, 2), COMP8(s, 1))
243 src = (ULONG *)(((UBYTE *)src) + srcMod);
244 dst = (UBYTE *)(((UBYTE *)dst) + dstMod);
247 return 1;
249 CONVERTFUNC_EXIT
252 CONVERTFUNC(XRGB32,RGB16OE) /* Untested */
254 CONVERTFUNC_INIT
256 ULONG *src = (ULONG *)srcPixels;
257 UWORD *dst = (UWORD *)dstPixels;
258 ULONG x, y;
260 for(y = 0; y < height; y++)
262 for(x = 0; x < width; x++)
264 ULONG s = src[x];
266 s = DOWNSHIFT16(s, ARGB32, RGB16);
267 dst[x] = INV16(s);
269 src = (ULONG *)(((UBYTE *)src) + srcMod);
270 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
273 return 1;
275 CONVERTFUNC_EXIT
278 CONVERTFUNC(XRGB32,BGR16OE) /* Untested */
280 CONVERTFUNC_INIT
282 ULONG *src = (ULONG *)srcPixels;
283 UWORD *dst = (UWORD *)dstPixels;
284 ULONG x, y;
286 for(y = 0; y < height; y++)
288 for(x = 0; x < width; x++)
290 ULONG s = src[x];
292 s = DOWNSHIFT16(s, ARGB32, BGR16);
293 dst[x] = INV16(s);
295 src = (ULONG *)(((UBYTE *)src) + srcMod);
296 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
299 return 1;
301 CONVERTFUNC_EXIT
304 CONVERTFUNC(XRGB32,RGB15OE) /* Untested */
306 CONVERTFUNC_INIT
308 ULONG *src = (ULONG *)srcPixels;
309 UWORD *dst = (UWORD *)dstPixels;
310 ULONG x, y;
312 for(y = 0; y < height; y++)
314 for(x = 0; x < width; x++)
316 ULONG s = src[x];
318 s = DOWNSHIFT16(s, ARGB32, RGB15);
319 dst[x] = INV16(s);
321 src = (ULONG *)(((UBYTE *)src) + srcMod);
322 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
325 return 1;
327 CONVERTFUNC_EXIT
330 CONVERTFUNC(XRGB32,BGR15OE) /* Untested */
332 CONVERTFUNC_INIT
334 ULONG *src = (ULONG *)srcPixels;
335 UWORD *dst = (UWORD *)dstPixels;
336 ULONG x, y;
338 for(y = 0; y < height; y++)
340 for(x = 0; x < width; x++)
342 ULONG s = src[x];
344 s = DOWNSHIFT16(s, ARGB32, BGR15);
345 dst[x] = INV16(s);
347 src = (ULONG *)(((UBYTE *)src) + srcMod);
348 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
351 return 1;
353 CONVERTFUNC_EXIT
356 CONVERTFUNC(XRGB32,BGRX32) /* Untested */
358 CONVERTFUNC_INIT
360 SWAP32CODE
362 CONVERTFUNC_EXIT
365 CONVERTFUNC(XRGB32,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, ARGB32, RGBA32);
381 src = (ULONG *)(((UBYTE *)src) + srcMod);
382 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
385 return 1;
387 CONVERTFUNC_EXIT
391 CONVERTFUNC(XRGB32,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, ARGB32, ABGR32);
407 src = (ULONG *)(((UBYTE *)src) + srcMod);
408 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
411 return 1;
413 CONVERTFUNC_EXIT