squashed commit of private hostlib-resource branch
[tangerine.git] / test / patchrgbconv_rgb24.h
blobd68ebe9dae2da0d969c6273961d3e2f7289e42c4
1 CONVERTFUNC(RGB24,RGB16) /* Untested */
3 CONVERTFUNC_INIT
5 UBYTE *src = (UBYTE *)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 = GET24;
15 dst[x] = DOWNSHIFT16(s, RGB24, RGB16);
17 src = (UBYTE *)(((UBYTE *)src) + srcMod);
18 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
21 return 1;
23 CONVERTFUNC_EXIT
26 CONVERTFUNC(RGB24,BGR16) /* Untested */
28 CONVERTFUNC_INIT
30 UBYTE *src = (UBYTE *)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 = GET24;
40 dst[x] = DOWNSHIFT16(s, RGB24, BGR16);
42 src = (UBYTE *)(((UBYTE *)src) + srcMod);
43 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
46 return 1;
48 CONVERTFUNC_EXIT
51 CONVERTFUNC(RGB24,RGB15) /* Untested */
53 CONVERTFUNC_INIT
55 UBYTE *src = (UBYTE *)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 = GET24;
65 dst[x] = DOWNSHIFT16(s, RGB24, RGB15);
67 src = (UBYTE *)(((UBYTE *)src) + srcMod);
68 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
71 return 1;
73 CONVERTFUNC_EXIT
76 CONVERTFUNC(RGB24,BGR15) /* Untested */
78 CONVERTFUNC_INIT
80 UBYTE *src = (UBYTE *)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 = GET24;
90 dst[x] = DOWNSHIFT16(s, RGB24, BGR15);
92 src = (UBYTE *)(((UBYTE *)src) + srcMod);
93 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
96 return 1;
98 CONVERTFUNC_EXIT
101 CONVERTFUNC(RGB24,ARGB32) /* Untested */
103 CONVERTFUNC_INIT
105 UBYTE *src = (UBYTE *)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 = GET24;
115 dst[x] = s;
117 src = (UBYTE *)(((UBYTE *)src) + srcMod);
118 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
121 return 1;
123 CONVERTFUNC_EXIT
126 CONVERTFUNC(RGB24,BGRA32) /* Untested */
128 CONVERTFUNC_INIT
130 UBYTE *src = (UBYTE *)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 = GET24;
140 dst[x] = SHUFFLE24(s, RGB24, BGRA32);
142 src = (UBYTE *)(((UBYTE *)src) + srcMod);
143 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
146 return 1;
148 CONVERTFUNC_EXIT
151 CONVERTFUNC(RGB24,RGBA32) /* Untested */
153 CONVERTFUNC_INIT
155 UBYTE *src = (UBYTE *)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 = GET24;
165 dst[x] = s << 8;
167 src = (UBYTE *)(((UBYTE *)src) + srcMod);
168 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
171 return 1;
173 CONVERTFUNC_EXIT
177 CONVERTFUNC(RGB24,ABGR32) /* Untested */
179 CONVERTFUNC_INIT
181 SWAP2432CODE
183 CONVERTFUNC_EXIT
186 CONVERTFUNC(RGB24,BGR24) /* Untested */
188 CONVERTFUNC_INIT
190 SWAP2424CODE
192 return 1;
194 CONVERTFUNC_EXIT
197 CONVERTFUNC(RGB24,RGB16OE) /* Untested */
199 CONVERTFUNC_INIT
201 UBYTE *src = (UBYTE *)srcPixels;
202 UWORD *dst = (UWORD *)dstPixels;
203 ULONG x, y;
205 for(y = 0; y < height; y++)
207 for(x = 0; x < width; x++)
209 ULONG s = GET24;
211 s = DOWNSHIFT16(s, RGB24, RGB16);
212 dst[x] = INV16(s);
214 src = (UBYTE *)(((UBYTE *)src) + srcMod);
215 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
218 return 1;
220 CONVERTFUNC_EXIT
223 CONVERTFUNC(RGB24,BGR16OE) /* Untested */
225 CONVERTFUNC_INIT
227 UBYTE *src = (UBYTE *)srcPixels;
228 UWORD *dst = (UWORD *)dstPixels;
229 ULONG x, y;
231 for(y = 0; y < height; y++)
233 for(x = 0; x < width; x++)
235 ULONG s = GET24;
237 s = DOWNSHIFT16(s, RGB24, BGR16);
238 dst[x] = INV16(s);
240 src = (UBYTE *)(((UBYTE *)src) + srcMod);
241 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
244 return 1;
246 CONVERTFUNC_EXIT
249 CONVERTFUNC(RGB24,RGB15OE) /* Untested */
251 CONVERTFUNC_INIT
253 UBYTE *src = (UBYTE *)srcPixels;
254 UWORD *dst = (UWORD *)dstPixels;
255 ULONG x, y;
257 for(y = 0; y < height; y++)
259 for(x = 0; x < width; x++)
261 ULONG s = GET24;
263 s = DOWNSHIFT16(s, RGB24, RGB15);
264 dst[x] = INV16(s);
266 src = (UBYTE *)(((UBYTE *)src) + srcMod);
267 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
270 return 1;
272 CONVERTFUNC_EXIT
275 CONVERTFUNC(RGB24,BGR15OE) /* Untested */
277 CONVERTFUNC_INIT
279 UBYTE *src = (UBYTE *)srcPixels;
280 UWORD *dst = (UWORD *)dstPixels;
281 ULONG x, y;
283 for(y = 0; y < height; y++)
285 for(x = 0; x < width; x++)
287 ULONG s = GET24;
289 s = DOWNSHIFT16(s, RGB24, BGR15);
290 dst[x] = INV16(s);
292 src = (UBYTE *)(((UBYTE *)src) + srcMod);
293 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
296 return 1;
298 CONVERTFUNC_EXIT
301 CONVERTFUNC(RGB24,XRGB32) /* Untested */
303 CONVERTFUNC_INIT
305 UBYTE *src = (UBYTE *)srcPixels;
306 ULONG *dst = (ULONG *)dstPixels;
307 ULONG x, y;
309 for(y = 0; y < height; y++)
311 for(x = 0; x < width; x++)
313 ULONG s = GET24;
315 dst[x] = s;
317 src = (UBYTE *)(((UBYTE *)src) + srcMod);
318 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
321 return 1;
323 CONVERTFUNC_EXIT
326 CONVERTFUNC(RGB24,BGRX32) /* Untested */
328 CONVERTFUNC_INIT
330 UBYTE *src = (UBYTE *)srcPixels;
331 ULONG *dst = (ULONG *)dstPixels;
332 ULONG x, y;
334 for(y = 0; y < height; y++)
336 for(x = 0; x < width; x++)
338 ULONG s = GET24;
340 dst[x] = SHUFFLE24(s, RGB24, BGRA32);
342 src = (UBYTE *)(((UBYTE *)src) + srcMod);
343 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
346 return 1;
348 CONVERTFUNC_EXIT
351 CONVERTFUNC(RGB24,RGBX32) /* Untested */
353 CONVERTFUNC_INIT
355 UBYTE *src = (UBYTE *)srcPixels;
356 ULONG *dst = (ULONG *)dstPixels;
357 ULONG x, y;
359 for(y = 0; y < height; y++)
361 for(x = 0; x < width; x++)
363 ULONG s = GET24;
365 dst[x] = s << 8;
367 src = (UBYTE *)(((UBYTE *)src) + srcMod);
368 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
371 return 1;
373 CONVERTFUNC_EXIT
377 CONVERTFUNC(RGB24,XBGR32) /* Untested */
379 CONVERTFUNC_INIT
381 SWAP2432CODE
383 CONVERTFUNC_EXIT