Squashed commit of 'x11-hostlib' branch
[tangerine.git] / test / patchrgbconv_rgb16.h
blob1c256672489856c3b2e11f2e97de257c87775a9c
1 CONVERTFUNC(RGB16,RGB15) /* Untested */
3 CONVERTFUNC_INIT
5 UWORD *src = (UWORD *)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 UWORD s = src[x];
15 dst[x] = ((s >> 1) & (RGB15_RMASK | RGB15_GMASK)) | (s & RGB15_BMASK);
17 src = (UWORD *)(((UBYTE *)src) + srcMod);
18 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
21 return 1;
23 CONVERTFUNC_EXIT
26 CONVERTFUNC(RGB16,BGR16) /* Untested */
28 CONVERTFUNC_INIT
30 SWAP1616CODE
32 CONVERTFUNC_EXIT
35 CONVERTFUNC(RGB16,BGR15) /* Untested */
37 CONVERTFUNC_INIT
39 SWAP1615CODE
41 CONVERTFUNC_EXIT
44 CONVERTFUNC(RGB16,ARGB32) /* Untested */
46 CONVERTFUNC_INIT
48 UWORD *src = (UWORD *)srcPixels;
49 ULONG *dst = (ULONG *)dstPixels;
50 ULONG x, y;
52 for(y = 0; y < height; y++)
54 for(x = 0; x < width; x++)
56 ULONG s = src[x];
58 dst[x] = UPSHIFT16(s, RGB16, ARGB32);
60 src = (UWORD *)(((UBYTE *)src) + srcMod);
61 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
64 return 1;
66 CONVERTFUNC_EXIT
69 CONVERTFUNC(RGB16,BGRA32) /* Untested */
71 CONVERTFUNC_INIT
73 UWORD *src = (UWORD *)srcPixels;
74 ULONG *dst = (ULONG *)dstPixels;
75 ULONG x, y;
77 for(y = 0; y < height; y++)
79 for(x = 0; x < width; x++)
81 ULONG s = src[x];
83 dst[x] = UPSHIFT16(s, RGB16, BGRA32);
85 src = (UWORD *)(((UBYTE *)src) + srcMod);
86 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
89 return 1;
91 CONVERTFUNC_EXIT
94 CONVERTFUNC(RGB16,RGBA32) /* Untested */
96 CONVERTFUNC_INIT
98 UWORD *src = (UWORD *)srcPixels;
99 ULONG *dst = (ULONG *)dstPixels;
100 ULONG x, y;
102 for(y = 0; y < height; y++)
104 for(x = 0; x < width; x++)
106 ULONG s = src[x];
108 dst[x] = UPSHIFT16(s, RGB16, RGBA32);
110 src = (UWORD *)(((UBYTE *)src) + srcMod);
111 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
114 return 1;
116 CONVERTFUNC_EXIT
120 CONVERTFUNC(RGB16,ABGR32) /* Untested */
122 CONVERTFUNC_INIT
124 UWORD *src = (UWORD *)srcPixels;
125 ULONG *dst = (ULONG *)dstPixels;
126 ULONG x, y;
128 for(y = 0; y < height; y++)
130 for(x = 0; x < width; x++)
132 ULONG s = src[x];
134 dst[x] = UPSHIFT16(s, RGB16, ABGR32);
136 src = (UWORD *)(((UBYTE *)src) + srcMod);
137 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
140 return 1;
142 CONVERTFUNC_EXIT
145 CONVERTFUNC(RGB16,RGB24) /* Untested */
147 CONVERTFUNC_INIT
149 UWORD *src = (UWORD *)srcPixels;
150 UBYTE *dst = (UBYTE *)dstPixels;
151 ULONG x, y;
153 for(y = 0; y < height; y++)
155 for(x = 0; x < width; x++)
157 ULONG s = src[x];
159 s = UPSHIFT16(s, RGB16, RGB24);
161 PUT24(dst, COMP8(s, 1), COMP8(s, 2), COMP8(s, 3))
163 src = (UWORD *)(((UBYTE *)src) + srcMod);
164 dst = (UBYTE *)(((UBYTE *)dst) + dstMod);
167 return 1;
169 CONVERTFUNC_EXIT
172 CONVERTFUNC(RGB16,BGR24) /* Untested */
174 CONVERTFUNC_INIT
176 UWORD *src = (UWORD *)srcPixels;
177 UBYTE *dst = (UBYTE *)dstPixels;
178 ULONG x, y;
180 for(y = 0; y < height; y++)
182 for(x = 0; x < width; x++)
184 ULONG s = src[x];
186 s = UPSHIFT16(s, RGB16, BGR24);
188 PUT24(dst, COMP8(s, 1), COMP8(s, 2), COMP8(s, 3))
190 src = (UWORD *)(((UBYTE *)src) + srcMod);
191 dst = (UBYTE *)(((UBYTE *)dst) + dstMod);
194 return 1;
196 CONVERTFUNC_EXIT
200 CONVERTFUNC(RGB16,RGB15OE) /* Untested */
202 CONVERTFUNC_INIT
204 UWORD *src = (UWORD *)srcPixels;
205 UWORD *dst = (UWORD *)dstPixels;
206 ULONG x, y;
208 for(y = 0; y < height; y++)
210 for(x = 0; x < width; x++)
212 UWORD s = src[x];
214 s = ((s >> 1) & (RGB15_RMASK | RGB15_GMASK)) | (s & RGB15_BMASK);
215 dst[x] = INV16(s);
217 src = (UWORD *)(((UBYTE *)src) + srcMod);
218 dst = (UWORD *)(((UBYTE *)dst) + dstMod);
221 return 1;
223 CONVERTFUNC_EXIT
226 CONVERTFUNC(RGB16,BGR16OE) /* Untested */
228 CONVERTFUNC_INIT
230 SWAP1616OECODE
232 CONVERTFUNC_EXIT
235 CONVERTFUNC(RGB16,BGR15OE) /* Untested */
237 CONVERTFUNC_INIT
239 SWAP1615OECODE
241 CONVERTFUNC_EXIT
244 CONVERTFUNC(RGB16,RGB16OE) /* Untested */
246 CONVERTFUNC_INIT
248 SWAP16CODE
250 CONVERTFUNC_EXIT
253 CONVERTFUNC(RGB16,XRGB32) /* Untested */
255 CONVERTFUNC_INIT
257 UWORD *src = (UWORD *)srcPixels;
258 ULONG *dst = (ULONG *)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 dst[x] = UPSHIFT16(s, RGB16, ARGB32);
269 src = (UWORD *)(((UBYTE *)src) + srcMod);
270 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
273 return 1;
275 CONVERTFUNC_EXIT
278 CONVERTFUNC(RGB16,BGRX32) /* Untested */
280 CONVERTFUNC_INIT
282 UWORD *src = (UWORD *)srcPixels;
283 ULONG *dst = (ULONG *)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 dst[x] = UPSHIFT16(s, RGB16, BGRA32);
294 src = (UWORD *)(((UBYTE *)src) + srcMod);
295 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
298 return 1;
300 CONVERTFUNC_EXIT
303 CONVERTFUNC(RGB16,RGBX32) /* Untested */
305 CONVERTFUNC_INIT
307 UWORD *src = (UWORD *)srcPixels;
308 ULONG *dst = (ULONG *)dstPixels;
309 ULONG x, y;
311 for(y = 0; y < height; y++)
313 for(x = 0; x < width; x++)
315 ULONG s = src[x];
317 dst[x] = UPSHIFT16(s, RGB16, RGBA32);
319 src = (UWORD *)(((UBYTE *)src) + srcMod);
320 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
323 return 1;
325 CONVERTFUNC_EXIT
329 CONVERTFUNC(RGB16,XBGR32) /* Untested */
331 CONVERTFUNC_INIT
333 UWORD *src = (UWORD *)srcPixels;
334 ULONG *dst = (ULONG *)dstPixels;
335 ULONG x, y;
337 for(y = 0; y < height; y++)
339 for(x = 0; x < width; x++)
341 ULONG s = src[x];
343 dst[x] = UPSHIFT16(s, RGB16, ABGR32);
345 src = (UWORD *)(((UBYTE *)src) + srcMod);
346 dst = (ULONG *)(((UBYTE *)dst) + dstMod);
349 return 1;
351 CONVERTFUNC_EXIT