Squashed commit of 'x11-hostlib' branch
[tangerine.git] / test / patchrgbconv_rgb15oe.h
blobd2292f1527b01e9fca3dcfed221dd8c377b5bfc5
1 CONVERTFUNC(RGB15OE,RGB15) /* Untested */
3 CONVERTFUNC_INIT
5 SWAP16CODE
7 CONVERTFUNC_EXIT
10 CONVERTFUNC(RGB15OE,RGB16) /* Untested */
12 CONVERTFUNC_INIT
14 UWORD *src = (UWORD *)srcPixels;
15 UWORD *dst = (UWORD *)dstPixels;
16 ULONG x, y;
18 for(y = 0; y < height; y++)
20 for(x = 0; x < width; x++)
22 UWORD s = INV16(src[x]);
24 dst[x] = ((s & (RGB15_RMASK | RGB15_GMASK)) << 1) | (s & RGB15_BMASK);
26 src = (UWORD *)(((UBYTE *)src) + srcMod);
27 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
30 return 1;
32 CONVERTFUNC_EXIT
35 CONVERTFUNC(RGB15OE,BGR16) /* Untested */
37 CONVERTFUNC_INIT
39 SWAP15OE16CODE
41 CONVERTFUNC_EXIT
44 CONVERTFUNC(RGB15OE,BGR15) /* Untested */
46 CONVERTFUNC_INIT
48 SWAP15OE15CODE
50 return 1;
52 CONVERTFUNC_EXIT
55 CONVERTFUNC(RGB15OE,ARGB32) /* Untested */
57 CONVERTFUNC_INIT
59 UWORD *src = (UWORD *)srcPixels;
60 ULONG *dst = (ULONG *)dstPixels;
61 ULONG x, y;
63 for(y = 0; y < height; y++)
65 for(x = 0; x < width; x++)
67 ULONG s = INV16(src[x]);
69 dst[x] = UPSHIFT16(s, RGB15, ARGB32);
71 src = (UWORD *)(((UBYTE *)src) + srcMod);
72 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
75 return 1;
77 CONVERTFUNC_EXIT
80 CONVERTFUNC(RGB15OE,BGRA32) /* Untested */
82 CONVERTFUNC_INIT
84 UWORD *src = (UWORD *)srcPixels;
85 ULONG *dst = (ULONG *)dstPixels;
86 ULONG x, y;
88 for(y = 0; y < height; y++)
90 for(x = 0; x < width; x++)
92 ULONG s = INV16(src[x]);
94 dst[x] = UPSHIFT16(s, RGB15, BGRA32);
96 src = (UWORD *)(((UBYTE *)src) + srcMod);
97 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
100 return 1;
102 CONVERTFUNC_EXIT
105 CONVERTFUNC(RGB15OE,RGBA32) /* Untested */
107 CONVERTFUNC_INIT
109 UWORD *src = (UWORD *)srcPixels;
110 ULONG *dst = (ULONG *)dstPixels;
111 ULONG x, y;
113 for(y = 0; y < height; y++)
115 for(x = 0; x < width; x++)
117 ULONG s = INV16(src[x]);
119 dst[x] = UPSHIFT16(s, RGB15, RGBA32);
121 src = (UWORD *)(((UBYTE *)src) + srcMod);
122 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
125 return 1;
127 CONVERTFUNC_EXIT
131 CONVERTFUNC(RGB15OE,ABGR32) /* Untested */
133 CONVERTFUNC_INIT
135 UWORD *src = (UWORD *)srcPixels;
136 ULONG *dst = (ULONG *)dstPixels;
137 ULONG x, y;
139 for(y = 0; y < height; y++)
141 for(x = 0; x < width; x++)
143 ULONG s = INV16(src[x]);
145 dst[x] = UPSHIFT16(s, RGB15, ABGR32);
147 src = (UWORD *)(((UBYTE *)src) + srcMod);
148 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
151 return 1;
153 CONVERTFUNC_EXIT
156 CONVERTFUNC(RGB15OE,RGB24) /* Untested */
158 CONVERTFUNC_INIT
160 UWORD *src = (UWORD *)srcPixels;
161 UBYTE *dst = (UBYTE *)dstPixels;
162 ULONG x, y;
164 for(y = 0; y < height; y++)
166 for(x = 0; x < width; x++)
168 ULONG s = INV16(src[x]);
170 s = UPSHIFT16(s, RGB15, RGB24);
172 PUT24(dst, COMP8(s, 1), COMP8(s, 2), COMP8(s, 3))
174 src = (UWORD *)(((UBYTE *)src) + srcMod);
175 dst = (UBYTE *)(((UBYTE *)dst) + dstMod);
178 return 1;
180 CONVERTFUNC_EXIT
183 CONVERTFUNC(RGB15OE,BGR24) /* Untested */
185 CONVERTFUNC_INIT
187 UWORD *src = (UWORD *)srcPixels;
188 UBYTE *dst = (UBYTE *)dstPixels;
189 ULONG x, y;
191 for(y = 0; y < height; y++)
193 for(x = 0; x < width; x++)
195 ULONG s = INV16(src[x]);
197 s = UPSHIFT16(s, RGB15, BGR24);
199 PUT24(dst, COMP8(s, 1), COMP8(s, 2), COMP8(s, 3))
201 src = (UWORD *)(((UBYTE *)src) + srcMod);
202 dst = (UBYTE *)(((UBYTE *)dst) + dstMod);
205 return 1;
207 CONVERTFUNC_EXIT
210 CONVERTFUNC(RGB15OE,RGB16OE) /* Untested */
212 CONVERTFUNC_INIT
214 UWORD *src = (UWORD *)srcPixels;
215 UWORD *dst = (UWORD *)dstPixels;
216 ULONG x, y;
218 for(y = 0; y < height; y++)
220 for(x = 0; x < width; x++)
222 UWORD s = INV16(src[x]);
224 s = ((s & (RGB15_RMASK | RGB15_GMASK)) << 1) | (s & RGB15_BMASK);
225 dst[x] = INV16(s);
227 src = (UWORD *)(((UBYTE *)src) + srcMod);
228 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
231 return 1;
233 CONVERTFUNC_EXIT
236 CONVERTFUNC(RGB15OE,BGR16OE) /* Untested */
238 CONVERTFUNC_INIT
240 SWAP15OE16OECODE
242 CONVERTFUNC_EXIT
245 CONVERTFUNC(RGB15OE,BGR15OE) /* Untested */
247 CONVERTFUNC_INIT
249 SWAP15OE15OECODE
251 return 1;
253 CONVERTFUNC_EXIT
257 CONVERTFUNC(RGB15OE,XRGB32) /* Untested */
259 CONVERTFUNC_INIT
261 UWORD *src = (UWORD *)srcPixels;
262 ULONG *dst = (ULONG *)dstPixels;
263 ULONG x, y;
265 for(y = 0; y < height; y++)
267 for(x = 0; x < width; x++)
269 ULONG s = INV16(src[x]);
271 dst[x] = UPSHIFT16(s, RGB15, ARGB32);
273 src = (UWORD *)(((UBYTE *)src) + srcMod);
274 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
277 return 1;
279 CONVERTFUNC_EXIT
282 CONVERTFUNC(RGB15OE,BGRX32) /* Untested */
284 CONVERTFUNC_INIT
286 UWORD *src = (UWORD *)srcPixels;
287 ULONG *dst = (ULONG *)dstPixels;
288 ULONG x, y;
290 for(y = 0; y < height; y++)
292 for(x = 0; x < width; x++)
294 ULONG s = INV16(src[x]);
296 dst[x] = UPSHIFT16(s, RGB15, BGRA32);
298 src = (UWORD *)(((UBYTE *)src) + srcMod);
299 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
302 return 1;
304 CONVERTFUNC_EXIT
307 CONVERTFUNC(RGB15OE,RGBX32) /* Untested */
309 CONVERTFUNC_INIT
311 UWORD *src = (UWORD *)srcPixels;
312 ULONG *dst = (ULONG *)dstPixels;
313 ULONG x, y;
315 for(y = 0; y < height; y++)
317 for(x = 0; x < width; x++)
319 ULONG s = INV16(src[x]);
321 dst[x] = UPSHIFT16(s, RGB15, RGBA32);
323 src = (UWORD *)(((UBYTE *)src) + srcMod);
324 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
327 return 1;
329 CONVERTFUNC_EXIT
333 CONVERTFUNC(RGB15OE,XBGR32) /* Untested */
335 CONVERTFUNC_INIT
337 UWORD *src = (UWORD *)srcPixels;
338 ULONG *dst = (ULONG *)dstPixels;
339 ULONG x, y;
341 for(y = 0; y < height; y++)
343 for(x = 0; x < width; x++)
345 ULONG s = INV16(src[x]);
347 dst[x] = UPSHIFT16(s, RGB15, ABGR32);
349 src = (UWORD *)(((UBYTE *)src) + srcMod);
350 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
353 return 1;
355 CONVERTFUNC_EXIT