VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/1.4/xorg/afb.h@ 6202

Last change on this file since 6202 was 6202, checked in by vboxsync, 17 years ago

re-export x11

  • Property svn:eol-style set to native
File size: 22.8 KB
Line 
1/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
2/***********************************************************
3
4Copyright (c) 1987 X Consortium
5
6Permission is hereby granted, free of charge, to any person obtaining a copy
7of this software and associated documentation files (the "Software"), to deal
8in the Software without restriction, including without limitation the rights
9to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10copies of the Software, and to permit persons to whom the Software is
11furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23Except as contained in this notice, the name of the X Consortium shall not be
24used in advertising or otherwise to promote the sale, use or other dealings
25in this Software without prior written authorization from the X Consortium.
26
27
28Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
29
30 All Rights Reserved
31
32Permission to use, copy, modify, and distribute this software and its
33documentation for any purpose and without fee is hereby granted,
34provided that the above copyright notice appear in all copies and that
35both that copyright notice and this permission notice appear in
36supporting documentation, and that the name of Digital not be
37used in advertising or publicity pertaining to distribution of the
38software without specific, written prior permission.
39
40DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
41ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
42DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
43ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
44WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
45ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
46SOFTWARE.
47
48******************************************************************/
49/* Monochrome Frame Buffer definitions
50 written by drewry, september 1986
51*/
52
53#include "pixmap.h"
54#include "region.h"
55#include "gc.h"
56#include "colormap.h"
57#include "regionstr.h"
58#include "mibstore.h"
59#include "mfb.h"
60
61extern int afbInverseAlu[];
62extern int afbScreenPrivateIndex;
63/* warning: PixelType definition duplicated in maskbits.h */
64#ifndef PixelType
65#define PixelType CARD32
66#endif /* PixelType */
67
68#define AFB_MAX_DEPTH 8
69
70/* afbbitblt.c */
71
72extern void afbDoBitblt(
73 DrawablePtr /*pSrc*/,
74 DrawablePtr /*pDst*/,
75 int /*alu*/,
76 RegionPtr /*prgnDst*/,
77 DDXPointPtr /*pptSrc*/,
78 unsigned long /*planemask*/
79);
80
81extern RegionPtr afbCopyArea(
82 DrawablePtr /*pSrcDrawable*/,
83 DrawablePtr /*pDstDrawable*/,
84 GCPtr/*pGC*/,
85 int /*srcx*/,
86 int /*srcy*/,
87 int /*width*/,
88 int /*height*/,
89 int /*dstx*/,
90 int /*dsty*/
91);
92
93/* afbbltC.c */
94
95extern void afbDoBitbltCopy(
96 DrawablePtr /*pSrc*/,
97 DrawablePtr /*pDst*/,
98 int /*alu*/,
99 RegionPtr /*prgnDst*/,
100 DDXPointPtr /*pptSrc*/,
101 unsigned long /*planemask*/
102);
103/* afbbltCI.c */
104
105extern void afbDoBitbltCopyInverted(
106 DrawablePtr /*pSrc*/,
107 DrawablePtr /*pDst*/,
108 int /*alu*/,
109 RegionPtr /*prgnDst*/,
110 DDXPointPtr /*pptSrc*/,
111 unsigned long /*planemask*/
112);
113/* afbbltG.c */
114
115extern void afbDoBitbltGeneral(
116 DrawablePtr /*pSrc*/,
117 DrawablePtr /*pDst*/,
118 int /*alu*/,
119 RegionPtr /*prgnDst*/,
120 DDXPointPtr /*pptSrc*/,
121 unsigned long /*planemask*/
122);
123/* afbbltO.c */
124
125extern void afbDoBitbltOr(
126 DrawablePtr /*pSrc*/,
127 DrawablePtr /*pDst*/,
128 int /*alu*/,
129 RegionPtr /*prgnDst*/,
130 DDXPointPtr /*pptSrc*/,
131 unsigned long /*planemask*/
132);
133/* afbbltX.c */
134
135extern void afbDoBitbltXor(
136 DrawablePtr /*pSrc*/,
137 DrawablePtr /*pDst*/,
138 int /*alu*/,
139 RegionPtr /*prgnDst*/,
140 DDXPointPtr /*pptSrc*/,
141 unsigned long /*planemask*/
142);
143/* afbbres.c */
144
145extern void afbBresS(
146 PixelType * /*addrl*/,
147 int /*nlwidth*/,
148 int /*sizeDst*/,
149 int /*depthDst*/,
150 int /*signdx*/,
151 int /*signdy*/,
152 int /*axis*/,
153 int /*x1*/,
154 int /*y1*/,
155 int /*e*/,
156 int /*e1*/,
157 int /*e2*/,
158 int /*len*/,
159 unsigned char * /*rrops*/
160);
161/* afbbresd.c */
162
163extern void afbBresD(
164 int * /*pdashIndex*/,
165 unsigned char * /*pDash*/,
166 int /*numInDashList*/,
167 int * /*pdashOffset*/,
168 int /*isDoubleDash*/,
169 PixelType * /*addrl*/,
170 int /*nlwidth*/,
171 int /*sizeDst*/,
172 int /*depthDst*/,
173 int /*signdx*/,
174 int /*signdy*/,
175 int /*axis*/,
176 int /*x1*/,
177 int /*y1*/,
178 int /*e*/,
179 int /*e1*/,
180 int /*e2*/,
181 int /*len*/,
182 unsigned char * /*rrops*/,
183 unsigned char * /*bgrrops*/
184);
185/* afbbstore.c */
186
187extern void afbSaveAreas(
188 PixmapPtr /*pPixmap*/,
189 RegionPtr /*prgnSave*/,
190 int /*xorg*/,
191 int /*yorg*/,
192 WindowPtr /*pWin*/
193);
194
195extern void afbRestoreAreas(
196 PixmapPtr /*pPixmap*/,
197 RegionPtr /*prgnRestore*/,
198 int /*xorg*/,
199 int /*yorg*/,
200 WindowPtr /*pWin*/
201);
202/* afbclip.c */
203
204extern RegionPtr afbPixmapToRegion(
205 PixmapPtr /*pPix*/
206);
207
208/* afbcmap.c */
209
210extern int afbListInstalledColormaps(
211 ScreenPtr /*pScreen*/,
212 Colormap * /*pmaps*/
213);
214
215extern void afbInstallColormap(
216 ColormapPtr /*pmap*/
217);
218
219extern void afbUninstallColormap(
220 ColormapPtr /*pmap*/
221);
222
223extern void afbResolveColor(
224 unsigned short * /*pred*/,
225 unsigned short * /*pgreen*/,
226 unsigned short * /*pblue*/,
227 VisualPtr /*pVisual*/
228);
229
230extern Bool afbInitializeColormap(
231 ColormapPtr /*pmap*/
232);
233
234extern Bool afbInitVisuals(
235 VisualPtr * /*visualp*/,
236 DepthPtr * /*depthp*/,
237 int * /*nvisualp*/,
238 int * /*ndepthp*/,
239 int * /*rootDepthp*/,
240 VisualID * /*defaultVisp*/,
241 unsigned long /*sizes*/,
242 int /*bitsPerRGB*/
243);
244
245/* afbfillarc.c */
246
247extern void afbPolyFillArcSolid(
248 DrawablePtr /*pDraw*/,
249 GCPtr /*pGC*/,
250 int /*narcs*/,
251 xArc * /*parcs*/
252);
253/* afbfillrct.c */
254
255extern void afbPolyFillRect(
256 DrawablePtr /*pDrawable*/,
257 GCPtr /*pGC*/,
258 int /*nrectFill*/,
259 xRectangle * /*prectInit*/
260);
261
262/* afbply1rct.c */
263extern void afbFillPolygonSolid(
264 DrawablePtr /*pDrawable*/,
265 GCPtr /*pGC*/,
266 int /*mode*/,
267 int /*shape*/,
268 int /*count*/,
269 DDXPointPtr /*ptsIn*/
270);
271
272/* afbfillsp.c */
273
274extern void afbSolidFS(
275 DrawablePtr /*pDrawable*/,
276 GCPtr /*pGC*/,
277 int /*nInit*/,
278 DDXPointPtr /*pptInit*/,
279 int * /*pwidthInit*/,
280 int /*fSorted*/
281);
282
283extern void afbStippleFS(
284 DrawablePtr /*pDrawable*/,
285 GCPtr/*pGC*/,
286 int /*nInit*/,
287 DDXPointPtr /*pptInit*/,
288 int * /*pwidthInit*/,
289 int /*fSorted*/
290);
291
292extern void afbTileFS(
293 DrawablePtr /*pDrawable*/,
294 GCPtr/*pGC*/,
295 int /*nInit*/,
296 DDXPointPtr /*pptInit*/,
297 int * /*pwidthInit*/,
298 int /*fSorted*/
299);
300
301extern void afbUnnaturalTileFS(
302 DrawablePtr /*pDrawable*/,
303 GCPtr/*pGC*/,
304 int /*nInit*/,
305 DDXPointPtr /*pptInit*/,
306 int * /*pwidthInit*/,
307 int /*fSorted*/
308);
309
310extern void afbUnnaturalStippleFS(
311 DrawablePtr /*pDrawable*/,
312 GCPtr/*pGC*/,
313 int /*nInit*/,
314 DDXPointPtr /*pptInit*/,
315 int * /*pwidthInit*/,
316 int /*fSorted*/
317);
318
319extern void afbOpaqueStippleFS(
320 DrawablePtr /*pDrawable*/,
321 GCPtr/*pGC*/,
322 int /*nInit*/,
323 DDXPointPtr /*pptInit*/,
324 int * /*pwidthInit*/,
325 int /*fSorted*/
326);
327
328extern void afbUnnaturalOpaqueStippleFS(
329 DrawablePtr /*pDrawable*/,
330 GCPtr/*pGC*/,
331 int /*nInit*/,
332 DDXPointPtr /*pptInit*/,
333 int * /*pwidthInit*/,
334 int /*fSorted*/
335);
336
337/* afbfont.c */
338
339extern Bool afbRealizeFont(
340 ScreenPtr /*pscr*/,
341 FontPtr /*pFont*/
342);
343
344extern Bool afbUnrealizeFont(
345 ScreenPtr /*pscr*/,
346 FontPtr /*pFont*/
347);
348/* afbgc.c */
349
350extern Bool afbCreateGC(
351 GCPtr /*pGC*/
352);
353
354extern void afbReduceRop(
355 int /*alu*/,
356 Pixel /*src*/,
357 unsigned long /*planemask*/,
358 int /*depth*/,
359 unsigned char * /*rrops*/
360);
361
362/* afbgetsp.c */
363
364extern void afbGetSpans(
365 DrawablePtr /*pDrawable*/,
366 int /*wMax*/,
367 DDXPointPtr /*ppt*/,
368 int * /*pwidth*/,
369 int /*nspans*/,
370 char * /*pdstStart*/
371);
372/* afbhrzvert.c */
373
374extern void afbHorzS(
375 PixelType * /*addrl*/,
376 int /*nlwidth*/,
377 int /*sizeDst*/,
378 int /*depthDst*/,
379 int /*x1*/,
380 int /*y1*/,
381 int /*len*/,
382 unsigned char * /*rrops*/
383);
384
385extern void afbVertS(
386 PixelType * /*addrl*/,
387 int /*nlwidth*/,
388 int /*sizeDst*/,
389 int /*depthDst*/,
390 int /*x1*/,
391 int /*y1*/,
392 int /*len*/,
393 unsigned char * /*rrops*/
394);
395/* afbigbblak.c */
396
397extern void afbImageGlyphBlt (
398 DrawablePtr /*pDrawable*/,
399 GCPtr/*pGC*/,
400 int /*x*/,
401 int /*y*/,
402 unsigned int /*nglyph*/,
403 CharInfoPtr * /*ppci*/,
404 pointer /*pglyphBase*/
405);
406/* afbigbwht.c */
407
408/* afbimage.c */
409
410extern void afbPutImage(
411 DrawablePtr /*dst*/,
412 GCPtr /*pGC*/,
413 int /*depth*/,
414 int /*x*/,
415 int /*y*/,
416 int /*w*/,
417 int /*h*/,
418 int /*leftPad*/,
419 int /*format*/,
420 char * /*pImage*/
421);
422
423extern void afbGetImage(
424 DrawablePtr /*pDrawable*/,
425 int /*sx*/,
426 int /*sy*/,
427 int /*w*/,
428 int /*h*/,
429 unsigned int /*format*/,
430 unsigned long /*planeMask*/,
431 char * /*pdstLine*/
432);
433/* afbline.c */
434
435extern void afbLineSS(
436 DrawablePtr /*pDrawable*/,
437 GCPtr /*pGC*/,
438 int /*mode*/,
439 int /*npt*/,
440 DDXPointPtr /*pptInit*/
441);
442
443extern void afbLineSD(
444 DrawablePtr /*pDrawable*/,
445 GCPtr /*pGC*/,
446 int /*mode*/,
447 int /*npt*/,
448 DDXPointPtr /*pptInit*/
449);
450
451/* afbmisc.c */
452
453extern void afbQueryBestSize(
454 int /*class*/,
455 unsigned short * /*pwidth*/,
456 unsigned short * /*pheight*/,
457 ScreenPtr /*pScreen*/
458);
459/* afbpntarea.c */
460
461extern void afbSolidFillArea(
462 DrawablePtr /*pDraw*/,
463 int /*nbox*/,
464 BoxPtr /*pbox*/,
465 unsigned char * /*rrops*/
466);
467
468extern void afbStippleAreaPPW(
469 DrawablePtr /*pDraw*/,
470 int /*nbox*/,
471 BoxPtr /*pbox*/,
472 PixmapPtr /*pstipple*/,
473 unsigned char * /*rrops*/
474);
475extern void afbStippleArea(
476 DrawablePtr /*pDraw*/,
477 int /*nbox*/,
478 BoxPtr /*pbox*/,
479 PixmapPtr /*pstipple*/,
480 int /*xOff*/,
481 int /*yOff*/,
482 unsigned char * /*rrops*/
483);
484/* afbplygblt.c */
485
486extern void afbPolyGlyphBlt(
487 DrawablePtr /*pDrawable*/,
488 GCPtr /*pGC*/,
489 int /*x*/,
490 int /*y*/,
491 unsigned int /*nglyph*/,
492 CharInfoPtr * /*ppci*/,
493 pointer /*pglyphBase*/
494);
495
496/* afbpixmap.c */
497
498extern PixmapPtr afbCreatePixmap(
499 ScreenPtr /*pScreen*/,
500 int /*width*/,
501 int /*height*/,
502 int /*depth*/
503);
504
505extern Bool afbDestroyPixmap(
506 PixmapPtr /*pPixmap*/
507);
508
509extern void afbXRotatePixmap(
510 PixmapPtr /*pPix*/,
511 int /*rw*/
512);
513
514extern void afbYRotatePixmap(
515 PixmapPtr /*pPix*/,
516 int /*rh*/
517);
518
519extern void afbCopyRotatePixmap(
520 PixmapPtr /*psrcPix*/,
521 PixmapPtr * /*ppdstPix*/,
522 int /*xrot*/,
523 int /*yrot*/
524);
525extern void afbPaintWindow(
526 WindowPtr /*pWin*/,
527 RegionPtr /*pRegion*/,
528 int /*what*/
529);
530/* afbpolypnt.c */
531
532extern void afbPolyPoint(
533 DrawablePtr /*pDrawable*/,
534 GCPtr /*pGC*/,
535 int /*mode*/,
536 int /*npt*/,
537 xPoint * /*pptInit*/
538);
539/* afbpushpxl.c */
540
541extern void afbPushPixels(
542 GCPtr /*pGC*/,
543 PixmapPtr /*pBitMap*/,
544 DrawablePtr /*pDrawable*/,
545 int /*dx*/,
546 int /*dy*/,
547 int /*xOrg*/,
548 int /*yOrg*/
549);
550
551/* afbscrinit.c */
552
553extern Bool afbScreenInit(
554 ScreenPtr /*pScreen*/,
555 pointer /*pbits*/,
556 int /*xsize*/,
557 int /*ysize*/,
558 int /*dpix*/,
559 int /*dpiy*/,
560 int /*width*/
561);
562
563/* afbseg.c */
564
565extern void afbSegmentSS(
566 DrawablePtr /*pDrawable*/,
567 GCPtr /*pGC*/,
568 int /*nseg*/,
569 xSegment * /*pSeg*/
570);
571
572extern void afbSegmentSD(
573 DrawablePtr /*pDrawable*/,
574 GCPtr /*pGC*/,
575 int /*nseg*/,
576 xSegment * /*pSeg*/
577);
578/* afbsetsp.c */
579
580extern void afbSetSpans(
581 DrawablePtr /*pDrawable*/,
582 GCPtr /*pGC*/,
583 char * /*psrc*/,
584 DDXPointPtr /*ppt*/,
585 int * /*pwidth*/,
586 int /*nspans*/,
587 int /*fSorted*/
588);
589/* afbtegblt.c */
590
591extern void afbTEGlyphBlt(
592 DrawablePtr /*pDrawable*/,
593 GCPtr/*pGC*/,
594 int /*x*/,
595 int /*y*/,
596 unsigned int /*nglyph*/,
597 CharInfoPtr * /*ppci*/,
598 pointer /*pglyphBase*/
599);
600/* afbtileC.c */
601
602extern void afbTileAreaPPWCopy(
603 DrawablePtr /*pDraw*/,
604 int /*nbox*/,
605 BoxPtr /*pbox*/,
606 int /*alu*/,
607 PixmapPtr /*ptile*/,
608 unsigned long /*planemask*/
609);
610/* afbtileG.c */
611
612extern void afbTileAreaPPWGeneral(
613 DrawablePtr /*pDraw*/,
614 int /*nbox*/,
615 BoxPtr /*pbox*/,
616 int /*alu*/,
617 PixmapPtr /*ptile*/,
618 unsigned long /*planemask*/
619);
620
621extern void afbTileAreaCopy(
622 DrawablePtr /*pDraw*/,
623 int /*nbox*/,
624 BoxPtr /*pbox*/,
625 int /*alu*/,
626 PixmapPtr /*ptile*/,
627 int /*xOff*/,
628 int /*yOff*/,
629 unsigned long /*planemask*/
630);
631/* afbtileG.c */
632
633extern void afbTileAreaGeneral(
634 DrawablePtr /*pDraw*/,
635 int /*nbox*/,
636 BoxPtr /*pbox*/,
637 int /*alu*/,
638 PixmapPtr /*ptile*/,
639 int /*xOff*/,
640 int /*yOff*/,
641 unsigned long /*planemask*/
642);
643
644extern void afbOpaqueStippleAreaPPWCopy(
645 DrawablePtr /*pDraw*/,
646 int /*nbox*/,
647 BoxPtr /*pbox*/,
648 int /*alu*/,
649 PixmapPtr /*ptile*/,
650 unsigned char */*rropsOS*/,
651 unsigned long /*planemask*/
652);
653/* afbtileG.c */
654
655extern void afbOpaqueStippleAreaPPWGeneral(
656 DrawablePtr /*pDraw*/,
657 int /*nbox*/,
658 BoxPtr /*pbox*/,
659 int /*alu*/,
660 PixmapPtr /*ptile*/,
661 unsigned char */*rropsOS*/,
662 unsigned long /*planemask*/
663);
664
665extern void afbOpaqueStippleAreaCopy(
666 DrawablePtr /*pDraw*/,
667 int /*nbox*/,
668 BoxPtr /*pbox*/,
669 int /*alu*/,
670 PixmapPtr /*ptile*/,
671 int /*xOff*/,
672 int /*yOff*/,
673 unsigned char */*rropsOS*/,
674 unsigned long /*planemask*/
675);
676/* afbtileG.c */
677
678extern void afbOpaqueStippleAreaGeneral(
679 DrawablePtr /*pDraw*/,
680 int /*nbox*/,
681 BoxPtr /*pbox*/,
682 int /*alu*/,
683 PixmapPtr /*ptile*/,
684 int /*xOff*/,
685 int /*yOff*/,
686 unsigned char */*rropsOS*/,
687 unsigned long /*planemask*/
688);
689
690/* afbwindow.c */
691
692extern Bool afbCreateWindow(
693 WindowPtr /*pWin*/
694);
695
696extern Bool afbDestroyWindow(
697 WindowPtr /*pWin*/
698);
699
700extern Bool afbMapWindow(
701 WindowPtr /*pWindow*/
702);
703
704extern Bool afbPositionWindow(
705 WindowPtr /*pWin*/,
706 int /*x*/,
707 int /*y*/
708);
709
710extern Bool afbUnmapWindow(
711 WindowPtr /*pWindow*/
712);
713
714extern void afbCopyWindow(
715 WindowPtr /*pWin*/,
716 DDXPointRec /*ptOldOrg*/,
717 RegionPtr /*prgnSrc*/
718);
719
720extern Bool afbChangeWindowAttributes(
721 WindowPtr /*pWin*/,
722 unsigned long /*mask*/
723);
724/* afbzerarc.c */
725
726extern void afbZeroPolyArcSS(
727 DrawablePtr /*pDraw*/,
728 GCPtr /*pGC*/,
729 int /*narcs*/,
730 xArc * /*parcs*/
731);
732
733/*
734 private field of pixmap
735 pixmap.devPrivate = (PixelType *)pointer_to_bits
736 pixmap.devKind = width_of_pixmap_in_bytes
737
738 private field of screen
739 a pixmap, for which we allocate storage. devPrivate is a pointer to
740the bits in the hardware framebuffer. note that devKind can be poked to
741make the code work for framebuffers that are wider than their
742displayable screen (e.g. the early vsII, which displayed 960 pixels
743across, but was 1024 in the hardware.)
744
745 private field of GC
746*/
747
748typedef struct {
749 unsigned char rrops[AFB_MAX_DEPTH]; /* reduction of rasterop to 1 of 3 */
750 unsigned char rropOS[AFB_MAX_DEPTH]; /* rop for opaque stipple */
751} afbPrivGC;
752typedef afbPrivGC *afbPrivGCPtr;
753
754extern int afbGCPrivateIndex; /* index into GC private array */
755extern int afbWindowPrivateIndex; /* index into Window private array */
756#ifdef PIXMAP_PER_WINDOW
757extern int frameWindowPrivateIndex; /* index into Window private array */
758#endif
759
760#define afbGetGCPrivate(pGC) \
761 ((afbPrivGC *)((pGC)->devPrivates[afbGCPrivateIndex].ptr))
762
763/* private field of window */
764typedef struct {
765 unsigned char fastBorder; /* non-zero if border tile is 32 bits wide */
766 unsigned char fastBackground;
767 unsigned short unused; /* pad for alignment with Sun compiler */
768 DDXPointRec oldRotate;
769 PixmapPtr pRotatedBackground;
770 PixmapPtr pRotatedBorder;
771} afbPrivWin;
772
773/* Common macros for extracting drawing information */
774
775#define afbGetTypedWidth(pDrawable,wtype)( \
776 (((pDrawable)->type == DRAWABLE_WINDOW) ? \
777 (int)(((PixmapPtr)((pDrawable)->pScreen->devPrivates[afbScreenPrivateIndex].ptr))->devKind) : \
778 (int)(((PixmapPtr)pDrawable)->devKind)) / sizeof (wtype))
779
780#define afbGetByteWidth(pDrawable) afbGetTypedWidth(pDrawable, unsigned char)
781
782#define afbGetPixelWidth(pDrawable) afbGetTypedWidth(pDrawable, PixelType)
783
784#define afbGetTypedWidthAndPointer(pDrawable, width, pointer, wtype, ptype) {\
785 PixmapPtr _pPix; \
786 if ((pDrawable)->type == DRAWABLE_WINDOW) \
787 _pPix = (PixmapPtr)(pDrawable)->pScreen->devPrivates[afbScreenPrivateIndex].ptr; \
788 else \
789 _pPix = (PixmapPtr)(pDrawable); \
790 (pointer) = (ptype *) _pPix->devPrivate.ptr; \
791 (width) = ((int) _pPix->devKind) / sizeof (wtype); \
792}
793
794#define afbGetPixelWidthSizeDepthAndPointer(pDrawable, width, size, dep, pointer) {\
795 PixmapPtr _pPix; \
796 if ((pDrawable)->type == DRAWABLE_WINDOW) \
797 _pPix = (PixmapPtr)(pDrawable)->pScreen->devPrivates[afbScreenPrivateIndex].ptr; \
798 else \
799 _pPix = (PixmapPtr)(pDrawable); \
800 (pointer) = (PixelType *)_pPix->devPrivate.ptr; \
801 (width) = ((int)_pPix->devKind) / sizeof (PixelType); \
802 (size) = (width) * _pPix->drawable.height; \
803 (dep) = _pPix->drawable.depth; (void)(dep); \
804}
805
806#define afbGetByteWidthAndPointer(pDrawable, width, pointer) \
807 afbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned char, unsigned char)
808
809#define afbGetPixelWidthAndPointer(pDrawable, width, pointer) \
810 afbGetTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType)
811
812#define afbGetWindowTypedWidthAndPointer(pWin, width, pointer, wtype, ptype) {\
813 PixmapPtr _pPix = (PixmapPtr)(pWin)->drawable.pScreen->devPrivates[afbScreenPrivateIndex].ptr; \
814 (pointer) = (ptype *) _pPix->devPrivate.ptr; \
815 (width) = ((int) _pPix->devKind) / sizeof (wtype); \
816}
817
818#define afbGetWindowPixelWidthAndPointer(pWin, width, pointer) \
819 afbGetWindowTypedWidthAndPointer(pWin, width, pointer, PixelType, PixelType)
820
821#define afbGetWindowByteWidthAndPointer(pWin, width, pointer) \
822 afbGetWindowTypedWidthAndPointer(pWin, width, pointer, char, char)
823
824/* afb uses the following macros to calculate addresses in drawables.
825 * To support banked framebuffers, the macros come in four flavors.
826 * All four collapse into the same definition on unbanked devices.
827 *
828 * afbScanlineFoo - calculate address and do bank switching
829 * afbScanlineFooNoBankSwitch - calculate address, don't bank switch
830 * afbScanlineFooSrc - calculate address, switch source bank
831 * afbScanlineFooDst - calculate address, switch destination bank
832 */
833
834/* The NoBankSwitch versions are the same for banked and unbanked cases */
835
836#define afbScanlineIncNoBankSwitch(_ptr, _off) _ptr += (_off)
837#define afbScanlineOffsetNoBankSwitch(_ptr, _off) ((_ptr) + (_off))
838#define afbScanlineDeltaNoBankSwitch(_ptr, _y, _w) \
839 afbScanlineOffsetNoBankSwitch(_ptr, (_y) * (_w))
840#define afbScanlineNoBankSwitch(_ptr, _x, _y, _w) \
841 afbScanlineOffsetNoBankSwitch(_ptr, (_y) * (_w) + ((_x) >> MFB_PWSH))
842
843#ifdef MFB_LINE_BANK
844
845#include "afblinebank.h" /* get macro definitions from this file */
846
847#else /* !MFB_LINE_BANK - unbanked case */
848
849#define afbScanlineInc(_ptr, _off) afbScanlineIncNoBankSwitch(_ptr, _off)
850#define afbScanlineIncSrc(_ptr, _off) afbScanlineInc(_ptr, _off)
851#define afbScanlineIncDst(_ptr, _off) afbScanlineInc(_ptr, _off)
852
853#define afbScanlineOffset(_ptr, _off) afbScanlineOffsetNoBankSwitch(_ptr, _off)
854#define afbScanlineOffsetSrc(_ptr, _off) afbScanlineOffset(_ptr, _off)
855#define afbScanlineOffsetDst(_ptr, _off) afbScanlineOffset(_ptr, _off)
856
857#define afbScanlineSrc(_ptr, _x, _y, _w) afbScanline(_ptr, _x, _y, _w)
858#define afbScanlineDst(_ptr, _x, _y, _w) afbScanline(_ptr, _x, _y, _w)
859
860#define afbScanlineDeltaSrc(_ptr, _y, _w) afbScanlineDelta(_ptr, _y, _w)
861#define afbScanlineDeltaDst(_ptr, _y, _w) afbScanlineDelta(_ptr, _y, _w)
862
863#endif /* MFB_LINE_BANK */
864
865#define afbScanlineDelta(_ptr, _y, _w) \
866 afbScanlineOffset(_ptr, (_y) * (_w))
867
868#define afbScanline(_ptr, _x, _y, _w) \
869 afbScanlineOffset(_ptr, (_y) * (_w) + ((_x) >> MFB_PWSH))
870
871/* precomputed information about each glyph for GlyphBlt code.
872 this saves recalculating the per glyph information for each box.
873*/
874
875typedef struct _afbpos{
876 int xpos; /* xposition of glyph's origin */
877 int xchar; /* x position mod 32 */
878 int leftEdge;
879 int rightEdge;
880 int topEdge;
881 int bottomEdge;
882 PixelType *pdstBase; /* longword with character origin */
883 int widthGlyph; /* width in bytes of this glyph */
884} afbTEXTPOS;
885
886/* reduced raster ops for afb */
887#define RROP_BLACK GXclear
888#define RROP_WHITE GXset
889#define RROP_NOP GXnoop
890#define RROP_INVERT GXinvert
891#define RROP_COPY GXcopy
892
893/* macros for afbbitblt.c, afbfillsp.c
894 these let the code do one switch on the rop per call, rather
895 than a switch on the rop per item (span or rectangle.)
896*/
897
898#define fnCLEAR(src, dst) (0)
899#define fnAND(src, dst) (src & dst)
900#define fnANDREVERSE(src, dst) (src & ~dst)
901#define fnCOPY(src, dst) (src)
902#define fnANDINVERTED(src, dst) (~src & dst)
903#define fnNOOP(src, dst) (dst)
904#define fnXOR(src, dst) (src ^ dst)
905#define fnOR(src, dst) (src | dst)
906#define fnNOR(src, dst) (~(src | dst))
907#define fnEQUIV(src, dst) (~src ^ dst)
908#define fnINVERT(src, dst) (~dst)
909#define fnORREVERSE(src, dst) (src | ~dst)
910#define fnCOPYINVERTED(src, dst) (~src)
911#define fnORINVERTED(src, dst) (~src | dst)
912#define fnNAND(src, dst) (~(src & dst))
913#undef fnSET
914#define fnSET(src, dst) (~0)
915
916/* Using a "switch" statement is much faster in most cases
917 * since the compiler can do a look-up table or multi-way branch
918 * instruction, depending on the architecture. The result on
919 * A Sun 3/50 is at least 2.5 times faster, assuming a uniform
920 * distribution of RasterOp operation types.
921 *
922 * However, doing some profiling on a running system reveals
923 * GXcopy is the operation over 99.5% of the time and
924 * GXxor is the next most frequent (about .4%), so we make special
925 * checks for those first.
926 *
927 * Note that this requires a change to the "calling sequence"
928 * since we can't engineer a "switch" statement to have an lvalue.
929 */
930#undef DoRop
931#define DoRop(result, alu, src, dst) \
932{ \
933 if (alu == GXcopy) \
934 result = fnCOPY (src, dst); \
935 else if (alu == GXxor) \
936 result = fnXOR (src, dst); \
937 else \
938 switch (alu) { \
939 case GXclear: \
940 result = fnCLEAR (src, dst); \
941 break; \
942 case GXand: \
943 result = fnAND (src, dst); \
944 break; \
945 case GXandReverse: \
946 result = fnANDREVERSE (src, dst); \
947 break; \
948 case GXandInverted: \
949 result = fnANDINVERTED (src, dst); \
950 break; \
951 default: \
952 case GXnoop: \
953 result = fnNOOP (src, dst); \
954 break; \
955 case GXor: \
956 result = fnOR (src, dst); \
957 break; \
958 case GXnor: \
959 result = fnNOR (src, dst); \
960 break; \
961 case GXequiv: \
962 result = fnEQUIV (src, dst); \
963 break; \
964 case GXinvert: \
965 result = fnINVERT (src, dst); \
966 break; \
967 case GXorReverse: \
968 result = fnORREVERSE (src, dst); \
969 break; \
970 case GXcopyInverted: \
971 result = fnCOPYINVERTED (src, dst); \
972 break; \
973 case GXorInverted: \
974 result = fnORINVERTED (src, dst); \
975 break; \
976 case GXnand: \
977 result = fnNAND (src, dst); \
978 break; \
979 case GXset: \
980 result = fnSET (src, dst); \
981 break; \
982 } \
983}
984
985
986/* C expression fragments for various operations. These get passed in
987 * as -D's on the compile command line. See afb/Imakefile. This
988 * fixes XBUG 6319.
989 *
990 * This seems like a good place to point out that afb's use of the
991 * words black and white is an unfortunate misnomer. In afb code, black
992 * means zero, and white means one.
993 */
994#define MFB_OPEQ_WHITE |=
995#define MFB_OPEQ_BLACK &=~
996#define MFB_OPEQ_INVERT ^=
997#define MFB_EQWHOLEWORD_WHITE =~0
998#define MFB_EQWHOLEWORD_BLACK =0
999#define MFB_EQWHOLEWORD_INVERT ^=~0
1000#define MFB_OP_WHITE /* nothing */
1001#define MFB_OP_BLACK ~
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