squashed commit of private hostlib-resource branch
[tangerine.git] / test / patchrgbconv_bgr15oe.h
blobbf7987a71d0a321ef3b66a303f5daa04acf02c17
1 CONVERTFUNC(BGR15OE,BGR15) /* Untested */
3 CONVERTFUNC_INIT
5 SWAP16CODE
7 CONVERTFUNC_EXIT
10 CONVERTFUNC(BGR15OE,RGB16) /* Untested */
12 CONVERTFUNC_INIT
14 SWAP15OE16CODE
16 CONVERTFUNC_EXIT
19 CONVERTFUNC(BGR15OE,BGR16) /* Untested */
21 CONVERTFUNC_INIT
23 UWORD *src = (UWORD *)srcPixels;
24 UWORD *dst = (UWORD *)dstPixels;
25 ULONG x, y;
27 for(y = 0; y < height; y++)
29 for(x = 0; x < width; x++)
31 UWORD s = INV16(src[x]);
33 dst[x] = ((s & (BGR15_BMASK | BGR15_GMASK)) << 1) | (s & BGR15_RMASK);
35 src = (UWORD *)(((UBYTE *)src) + srcMod);
36 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
39 return 1;
41 CONVERTFUNC_EXIT
44 CONVERTFUNC(BGR15OE,RGB15) /* Untested */
46 CONVERTFUNC_INIT
48 SWAP15OE15CODE
50 CONVERTFUNC_EXIT
53 CONVERTFUNC(BGR15OE,ARGB32) /* Untested */
55 CONVERTFUNC_INIT
57 UWORD *src = (UWORD *)srcPixels;
58 ULONG *dst = (ULONG *)dstPixels;
59 ULONG x, y;
61 for(y = 0; y < height; y++)
63 for(x = 0; x < width; x++)
65 ULONG s = INV16(src[x]);
67 dst[x] = UPSHIFT16(s, BGR15, ARGB32);
69 src = (UWORD *)(((UBYTE *)src) + srcMod);
70 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
73 return 1;
75 CONVERTFUNC_EXIT
78 CONVERTFUNC(BGR15OE,BGRA32) /* Untested */
80 CONVERTFUNC_INIT
82 UWORD *src = (UWORD *)srcPixels;
83 ULONG *dst = (ULONG *)dstPixels;
84 ULONG x, y;
86 for(y = 0; y < height; y++)
88 for(x = 0; x < width; x++)
90 ULONG s = INV16(src[x]);
92 dst[x] = UPSHIFT16(s, BGR15, BGRA32);
94 src = (UWORD *)(((UBYTE *)src) + srcMod);
95 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
98 return 1;
100 CONVERTFUNC_EXIT
103 CONVERTFUNC(BGR15OE,RGBA32) /* Untested */
105 CONVERTFUNC_INIT
107 UWORD *src = (UWORD *)srcPixels;
108 ULONG *dst = (ULONG *)dstPixels;
109 ULONG x, y;
111 for(y = 0; y < height; y++)
113 for(x = 0; x < width; x++)
115 ULONG s = INV16(src[x]);
117 dst[x] = UPSHIFT16(s, BGR15, RGBA32);
119 src = (UWORD *)(((UBYTE *)src) + srcMod);
120 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
123 return 1;
125 CONVERTFUNC_EXIT
129 CONVERTFUNC(BGR15OE,ABGR32) /* Untested */
131 CONVERTFUNC_INIT
133 UWORD *src = (UWORD *)srcPixels;
134 ULONG *dst = (ULONG *)dstPixels;
135 ULONG x, y;
137 for(y = 0; y < height; y++)
139 for(x = 0; x < width; x++)
141 ULONG s = INV16(src[x]);
143 dst[x] = UPSHIFT16(s, BGR15, ABGR32);
145 src = (UWORD *)(((UBYTE *)src) + srcMod);
146 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
149 return 1;
151 CONVERTFUNC_EXIT
154 CONVERTFUNC(BGR15OE,RGB24) /* Untested */
156 CONVERTFUNC_INIT
158 UWORD *src = (UWORD *)srcPixels;
159 UBYTE *dst = (UBYTE *)dstPixels;
160 ULONG x, y;
162 for(y = 0; y < height; y++)
164 for(x = 0; x < width; x++)
166 ULONG s = INV16(src[x]);
168 s = UPSHIFT16(s, BGR15, RGB24);
170 PUT24(dst, COMP8(s, 1), COMP8(s, 2), COMP8(s, 3))
172 src = (UWORD *)(((UBYTE *)src) + srcMod);
173 dst = (UBYTE *)(((UBYTE *)dst) + dstMod);
176 return 1;
178 CONVERTFUNC_EXIT
181 CONVERTFUNC(BGR15OE,BGR24) /* Untested */
183 CONVERTFUNC_INIT
185 UWORD *src = (UWORD *)srcPixels;
186 UBYTE *dst = (UBYTE *)dstPixels;
187 ULONG x, y;
189 for(y = 0; y < height; y++)
191 for(x = 0; x < width; x++)
193 ULONG s = INV16(src[x]);
195 s = UPSHIFT16(s, BGR15, BGR24);
197 PUT24(dst, COMP8(s, 1), COMP8(s, 2), COMP8(s, 3))
199 src = (UWORD *)(((UBYTE *)src) + srcMod);
200 dst = (UBYTE *)(((UBYTE *)dst) + dstMod);
203 return 1;
205 CONVERTFUNC_EXIT
208 CONVERTFUNC(BGR15OE,RGB16OE) /* Untested */
210 CONVERTFUNC_INIT
212 SWAP15OE16OECODE
214 CONVERTFUNC_EXIT
217 CONVERTFUNC(BGR15OE,BGR16OE) /* Untested */
219 CONVERTFUNC_INIT
221 UWORD *src = (UWORD *)srcPixels;
222 UWORD *dst = (UWORD *)dstPixels;
223 ULONG x, y;
225 for(y = 0; y < height; y++)
227 for(x = 0; x < width; x++)
229 UWORD s = INV16(src[x]);
231 s = ((s & (BGR15_BMASK | BGR15_GMASK)) << 1) | (s & BGR15_RMASK);
232 dst[x] = INV16(s);
234 src = (UWORD *)(((UBYTE *)src) + srcMod);
235 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
238 return 1;
240 CONVERTFUNC_EXIT
243 CONVERTFUNC(BGR15OE,RGB15OE) /* Untested */
245 CONVERTFUNC_INIT
247 SWAP15OE15OECODE
249 CONVERTFUNC_EXIT
252 CONVERTFUNC(BGR15OE,XRGB32) /* Untested */
254 CONVERTFUNC_INIT
256 UWORD *src = (UWORD *)srcPixels;
257 ULONG *dst = (ULONG *)dstPixels;
258 ULONG x, y;
260 for(y = 0; y < height; y++)
262 for(x = 0; x < width; x++)
264 ULONG s = INV16(src[x]);
266 dst[x] = UPSHIFT16(s, BGR15, ARGB32);
268 src = (UWORD *)(((UBYTE *)src) + srcMod);
269 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
272 return 1;
274 CONVERTFUNC_EXIT
277 CONVERTFUNC(BGR15OE,BGRX32) /* Untested */
279 CONVERTFUNC_INIT
281 UWORD *src = (UWORD *)srcPixels;
282 ULONG *dst = (ULONG *)dstPixels;
283 ULONG x, y;
285 for(y = 0; y < height; y++)
287 for(x = 0; x < width; x++)
289 ULONG s = INV16(src[x]);
291 dst[x] = UPSHIFT16(s, BGR15, BGRA32);
293 src = (UWORD *)(((UBYTE *)src) + srcMod);
294 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
297 return 1;
299 CONVERTFUNC_EXIT
302 CONVERTFUNC(BGR15OE,RGBX32) /* Untested */
304 CONVERTFUNC_INIT
306 UWORD *src = (UWORD *)srcPixels;
307 ULONG *dst = (ULONG *)dstPixels;
308 ULONG x, y;
310 for(y = 0; y < height; y++)
312 for(x = 0; x < width; x++)
314 ULONG s = INV16(src[x]);
316 dst[x] = UPSHIFT16(s, BGR15, RGBA32);
318 src = (UWORD *)(((UBYTE *)src) + srcMod);
319 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
322 return 1;
324 CONVERTFUNC_EXIT
328 CONVERTFUNC(BGR15OE,XBGR32) /* Untested */
330 CONVERTFUNC_INIT
332 UWORD *src = (UWORD *)srcPixels;
333 ULONG *dst = (ULONG *)dstPixels;
334 ULONG x, y;
336 for(y = 0; y < height; y++)
338 for(x = 0; x < width; x++)
340 ULONG s = INV16(src[x]);
342 dst[x] = UPSHIFT16(s, BGR15, ABGR32);
344 src = (UWORD *)(((UBYTE *)src) + srcMod);
345 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
348 return 1;
350 CONVERTFUNC_EXIT