VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.0.1/cfb8bit.h@ 68495

Last change on this file since 68495 was 51223, checked in by vboxsync, 11 years ago

Additions/x11/x11include: added header files for X.Org Server 1.0 and 1.1.

  • Property svn:eol-style set to native
File size: 49.8 KB
Line 
1/*
2 * cfb8bit.h
3 *
4 * Defines which are only useful to 8 bit color frame buffers
5 *
6 * That doesn't seem to be true any more. Some of the macros in here
7 * are used for depths other than 8. Perhaps the file should be
8 * renamed. dpw
9 */
10/* $XFree86: xc/programs/Xserver/cfb/cfb8bit.h,v 3.7 2001/12/14 19:59:20 dawes Exp $ */
11
12/*
13
14Copyright 1989, 1998 The Open Group
15
16Permission to use, copy, modify, distribute, and sell this software and its
17documentation for any purpose is hereby granted without fee, provided that
18the above copyright notice appear in all copies and that both that
19copyright notice and this permission notice appear in supporting
20documentation.
21
22The above copyright notice and this permission notice shall be included in
23all copies or substantial portions of the Software.
24
25THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
29AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
32Except as contained in this notice, the name of The Open Group shall not be
33used in advertising or otherwise to promote the sale, use or other dealings
34in this Software without prior written authorization from The Open Group.
35*/
36
37/* $Xorg: cfb8bit.h,v 1.4 2001/02/09 02:04:37 xorgcvs Exp $ */
38
39#ifdef HAVE_DIX_CONFIG_H
40#include <dix-config.h>
41#endif
42
43#include "servermd.h"
44
45#if (BITMAP_BIT_ORDER == MSBFirst)
46#define GetBitGroup(x) (((PixelGroup) (x)) >> (PGSZ - PGSZB))
47#define NextBitGroup(x) ((x) <<= PGSZB)
48#define NextSomeBits(x,n) ((x) <<= (n))
49#else
50#define GetBitGroup(x) ((x) & PGSZBMSK)
51#define NextBitGroup(x) ((x) >>= PGSZB)
52#define NextSomeBits(x,n) ((x) >>= (n))
53#endif
54
55#define RotBitsLeft(x,k) ((x) = BitLeft (x,k) | \
56 BitRight (x, PGSZ-(k)))
57
58#if defined(__GNUC__) && defined(mc68020)
59#undef RotBitsLeft
60#define RotBitsLeft(x,k) asm("rol%.l %2,%0" \
61 : "=d" (x) \
62 : "0" (x), "dI" (k))
63#endif
64
65#if PSZ == 8
66
67#define GetPixelGroup(x) (cfb8StippleXor[GetBitGroup(x)])
68#define RRopPixels(dst,x) (DoRRop(dst,cfb8StippleAnd[x], cfb8StippleXor[x]))
69#define RRopPixelGroup(dst,x) (RRopPixels(dst,GetBitGroup(x)))
70#define MaskRRopPixels(dst,x,mask) (DoMaskRRop(dst,cfb8StippleAnd[x], cfb8StippleXor[x], mask))
71
72#define NUM_MASKS (1<<PPW) /* XXX goes in cfbmskbits.h? */
73extern int cfb8StippleMode, cfb8StippleAlu;
74extern PixelGroup cfb8StippleFg, cfb8StippleBg, cfb8StipplePm;
75extern PixelGroup cfb8StippleMasks[NUM_MASKS];
76extern PixelGroup cfb8StippleAnd[NUM_MASKS], cfb8StippleXor[NUM_MASKS];
77extern int cfb8StippleRRop;
78
79#define cfb8PixelMasks cfb8StippleMasks
80#define cfb8Pixels cfb8StippleXor
81
82#define cfb8CheckPixels(fg, bg) \
83 (FillOpaqueStippled == cfb8StippleMode && \
84 GXcopy == cfb8StippleAlu && \
85 ((fg) & PMSK) == cfb8StippleFg && \
86 ((bg) & PMSK) == cfb8StippleBg && \
87 PMSK == cfb8StipplePm)
88
89#define cfb8CheckOpaqueStipple(alu,fg,bg,pm) \
90 ((FillOpaqueStippled == cfb8StippleMode && \
91 (alu) == cfb8StippleAlu && \
92 ((fg) & PMSK) == cfb8StippleFg && \
93 ((bg) & PMSK) == cfb8StippleBg && \
94 ((pm) & PMSK) == cfb8StipplePm) ? 0 : cfb8SetOpaqueStipple(alu,fg,bg,pm))
95
96#define cfb8CheckStipple(alu,fg,pm) \
97 ((FillStippled == cfb8StippleMode && \
98 (alu) == cfb8StippleAlu && \
99 ((fg) & PMSK) == cfb8StippleFg && \
100 ((pm) & PMSK) == cfb8StipplePm) ? 0 : cfb8SetStipple(alu,fg,pm))
101
102#define cfb8SetPixels(fg,bg) cfb8SetOpaqueStipple(GXcopy,fg,bg,PMSK)
103
104/*
105 * These macros are shared between the unnatural spans code
106 * and the unnatural rectangle code. No reasonable person
107 * would attempt to use them anyplace else.
108 */
109
110#define NextUnnaturalStippleWord \
111 if (bitsLeft >= MFB_PPW) \
112 { \
113 inputBits = *srcTemp++; \
114 bitsLeft -= MFB_PPW; \
115 partBitsLeft = MFB_PPW; \
116 } \
117 else \
118 { \
119 inputBits = 0; \
120 if (bitsLeft) \
121 inputBits = *srcTemp & ~cfb8BitLenMasks[bitsLeft]; \
122 srcTemp = srcStart; \
123 partBitsLeft = bitsLeft; \
124 bitsLeft = bitsWhole; \
125 }
126
127#define NextUnnaturalStippleBits \
128 if (partBitsLeft >= PPW) { \
129 bits = GetBitGroup (inputBits); \
130 NextBitGroup (inputBits); \
131 partBitsLeft -= PPW; \
132 } else { \
133 bits = GetBitGroup (inputBits); \
134 nextPartBits = PPW - partBitsLeft; \
135 NextUnnaturalStippleWord \
136 if (partBitsLeft < nextPartBits) { \
137 if (partBitsLeft) {\
138 bits |= BitRight (GetBitGroup (inputBits), \
139 PPW - nextPartBits) & PPWMSK;\
140 nextPartBits -= partBitsLeft; \
141 } \
142 NextUnnaturalStippleWord \
143 } \
144 bits |= BitRight (GetBitGroup (inputBits), \
145 PPW - nextPartBits) & PPWMSK; \
146 NextSomeBits (inputBits, nextPartBits); \
147 partBitsLeft -= nextPartBits; \
148 }
149
150#define NextUnnaturalStippleBitsFast \
151 if (partBitsLeft >= PPW) { \
152 bits = GetBitGroup(inputBits); \
153 NextBitGroup(inputBits); \
154 partBitsLeft -= PPW; \
155 } else { \
156 bits = GetBitGroup (inputBits); \
157 nextPartBits = PPW - partBitsLeft; \
158 inputBits = *srcTemp++; \
159 bits |= BitRight (GetBitGroup (inputBits), \
160 partBitsLeft) & PPWMSK; \
161 NextSomeBits (inputBits, nextPartBits); \
162 partBitsLeft = MFB_PPW - nextPartBits; \
163 }
164
165/*
166 * WriteBitGroup takes the destination address, a pixel
167 * value (which must be 8 bits duplicated 4 time with PFILL)
168 * and the PPW bits to write, which must be in the low order
169 * bits of the register (probably from GetBitGroup) and writes
170 * the appropriate locations in memory with the pixel value. This
171 * is a copy-mode only operation.
172 */
173
174#define RRopBitGroup(dst,bits) \
175 { \
176 *(dst) = RRopPixels(*(dst),bits); \
177 }
178
179#define MaskRRopBitGroup(dst,bits,mask) \
180 { \
181 *(dst) = MaskRRopPixels(*(dst),bits,mask); \
182 }
183#endif /* PSZ == 8 */
184
185#if !defined(AVOID_MEMORY_READ) && PSZ == 8
186
187#define WriteBitGroup(dst,pixel,bits) \
188 { \
189 register PixelGroup _maskTmp = cfb8PixelMasks[(bits)]; \
190 *(dst) = (*(dst) & ~_maskTmp) | ((pixel) & _maskTmp); \
191 }
192
193#define SwitchBitGroup(dst,pixel,bits) \
194 { \
195 register PixelGroup _maskTmp = cfb8PixelMasks[(bits)]; \
196 register PixelGroup _pixTmp = ((pixel) & _maskTmp); \
197 _maskTmp = ~_maskTmp; \
198 SwitchBitsLoop (*(dst) = (*(dst) & _maskTmp) | _pixTmp;) \
199 }
200
201#else /* AVOID_MEMORY_READ */
202
203#if PGSZ == 32
204#if (BITMAP_BIT_ORDER == MSBFirst)
205#define SinglePixel0 3
206#define SinglePixel1 2
207#define SinglePixel2 1
208#define SinglePixel3 0
209#define SinglePixel4 7
210#define SinglePixel5 6
211#define SinglePixel6 5
212#define SinglePixel7 4
213#define SinglePixel8 0xB
214#define SinglePixel9 0xA
215#define DoublePixel0 1
216#define DoublePixel1 0
217#define DoublePixel2 3
218#define DoublePixel3 2
219#define DoublePixel4 5
220#define DoublePixel5 4
221#else
222#define SinglePixel0 0
223#define SinglePixel1 1
224#define SinglePixel2 2
225#define SinglePixel3 3
226#define SinglePixel4 4
227#define SinglePixel5 5
228#define SinglePixel6 6
229#define SinglePixel7 7
230#define SinglePixel8 8
231#define SinglePixel9 9
232#define DoublePixel0 0
233#define DoublePixel1 1
234#define DoublePixel2 2
235#define DoublePixel3 3
236#define DoublePixel4 4
237#define DoublePixel5 5
238#endif
239#define QuadPixel0 0
240#define QuadPixel1 1
241#define QuadPixel2 2
242#else /* PGSZ == 64 */
243#if (BITMAP_BIT_ORDER == MSBFirst)
244#define SinglePixel0 7
245#define SinglePixel1 6
246#define SinglePixel2 5
247#define SinglePixel3 4
248#define SinglePixel4 3
249#define SinglePixel5 2
250#define SinglePixel6 1
251#define SinglePixel7 0
252#define DoublePixel0 3
253#define DoublePixel1 2
254#define DoublePixel2 1
255#define DoublePixel3 0
256#define QuadPixel0 1
257#define QuadPixel1 0
258#else
259#define SinglePixel0 0
260#define SinglePixel1 1
261#define SinglePixel2 2
262#define SinglePixel3 3
263#define SinglePixel4 4
264#define SinglePixel5 5
265#define SinglePixel6 6
266#define SinglePixel7 7
267#define DoublePixel0 0
268#define DoublePixel1 1
269#define DoublePixel2 2
270#define DoublePixel3 3
271#define QuadPixel0 0
272#define QuadPixel1 1
273#endif
274#define OctaPixel0 0
275#endif /* PGSZ == 64 */
276
277#if PSZ == 8
278
279#if PGSZ == 32
280#define WriteBitGroup(dst,pixel,bits) \
281 switch (bits) { \
282 case 0: \
283 break; \
284 case 1: \
285 ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
286 break; \
287 case 2: \
288 ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
289 break; \
290 case 3: \
291 ((CARD16 *) (dst))[DoublePixel0] = (pixel); \
292 break; \
293 case 4: \
294 ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
295 break; \
296 case 5: \
297 ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
298 ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
299 break; \
300 case 6: \
301 ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
302 ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
303 break; \
304 case 7: \
305 ((CARD16 *) (dst))[DoublePixel0] = (pixel); \
306 ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
307 break; \
308 case 8: \
309 ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
310 break; \
311 case 9: \
312 ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
313 ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
314 break; \
315 case 10: \
316 ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
317 ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
318 break; \
319 case 11: \
320 ((CARD16 *) (dst))[DoublePixel0] = (pixel); \
321 ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
322 break; \
323 case 12: \
324 ((CARD16 *) (dst))[DoublePixel1] = (pixel); \
325 break; \
326 case 13: \
327 ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
328 ((CARD16 *) (dst))[DoublePixel1] = (pixel); \
329 break; \
330 case 14: \
331 ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
332 ((CARD16 *) (dst))[DoublePixel1] = (pixel); \
333 break; \
334 case 15: \
335 ((CARD32 *) (dst))[0] = (pixel); \
336 break; \
337 }
338#else /* PGSZ == 64 */
339#define WriteBitGroup(dst,pixel,bits) \
340 if ( bits == 0xff ) \
341 ((PixelGroup *) (dst))[OctaPixel0] = (pixel); \
342 else { \
343 switch (bits & 0x0f) { \
344 case 0: \
345 break; \
346 case 1: \
347 ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
348 break; \
349 case 2: \
350 ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
351 break; \
352 case 3: \
353 ((CARD16 *) (dst))[DoublePixel0] = (pixel); \
354 break; \
355 case 4: \
356 ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
357 break; \
358 case 5: \
359 ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
360 ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
361 break; \
362 case 6: \
363 ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
364 ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
365 break; \
366 case 7: \
367 ((CARD16 *) (dst))[DoublePixel0] = (pixel); \
368 ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
369 break; \
370 case 8: \
371 ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
372 break; \
373 case 9: \
374 ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
375 ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
376 break; \
377 case 10: \
378 ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
379 ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
380 break; \
381 case 11: \
382 ((CARD16 *) (dst))[DoublePixel0] = (pixel); \
383 ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
384 break; \
385 case 12: \
386 ((CARD16 *) (dst))[DoublePixel1] = (pixel); \
387 break; \
388 case 13: \
389 ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
390 ((CARD16 *) (dst))[DoublePixel1] = (pixel); \
391 break; \
392 case 14: \
393 ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
394 ((CARD16 *) (dst))[DoublePixel1] = (pixel); \
395 break; \
396 case 15: \
397 ((CARD32 *) (dst))[QuadPixel0] = (pixel); \
398 break; \
399 } \
400 switch ((bits & 0xf0) >> 4) { \
401 case 0: \
402 break; \
403 case 1: \
404 ((CARD8 *) (dst))[SinglePixel4] = (pixel); \
405 break; \
406 case 2: \
407 ((CARD8 *) (dst))[SinglePixel5] = (pixel); \
408 break; \
409 case 3: \
410 ((CARD16 *) (dst))[DoublePixel2] = (pixel); \
411 break; \
412 case 4: \
413 ((CARD8 *) (dst))[SinglePixel6] = (pixel); \
414 break; \
415 case 5: \
416 ((CARD8 *) (dst))[SinglePixel4] = (pixel); \
417 ((CARD8 *) (dst))[SinglePixel6] = (pixel); \
418 break; \
419 case 6: \
420 ((CARD8 *) (dst))[SinglePixel5] = (pixel); \
421 ((CARD8 *) (dst))[SinglePixel6] = (pixel); \
422 break; \
423 case 7: \
424 ((CARD16 *) (dst))[DoublePixel2] = (pixel); \
425 ((CARD8 *) (dst))[SinglePixel6] = (pixel); \
426 break; \
427 case 8: \
428 ((CARD8 *) (dst))[SinglePixel7] = (pixel); \
429 break; \
430 case 9: \
431 ((CARD8 *) (dst))[SinglePixel4] = (pixel); \
432 ((CARD8 *) (dst))[SinglePixel7] = (pixel); \
433 break; \
434 case 10: \
435 ((CARD8 *) (dst))[SinglePixel5] = (pixel); \
436 ((CARD8 *) (dst))[SinglePixel7] = (pixel); \
437 break; \
438 case 11: \
439 ((CARD16 *) (dst))[DoublePixel2] = (pixel); \
440 ((CARD8 *) (dst))[SinglePixel7] = (pixel); \
441 break; \
442 case 12: \
443 ((CARD16 *) (dst))[DoublePixel3] = (pixel); \
444 break; \
445 case 13: \
446 ((CARD8 *) (dst))[SinglePixel4] = (pixel); \
447 ((CARD16 *) (dst))[DoublePixel3] = (pixel); \
448 break; \
449 case 14: \
450 ((CARD8 *) (dst))[SinglePixel5] = (pixel); \
451 ((CARD16 *) (dst))[DoublePixel3] = (pixel); \
452 break; \
453 case 15: \
454 ((CARD32 *) (dst))[QuadPixel1] = (pixel); \
455 break; \
456 } \
457 }
458#endif /* PGSZ == 64 */
459
460#if PGSZ == 32
461#define SwitchBitGroup(dst,pixel,bits) { \
462 switch (bits) { \
463 case 0: \
464 break; \
465 case 1: \
466 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel);) \
467 break; \
468 case 2: \
469 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel);) \
470 break; \
471 case 3: \
472 SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel);) \
473 break; \
474 case 4: \
475 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
476 break; \
477 case 5: \
478 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \
479 ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
480 break; \
481 case 6: \
482 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \
483 ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
484 break; \
485 case 7: \
486 SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
487 ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
488 break; \
489 case 8: \
490 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
491 break; \
492 case 9: \
493 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \
494 ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
495 break; \
496 case 10: \
497 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \
498 ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
499 break; \
500 case 11: \
501 SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
502 ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
503 break; \
504 case 12: \
505 SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel1] = (pixel);) \
506 break; \
507 case 13: \
508 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \
509 ((CARD16 *) (dst))[DoublePixel1] = (pixel);) \
510 break; \
511 case 14: \
512 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \
513 ((CARD16 *) (dst))[DoublePixel1] = (pixel);) \
514 break; \
515 case 15: \
516 SwitchBitsLoop (((CARD32 *) (dst))[0] = (pixel);) \
517 break; \
518 } \
519}
520#else /* PGSZ == 64 */
521#define SwitchBitGroup(dst,pixel,bits) { \
522 if ( bits == 0xff ) \
523 SwitchBitsLoop (((PixelGroup *) (dst))[OctaPixel0] = (pixel);) \
524 else { \
525 switch (bits & 0x0f) { \
526 case 0: \
527 break; \
528 case 1: \
529 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel);) \
530 break; \
531 case 2: \
532 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel);) \
533 break; \
534 case 3: \
535 SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel);)\
536 break; \
537 case 4: \
538 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
539 break; \
540 case 5: \
541 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \
542 ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
543 break; \
544 case 6: \
545 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \
546 ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
547 break; \
548 case 7: \
549 SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
550 ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
551 break; \
552 case 8: \
553 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
554 break; \
555 case 9: \
556 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \
557 ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
558 break; \
559 case 10: \
560 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \
561 ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
562 break; \
563 case 11: \
564 SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
565 ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
566 break; \
567 case 12: \
568 SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel1] = (pixel);)\
569 break; \
570 case 13: \
571 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \
572 ((CARD16 *) (dst))[DoublePixel1] = (pixel);)\
573 break; \
574 case 14: \
575 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \
576 ((CARD16 *) (dst))[DoublePixel1] = (pixel);)\
577 break; \
578 case 15: \
579 SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel);) \
580 break; \
581 } \
582 switch ((bits & 0xf0) >> 4) { \
583 case 0: \
584 break; \
585 case 1: \
586 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel);) \
587 break; \
588 case 2: \
589 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel);) \
590 break; \
591 case 3: \
592 SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel2] = (pixel);)\
593 break; \
594 case 4: \
595 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel6] = (pixel);) \
596 break; \
597 case 5: \
598 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel); \
599 ((CARD8 *) (dst))[SinglePixel6] = (pixel);) \
600 break; \
601 case 6: \
602 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel); \
603 ((CARD8 *) (dst))[SinglePixel6] = (pixel);) \
604 break; \
605 case 7: \
606 SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel2] = (pixel); \
607 ((CARD8 *) (dst))[SinglePixel6] = (pixel);) \
608 break; \
609 case 8: \
610 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel7] = (pixel);) \
611 break; \
612 case 9: \
613 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel); \
614 ((CARD8 *) (dst))[SinglePixel7] = (pixel);) \
615 break; \
616 case 10: \
617 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel); \
618 ((CARD8 *) (dst))[SinglePixel7] = (pixel);) \
619 break; \
620 case 11: \
621 SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel2] = (pixel); \
622 ((CARD8 *) (dst))[SinglePixel7] = (pixel);) \
623 break; \
624 case 12: \
625 SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel3] = (pixel);)\
626 break; \
627 case 13: \
628 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel); \
629 ((CARD16 *) (dst))[DoublePixel3] = (pixel);)\
630 break; \
631 case 14: \
632 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel); \
633 ((CARD16 *) (dst))[DoublePixel3] = (pixel);)\
634 break; \
635 case 15: \
636 SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel1] = (pixel);) \
637 break; \
638 } \
639 } \
640}
641#endif /* PGSZ == 64 */
642#endif /* PSZ == 8 */
643
644#if PSZ == 16
645
646#if PGSZ == 32
647#define WriteBitGroup(dst,pixel,bits) \
648 switch (bits) { \
649 case 0: \
650 break; \
651 case 1: \
652 ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
653 break; \
654 case 2: \
655 ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
656 break; \
657 case 3: \
658 ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
659 break; \
660 case 4: \
661 ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
662 break; \
663 case 5: \
664 ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
665 ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
666 break; \
667 case 6: \
668 ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
669 ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
670 break; \
671 case 7: \
672 ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
673 ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
674 break; \
675 case 8: \
676 ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
677 break; \
678 case 9: \
679 ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
680 ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
681 break; \
682 case 10: \
683 ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
684 ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
685 break; \
686 case 11: \
687 ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
688 ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
689 break; \
690 case 12: \
691 ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
692 break; \
693 case 13: \
694 ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
695 ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
696 break; \
697 case 14: \
698 ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
699 ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
700 break; \
701 case 15: \
702 ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
703 ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
704 break; \
705 }
706#else /* PGSZ == 64 */
707#define WriteBitGroup(dst,pixel,bits) \
708 if ( bits == 0xff ) { \
709 ((PixelGroup *) (dst))[QuadPixel0] = (pixel); \
710 ((PixelGroup *) (dst))[QuadPixel1] = (pixel); \
711 } \
712 else { \
713 switch (bits & 0x0f) { \
714 case 0: \
715 break; \
716 case 1: \
717 ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
718 break; \
719 case 2: \
720 ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
721 break; \
722 case 3: \
723 ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
724 break; \
725 case 4: \
726 ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
727 break; \
728 case 5: \
729 ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
730 ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
731 break; \
732 case 6: \
733 ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
734 ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
735 break; \
736 case 7: \
737 ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
738 ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
739 break; \
740 case 8: \
741 ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
742 break; \
743 case 9: \
744 ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
745 ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
746 break; \
747 case 10: \
748 ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
749 ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
750 break; \
751 case 11: \
752 ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
753 ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
754 break; \
755 case 12: \
756 ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
757 break; \
758 case 13: \
759 ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
760 ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
761 break; \
762 case 14: \
763 ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
764 ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
765 break; \
766 case 15: \
767 ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
768 ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
769 break; \
770 } \
771 switch ((bits & 0xf0) >> 4) { \
772 case 0: \
773 break; \
774 case 1: \
775 ((CARD16 *) (dst))[SinglePixel4] = (pixel); \
776 break; \
777 case 2: \
778 ((CARD16 *) (dst))[SinglePixel5] = (pixel); \
779 break; \
780 case 3: \
781 ((CARD32 *) (dst))[DoublePixel2] = (pixel); \
782 break; \
783 case 4: \
784 ((CARD16 *) (dst))[SinglePixel6] = (pixel); \
785 break; \
786 case 5: \
787 ((CARD16 *) (dst))[SinglePixel4] = (pixel); \
788 ((CARD16 *) (dst))[SinglePixel6] = (pixel); \
789 break; \
790 case 6: \
791 ((CARD16 *) (dst))[SinglePixel5] = (pixel); \
792 ((CARD16 *) (dst))[SinglePixel6] = (pixel); \
793 break; \
794 case 7: \
795 ((CARD32 *) (dst))[DoublePixel2] = (pixel); \
796 ((CARD16 *) (dst))[SinglePixel6] = (pixel); \
797 break; \
798 case 8: \
799 ((CARD16 *) (dst))[SinglePixel7] = (pixel); \
800 break; \
801 case 9: \
802 ((CARD16 *) (dst))[SinglePixel4] = (pixel); \
803 ((CARD16 *) (dst))[SinglePixel7] = (pixel); \
804 break; \
805 case 10: \
806 ((CARD16 *) (dst))[SinglePixel5] = (pixel); \
807 ((CARD16 *) (dst))[SinglePixel7] = (pixel); \
808 break; \
809 case 11: \
810 ((CARD32 *) (dst))[DoublePixel2] = (pixel); \
811 ((CARD16 *) (dst))[SinglePixel7] = (pixel); \
812 break; \
813 case 12: \
814 ((CARD32 *) (dst))[DoublePixel3] = (pixel); \
815 break; \
816 case 13: \
817 ((CARD16 *) (dst))[SinglePixel4] = (pixel); \
818 ((CARD32 *) (dst))[DoublePixel3] = (pixel); \
819 break; \
820 case 14: \
821 ((CARD16 *) (dst))[SinglePixel5] = (pixel); \
822 ((CARD32 *) (dst))[DoublePixel3] = (pixel); \
823 break; \
824 case 15: \
825 ((CARD32 *) (dst))[DoublePixel2] = (pixel); \
826 ((CARD32 *) (dst))[DoublePixel3] = (pixel); \
827 break; \
828 } \
829 }
830#endif /* PGSZ */
831
832#if PGSZ == 32
833#define SwitchBitGroup(dst,pixel,bits) { \
834 switch (bits) { \
835 case 0: \
836 break; \
837 case 1: \
838 SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel);) \
839 break; \
840 case 2: \
841 SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel);) \
842 break; \
843 case 3: \
844 SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel);) \
845 break; \
846 case 4: \
847 SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel2] = (pixel);) \
848 break; \
849 case 5: \
850 SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \
851 ((CARD16 *) (dst))[SinglePixel2] = (pixel);) \
852 break; \
853 case 6: \
854 SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel); \
855 ((CARD16 *) (dst))[SinglePixel2] = (pixel);) \
856 break; \
857 case 7: \
858 SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel); \
859 ((CARD16 *) (dst))[SinglePixel2] = (pixel);) \
860 break; \
861 case 8: \
862 SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel3] = (pixel);) \
863 break; \
864 case 9: \
865 SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \
866 ((CARD16 *) (dst))[SinglePixel3] = (pixel);) \
867 break; \
868 case 10: \
869 SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel); \
870 ((CARD16 *) (dst))[SinglePixel3] = (pixel);) \
871 break; \
872 case 11: \
873 SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel); \
874 ((CARD16 *) (dst))[SinglePixel3] = (pixel);) \
875 break; \
876 case 12: \
877 SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel1] = (pixel);) \
878 break; \
879 case 13: \
880 SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \
881 ((CARD32 *) (dst))[DoublePixel1] = (pixel);) \
882 break; \
883 case 14: \
884 SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel); \
885 ((CARD32 *) (dst))[DoublePixel1] = (pixel);) \
886 break; \
887 case 15: \
888 SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel); \
889 ((CARD32 *) (dst))[DoublePixel1] = (pixel);) \
890 break; \
891 } \
892}
893#else /* PGSZ == 64 */
894#define SwitchBitGroup(dst,pixel,bits) { \
895 cfb cannot hack 64-bit SwitchBitGroup psz=PSZ
896#endif /* PGSZ */
897
898#endif /* PSZ == 16 */
899
900#if PSZ == 24
901/* 32 000011112222*/
902/* 24 000111222333*/
903/* 16 001122334455*/
904/* 8 0123456789AB*/
905#if PGSZ == 32
906#define WriteBitGroup(dst,pixel,bits) \
907 { \
908 register CARD32 reg_pixel = (pixel); \
909 switch (bits) { \
910 case 0: \
911 break; \
912 case 1: \
913 ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \
914 ((CARD8 *) (dst))[SinglePixel2] = ((reg_pixel>>16)&0xFF); \
915 break; \
916 case 2: \
917 ((CARD8 *) (dst))[SinglePixel3] = reg_pixel&0xFF; \
918 ((CARD16 *) (dst))[DoublePixel2] = (reg_pixel>>8)&0xFFFF; \
919 break; \
920 case 3: \
921 ((CARD8 *) (dst))[SinglePixel3] = reg_pixel & 0xFF; \
922 ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \
923 ((CARD16 *) (dst))[DoublePixel2] = (reg_pixel>>8)&0xFFFF; \
924 ((CARD8 *) (dst))[SinglePixel2] = (reg_pixel>>16&0xFF); \
925 break; \
926 case 4: \
927 ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
928 ((CARD8 *) (dst))[SinglePixel8] = (reg_pixel>>16)&0xFF; \
929 break; \
930 case 5: \
931 ((CARD16 *) (dst))[DoublePixel0] = \
932 ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
933 reg_pixel >>= 16; \
934 ((CARD8 *) (dst))[SinglePixel2] = \
935 ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \
936 break; \
937 case 6: \
938 ((CARD8 *) (dst))[SinglePixel3] = reg_pixel; \
939 ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
940 reg_pixel >>= 8; \
941 ((CARD16 *) (dst))[DoublePixel2] = reg_pixel; \
942 reg_pixel >>= 8; \
943 ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \
944 break; \
945 case 7: \
946 ((CARD16 *) (dst))[DoublePixel0] = \
947 ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
948 ((CARD8 *) (dst))[SinglePixel3] = reg_pixel&0xFF; \
949 reg_pixel >>= 8; \
950 ((CARD16 *) (dst))[DoublePixel2] = reg_pixel; \
951 reg_pixel >>= 8; \
952 ((CARD8 *) (dst))[SinglePixel2] = \
953 ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \
954 break; \
955 case 8: \
956 ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \
957 ((CARD16 *) (dst))[DoublePixel5] = (reg_pixel>>8); \
958 break; \
959 case 9: \
960 ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \
961 ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \
962 reg_pixel >>= 8; \
963 ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
964 reg_pixel >>= 8; \
965 ((CARD8 *) (dst))[SinglePixel2] = reg_pixel&0xFF; \
966 break; \
967 case 10: \
968 ((CARD8 *) (dst))[SinglePixel3] = \
969 ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \
970 reg_pixel >>= 8; \
971 ((CARD16 *) (dst))[DoublePixel2] = \
972 ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
973 break; \
974 case 11: \
975 ((CARD8 *) (dst))[SinglePixel3] = \
976 ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
977 ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \
978 reg_pixel >>= 8; \
979 ((CARD16 *) (dst))[DoublePixel2] = \
980 ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
981 reg_pixel >>= 8; \
982 ((CARD8 *) (dst))[SinglePixel2] = reg_pixel; \
983 break; \
984 case 12: \
985 ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
986 ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
987 reg_pixel >>= 8; \
988 ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
989 reg_pixel >>= 8; \
990 ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \
991 break; \
992 case 13: \
993 ((CARD16 *) (dst))[DoublePixel0] = \
994 ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
995 ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
996 reg_pixel >>= 8; \
997 ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
998 reg_pixel >>= 8; \
999 ((CARD8 *) (dst))[SinglePixel2] = \
1000 ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \
1001 break; \
1002 case 14: \
1003 ((CARD8 *) (dst))[SinglePixel3] = \
1004 ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
1005 ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
1006 reg_pixel >>= 8; \
1007 ((CARD16 *) (dst))[DoublePixel2] = \
1008 ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
1009 reg_pixel >>= 8; \
1010 ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \
1011 break; \
1012 case 15: \
1013 ((CARD16 *) (dst))[DoublePixel0] = \
1014 ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
1015 ((CARD8 *) (dst))[SinglePixel3] = \
1016 ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
1017 reg_pixel >>= 8; \
1018 ((CARD16 *) (dst))[DoublePixel2] = \
1019 ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
1020 reg_pixel >>= 8; \
1021 ((CARD8 *) (dst))[SinglePixel8] = \
1022 ((CARD8 *) (dst))[SinglePixel2] = reg_pixel; \
1023 break; \
1024 } \
1025 }
1026#else /* PGSZ == 64 */
1027#define WriteBitGroup(dst,pixel,bits) \
1028 if ( bits == 0xff ) { \
1029 ((PixelGroup *) (dst))[DoublePixel0] = (pixel); \
1030 ((PixelGroup *) (dst))[DoublePixel1] = (pixel); \
1031 ((PixelGroup *) (dst))[DoublePixel2] = (pixel); \
1032 ((PixelGroup *) (dst))[DoublePixel3] = (pixel); \
1033 } \
1034 else { \
1035 switch (bits & 0x0f) { \
1036 case 0: \
1037 break; \
1038 case 1: \
1039 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1040 break; \
1041 case 2: \
1042 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1043 break; \
1044 case 3: \
1045 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1046 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1047 break; \
1048 case 4: \
1049 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1050 break; \
1051 case 5: \
1052 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1053 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1054 break; \
1055 case 6: \
1056 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1057 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1058 break; \
1059 case 7: \
1060 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1061 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1062 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1063 break; \
1064 case 8: \
1065 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1066 break; \
1067 case 9: \
1068 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1069 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1070 break; \
1071 case 10: \
1072 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1073 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1074 break; \
1075 case 11: \
1076 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1077 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1078 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1079 break; \
1080 case 12: \
1081 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1082 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1083 break; \
1084 case 13: \
1085 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1086 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1087 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1088 break; \
1089 case 14: \
1090 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1091 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1092 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1093 break; \
1094 case 15: \
1095 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1096 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1097 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1098 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1099 break; \
1100 } \
1101 switch ((bits & 0xf0) >> 4) { \
1102 case 0: \
1103 break; \
1104 case 1: \
1105 ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
1106 break; \
1107 case 2: \
1108 ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
1109 break; \
1110 case 3: \
1111 ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
1112 ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
1113 break; \
1114 case 4: \
1115 ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
1116 break; \
1117 case 5: \
1118 ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
1119 ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
1120 break; \
1121 case 6: \
1122 ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
1123 ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
1124 break; \
1125 case 7: \
1126 ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
1127 ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
1128 ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
1129 break; \
1130 case 8: \
1131 ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
1132 break; \
1133 case 9: \
1134 ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
1135 ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
1136 break; \
1137 case 10: \
1138 ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
1139 ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
1140 break; \
1141 case 11: \
1142 ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
1143 ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
1144 ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
1145 break; \
1146 case 12: \
1147 ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
1148 ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
1149 break; \
1150 case 13: \
1151 ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
1152 ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
1153 ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
1154 break; \
1155 case 14: \
1156 ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
1157 ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
1158 ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
1159 break; \
1160 case 15: \
1161 ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
1162 ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
1163 ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
1164 ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
1165 break; \
1166 } \
1167 }
1168#endif /* PGSZ */
1169
1170#if PGSZ == 32
1171#define SwitchBitGroup(dst,pixel,bits) { \
1172 switch (bits) { \
1173 case 0: \
1174 break; \
1175 case 1: \
1176 SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
1177 ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
1178 break; \
1179 case 2: \
1180 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \
1181 ((CARD16 *) (dst))[DoublePixel2] = (pixel);) \
1182 break; \
1183 case 3: \
1184 SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \
1185 ((CARD16 *) (dst))[DoublePixel2] = (pixel);) \
1186 break; \
1187 case 4: \
1188 SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel3] = (pixel); \
1189 ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \
1190 break; \
1191 case 5: \
1192 SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
1193 ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
1194 ((CARD16 *) (dst))[DoublePixel3] = (pixel); \
1195 ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \
1196 break; \
1197 case 6: \
1198 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \
1199 ((CARD32 *) (dst))[QuadPixel2] = (pixel); \
1200 ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \
1201 break; \
1202 case 7: \
1203 SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \
1204 ((CARD32 *) (dst))[QuadPixel1] = (pixel); \
1205 ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \
1206 break; \
1207 case 8: \
1208 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel9] = (pixel); \
1209 ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \
1210 break; \
1211 case 9: \
1212 SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
1213 ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
1214 ((CARD8 *) (dst))[SinglePixel9] = (pixel); \
1215 ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \
1216 break; \
1217 case 10: \
1218 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \
1219 ((CARD16 *) (dst))[DoublePixel2] = (pixel); \
1220 ((CARD8 *) (dst))[SinglePixel9] = (pixel); \
1221 ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \
1222 break; \
1223 case 11: \
1224 SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \
1225 ((CARD16 *) (dst))[DoublePixel3] = (pixel);) \
1226 ((CARD8 *) (dst))[SinglePixel9] = (pixel); \
1227 ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \
1228 break; \
1229 case 12: \
1230 SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel3] = (pixel); \
1231 ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \
1232 break; \
1233 case 13: \
1234 SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \
1235 ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
1236 ((CARD16 *) (dst))[DoublePixel3] = (pixel); \
1237 ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \
1238 break; \
1239 case 14: \
1240 SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \
1241 ((CARD32 *) (dst))[QuadPixel1] = (pixel); \
1242 ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \
1243 break; \
1244 case 15: \
1245 SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \
1246 ((CARD32 *) (dst))[QuadPixel1] = (pixel); \
1247 ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \
1248 break; \
1249 } \
1250}
1251#else /* PGSZ == 64 */
1252#define SwitchBitGroup(dst,pixel,bits) { \
1253 cfb cannot hack 64-bit SwitchBitGroup psz=PSZ
1254#endif /* PGSZ */
1255
1256#endif /* PSZ == 24 */
1257
1258#if PSZ == 32
1259
1260#if PGSZ == 32
1261#define WriteBitGroup(dst,pixel,bits) \
1262 switch (bits) { \
1263 case 0: \
1264 break; \
1265 case 1: \
1266 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1267 break; \
1268 case 2: \
1269 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1270 break; \
1271 case 3: \
1272 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1273 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1274 break; \
1275 case 4: \
1276 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1277 break; \
1278 case 5: \
1279 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1280 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1281 break; \
1282 case 6: \
1283 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1284 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1285 break; \
1286 case 7: \
1287 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1288 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1289 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1290 break; \
1291 case 8: \
1292 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1293 break; \
1294 case 9: \
1295 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1296 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1297 break; \
1298 case 10: \
1299 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1300 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1301 break; \
1302 case 11: \
1303 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1304 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1305 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1306 break; \
1307 case 12: \
1308 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1309 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1310 break; \
1311 case 13: \
1312 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1313 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1314 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1315 break; \
1316 case 14: \
1317 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1318 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1319 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1320 break; \
1321 case 15: \
1322 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1323 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1324 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1325 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1326 break; \
1327 }
1328#else /* PGSZ == 64 */
1329#define WriteBitGroup(dst,pixel,bits) \
1330 if ( bits == 0xff ) { \
1331 ((PixelGroup *) (dst))[DoublePixel0] = (pixel); \
1332 ((PixelGroup *) (dst))[DoublePixel1] = (pixel); \
1333 ((PixelGroup *) (dst))[DoublePixel2] = (pixel); \
1334 ((PixelGroup *) (dst))[DoublePixel3] = (pixel); \
1335 } \
1336 else { \
1337 switch (bits & 0x0f) { \
1338 case 0: \
1339 break; \
1340 case 1: \
1341 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1342 break; \
1343 case 2: \
1344 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1345 break; \
1346 case 3: \
1347 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1348 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1349 break; \
1350 case 4: \
1351 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1352 break; \
1353 case 5: \
1354 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1355 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1356 break; \
1357 case 6: \
1358 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1359 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1360 break; \
1361 case 7: \
1362 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1363 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1364 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1365 break; \
1366 case 8: \
1367 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1368 break; \
1369 case 9: \
1370 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1371 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1372 break; \
1373 case 10: \
1374 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1375 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1376 break; \
1377 case 11: \
1378 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1379 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1380 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1381 break; \
1382 case 12: \
1383 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1384 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1385 break; \
1386 case 13: \
1387 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1388 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1389 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1390 break; \
1391 case 14: \
1392 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1393 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1394 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1395 break; \
1396 case 15: \
1397 ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1398 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1399 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1400 ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
1401 break; \
1402 } \
1403 switch ((bits & 0xf0) >> 4) { \
1404 case 0: \
1405 break; \
1406 case 1: \
1407 ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
1408 break; \
1409 case 2: \
1410 ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
1411 break; \
1412 case 3: \
1413 ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
1414 ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
1415 break; \
1416 case 4: \
1417 ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
1418 break; \
1419 case 5: \
1420 ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
1421 ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
1422 break; \
1423 case 6: \
1424 ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
1425 ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
1426 break; \
1427 case 7: \
1428 ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
1429 ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
1430 ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
1431 break; \
1432 case 8: \
1433 ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
1434 break; \
1435 case 9: \
1436 ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
1437 ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
1438 break; \
1439 case 10: \
1440 ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
1441 ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
1442 break; \
1443 case 11: \
1444 ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
1445 ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
1446 ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
1447 break; \
1448 case 12: \
1449 ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
1450 ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
1451 break; \
1452 case 13: \
1453 ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
1454 ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
1455 ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
1456 break; \
1457 case 14: \
1458 ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
1459 ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
1460 ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
1461 break; \
1462 case 15: \
1463 ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
1464 ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
1465 ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
1466 ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
1467 break; \
1468 } \
1469 }
1470#endif /* PGSZ */
1471
1472#if PGSZ == 32
1473#define SwitchBitGroup(dst,pixel,bits) { \
1474 switch (bits) { \
1475 case 0: \
1476 break; \
1477 case 1: \
1478 SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel);) \
1479 break; \
1480 case 2: \
1481 SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel);) \
1482 break; \
1483 case 3: \
1484 SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1485 ((CARD32 *) (dst))[SinglePixel1] = (pixel);) \
1486 break; \
1487 case 4: \
1488 SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel2] = (pixel);) \
1489 break; \
1490 case 5: \
1491 SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1492 ((CARD32 *) (dst))[SinglePixel2] = (pixel);) \
1493 break; \
1494 case 6: \
1495 SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1496 ((CARD32 *) (dst))[SinglePixel2] = (pixel);) \
1497 break; \
1498 case 7: \
1499 SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1500 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1501 ((CARD32 *) (dst))[SinglePixel2] = (pixel);) \
1502 break; \
1503 case 8: \
1504 SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
1505 break; \
1506 case 9: \
1507 SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1508 ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
1509 break; \
1510 case 10: \
1511 SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1512 ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
1513 break; \
1514 case 11: \
1515 SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1516 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1517 ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
1518 break; \
1519 case 12: \
1520 SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1521 ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
1522 break; \
1523 case 13: \
1524 SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1525 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1526 ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
1527 break; \
1528 case 14: \
1529 SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1530 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1531 ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
1532 break; \
1533 case 15: \
1534 SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
1535 ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
1536 ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
1537 ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
1538 break; \
1539 } \
1540}
1541#else /* PGSZ == 64 */
1542#define SwitchBitGroup(dst,pixel,bits) { \
1543 cfb cannot hack 64-bit SwitchBitGroup psz=PSZ
1544#endif /* PGSZ */
1545
1546#endif /* PSZ == 32 */
1547#endif /* AVOID_MEMORY_READ */
1548
1549extern PixelGroup cfb8BitLenMasks[PGSZ];
1550
1551extern int cfb8SetStipple (
1552 int /*alu*/,
1553 CfbBits /*fg*/,
1554 CfbBits /*planemask*/
1555);
1556
1557extern int cfb8SetOpaqueStipple (
1558 int /*alu*/,
1559 CfbBits /*fg*/,
1560 CfbBits /*bg*/,
1561 CfbBits /*planemask*/
1562);
1563
1564extern int cfb8ComputeClipMasks32 (
1565 BoxPtr /*pBox*/,
1566 int /*numRects*/,
1567 int /*x*/,
1568 int /*y*/,
1569 int /*w*/,
1570 int /*h*/,
1571 CARD32 * /*clips*/
1572);
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette