1 /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
2 /***********************************************************
4 Copyright (c) 1987 X Consortium
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 Except as contained in this notice, the name of the X Consortium shall not be
24 used in advertising or otherwise to promote the sale, use or other dealings
25 in this Software without prior written authorization from the X Consortium.
28 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
32 Permission to use, copy, modify, and distribute this software and its
33 documentation for any purpose and without fee is hereby granted,
34 provided that the above copyright notice appear in all copies and that
35 both that copyright notice and this permission notice appear in
36 supporting documentation, and that the name of Digital not be
37 used in advertising or publicity pertaining to distribution of the
38 software without specific, written prior permission.
40 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
41 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
42 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
43 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
44 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
45 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
48 ******************************************************************/
49 /* $XConsortium: mfb.h,v 5.31 94/04/17 20:28:15 dpw Exp $ */
54 /* $XFree86: xc/programs/Xserver/mfb/mfb.h,v 1.2 1997/01/14 22:22:44 dawes Exp $ */
55 /* Monochrome Frame Buffer definitions
56 written by drewry, september 1986
62 #include "miscstruct.h"
65 extern int InverseAlu[];
67 /* warning: PixelType definition duplicated in maskbits.h */
69 #define PixelType unsigned long
70 #endif /* PixelType */
74 extern void mfbDoBitblt(
75 #if NeedFunctionPrototypes
79 RegionPtr /*prgnDst*/,
80 DDXPointPtr /*pptSrc*/
84 extern RegionPtr mfbCopyArea(
85 #if NeedFunctionPrototypes
86 DrawablePtr /*pSrcDrawable*/,
87 DrawablePtr /*pDstDrawable*/,
98 extern Bool mfbRegisterCopyPlaneProc(
99 #if NeedFunctionPrototypes
100 ScreenPtr /*pScreen*/,
101 RegionPtr (* /*proc*/)(
102 #if NeedNestedPrototypes
103 DrawablePtr /* pSrcDrawable */,
104 DrawablePtr /* pDstDrawable */,
112 unsigned long /* bitPlane */
118 extern RegionPtr mfbCopyPlane(
119 #if NeedFunctionPrototypes
120 DrawablePtr /*pSrcDrawable*/,
121 DrawablePtr /*pDstDrawable*/,
129 unsigned long /*plane*/
134 extern void mfbDoBitbltCopy(
135 #if NeedFunctionPrototypes
136 DrawablePtr /*pSrc*/,
137 DrawablePtr /*pDst*/,
139 RegionPtr /*prgnDst*/,
140 DDXPointPtr /*pptSrc*/
145 extern void mfbDoBitbltCopyInverted(
146 #if NeedFunctionPrototypes
147 DrawablePtr /*pSrc*/,
148 DrawablePtr /*pDst*/,
150 RegionPtr /*prgnDst*/,
151 DDXPointPtr /*pptSrc*/
156 extern void mfbDoBitbltGeneral(
157 #if NeedFunctionPrototypes
158 DrawablePtr /*pSrc*/,
159 DrawablePtr /*pDst*/,
161 RegionPtr /*prgnDst*/,
162 DDXPointPtr /*pptSrc*/
167 extern void mfbDoBitbltOr(
168 #if NeedFunctionPrototypes
169 DrawablePtr /*pSrc*/,
170 DrawablePtr /*pDst*/,
172 RegionPtr /*prgnDst*/,
173 DDXPointPtr /*pptSrc*/
178 extern void mfbDoBitbltXor(
179 #if NeedFunctionPrototypes
180 DrawablePtr /*pSrc*/,
181 DrawablePtr /*pDst*/,
183 RegionPtr /*prgnDst*/,
184 DDXPointPtr /*pptSrc*/
189 extern void mfbBresS(
190 #if NeedFunctionPrototypes
192 PixelType * /*addrl*/,
207 extern void mfbBresD(
208 #if NeedFunctionPrototypes
211 int * /*pdashIndex*/,
212 unsigned char * /*pDash*/,
213 int /*numInDashList*/,
214 int * /*pdashOffset*/,
215 int /*isDoubleDash*/,
216 PixelType * /*addrl*/,
231 extern void mfbSaveAreas(
232 #if NeedFunctionPrototypes
233 PixmapPtr /*pPixmap*/,
234 RegionPtr /*prgnSave*/,
241 extern void mfbRestoreAreas(
242 #if NeedFunctionPrototypes
243 PixmapPtr /*pPixmap*/,
244 RegionPtr /*prgnRestore*/,
252 extern RegionPtr mfbPixmapToRegion(
253 #if NeedFunctionPrototypes
259 extern int mfbListInstalledColormaps(
260 #if NeedFunctionPrototypes
261 ScreenPtr /*pScreen*/,
266 extern void mfbInstallColormap(
267 #if NeedFunctionPrototypes
272 extern void mfbUninstallColormap(
273 #if NeedFunctionPrototypes
278 extern void mfbResolveColor(
279 #if NeedFunctionPrototypes
280 unsigned short * /*pred*/,
281 unsigned short * /*pgreen*/,
282 unsigned short * /*pblue*/,
283 VisualPtr /*pVisual*/
287 extern Bool mfbCreateColormap(
288 #if NeedFunctionPrototypes
293 extern void mfbDestroyColormap(
294 #if NeedFunctionPrototypes
299 extern Bool mfbCreateDefColormap(
300 #if NeedFunctionPrototypes
301 ScreenPtr /*pScreen*/
306 extern void mfbPolyFillArcSolid(
307 #if NeedFunctionPrototypes
308 DrawablePtr /*pDraw*/,
316 extern void mfbPolyFillRect(
317 #if NeedFunctionPrototypes
318 DrawablePtr /*pDrawable*/,
321 xRectangle * /*prectInit*/
326 extern void mfbBlackSolidFS(
327 #if NeedFunctionPrototypes
328 DrawablePtr /*pDrawable*/,
331 DDXPointPtr /*pptInit*/,
332 int * /*pwidthInit*/,
337 extern void mfbWhiteSolidFS(
338 #if NeedFunctionPrototypes
339 DrawablePtr /*pDrawable*/,
342 DDXPointPtr /*pptInit*/,
343 int * /*pwidthInit*/,
348 extern void mfbInvertSolidFS(
349 #if NeedFunctionPrototypes
350 DrawablePtr /*pDrawable*/,
353 DDXPointPtr /*pptInit*/,
354 int * /*pwidthInit*/,
359 extern void mfbWhiteStippleFS(
360 #if NeedFunctionPrototypes
361 DrawablePtr /*pDrawable*/,
364 DDXPointPtr /*pptInit*/,
365 int * /*pwidthInit*/,
370 extern void mfbBlackStippleFS(
371 #if NeedFunctionPrototypes
372 DrawablePtr /*pDrawable*/,
375 DDXPointPtr /*pptInit*/,
376 int * /*pwidthInit*/,
381 extern void mfbInvertStippleFS(
382 #if NeedFunctionPrototypes
383 DrawablePtr /*pDrawable*/,
386 DDXPointPtr /*pptInit*/,
387 int * /*pwidthInit*/,
392 extern void mfbTileFS(
393 #if NeedFunctionPrototypes
394 DrawablePtr /*pDrawable*/,
397 DDXPointPtr /*pptInit*/,
398 int * /*pwidthInit*/,
403 extern void mfbUnnaturalTileFS(
404 #if NeedFunctionPrototypes
405 DrawablePtr /*pDrawable*/,
408 DDXPointPtr /*pptInit*/,
409 int * /*pwidthInit*/,
414 extern void mfbUnnaturalStippleFS(
415 #if NeedFunctionPrototypes
416 DrawablePtr /*pDrawable*/,
419 DDXPointPtr /*pptInit*/,
420 int * /*pwidthInit*/,
426 extern Bool mfbRealizeFont(
427 #if NeedFunctionPrototypes
433 extern Bool mfbUnrealizeFont(
434 #if NeedFunctionPrototypes
441 extern Bool mfbCreateGC(
442 #if NeedFunctionPrototypes
447 extern void mfbValidateGC(
448 #if NeedFunctionPrototypes
450 unsigned long /*changes*/,
451 DrawablePtr /*pDrawable*/
455 extern int mfbReduceRop(
456 #if NeedFunctionPrototypes
464 extern void mfbGetSpans(
465 #if NeedFunctionPrototypes
466 DrawablePtr /*pDrawable*/,
477 #if NeedFunctionPrototypes
479 PixelType * /*addrl*/,
488 #if NeedFunctionPrototypes
490 PixelType * /*addrl*/,
499 extern void mfbImageGlyphBltBlack(
500 #if NeedFunctionPrototypes
501 DrawablePtr /*pDrawable*/,
505 unsigned int /*nglyph*/,
506 CharInfoPtr * /*ppci*/,
507 pointer /*pglyphBase*/
512 extern void mfbImageGlyphBltWhite(
513 #if NeedFunctionPrototypes
514 DrawablePtr /*pDrawable*/,
518 unsigned int /*nglyph*/,
519 CharInfoPtr * /*ppci*/,
520 pointer /*pglyphBase*/
525 extern void mfbPutImage(
526 #if NeedFunctionPrototypes
540 extern void mfbGetImage(
541 #if NeedFunctionPrototypes
542 DrawablePtr /*pDrawable*/,
547 unsigned int /*format*/,
548 unsigned long /*planeMask*/,
554 extern void mfbLineSS(
555 #if NeedFunctionPrototypes
556 DrawablePtr /*pDrawable*/,
560 DDXPointPtr /*pptInit*/
564 extern void mfbLineSD(
565 #if NeedFunctionPrototypes
566 DrawablePtr /*pDrawable*/,
570 DDXPointPtr /*pptInit*/
576 extern void mfbQueryBestSize(
577 #if NeedFunctionPrototypes
579 unsigned short * /*pwidth*/,
580 unsigned short * /*pheight*/,
581 ScreenPtr /*pScreen*/
586 extern void mfbSolidBlackArea(
587 #if NeedFunctionPrototypes
588 DrawablePtr /*pDraw*/,
596 extern void mfbStippleBlackArea(
597 #if NeedFunctionPrototypes
598 DrawablePtr /*pDraw*/,
602 PixmapPtr /*pstipple*/
607 extern void mfbSolidInvertArea(
608 #if NeedFunctionPrototypes
609 DrawablePtr /*pDraw*/,
617 extern void mfbStippleInvertArea(
618 #if NeedFunctionPrototypes
619 DrawablePtr /*pDraw*/,
623 PixmapPtr /*pstipple*/
628 extern void mfbSolidWhiteArea(
629 #if NeedFunctionPrototypes
630 DrawablePtr /*pDraw*/,
638 extern void mfbStippleWhiteArea(
639 #if NeedFunctionPrototypes
640 DrawablePtr /*pDraw*/,
644 PixmapPtr /*pstipple*/
649 extern void mfbPolyGlyphBltBlack(
650 #if NeedFunctionPrototypes
651 DrawablePtr /*pDrawable*/,
655 unsigned int /*nglyph*/,
656 CharInfoPtr * /*ppci*/,
657 pointer /*pglyphBase*/
662 extern void mfbPolyGlyphBltInvert(
663 #if NeedFunctionPrototypes
664 DrawablePtr /*pDrawable*/,
668 unsigned int /*nglyph*/,
669 CharInfoPtr * /*ppci*/,
670 pointer /*pglyphBase*/
675 extern void mfbPolyGlyphBltWhite(
676 #if NeedFunctionPrototypes
677 DrawablePtr /*pDrawable*/,
681 unsigned int /*nglyph*/,
682 CharInfoPtr * /*ppci*/,
683 pointer /*pglyphBase*/
688 extern PixmapPtr mfbCreatePixmap(
689 #if NeedFunctionPrototypes
690 ScreenPtr /*pScreen*/,
697 extern Bool mfbDestroyPixmap(
698 #if NeedFunctionPrototypes
699 PixmapPtr /*pPixmap*/
703 extern PixmapPtr mfbCopyPixmap(
704 #if NeedFunctionPrototypes
709 extern void mfbPadPixmap(
710 #if NeedFunctionPrototypes
711 PixmapPtr /*pPixmap*/
715 extern void mfbXRotatePixmap(
716 #if NeedFunctionPrototypes
722 extern void mfbYRotatePixmap(
723 #if NeedFunctionPrototypes
729 extern void mfbCopyRotatePixmap(
730 #if NeedFunctionPrototypes
731 PixmapPtr /*psrcPix*/,
732 PixmapPtr * /*ppdstPix*/,
739 extern void mfbFillPolyBlack(
740 #if NeedFunctionPrototypes
741 DrawablePtr /*pDrawable*/,
746 DDXPointPtr /*ptsIn*/
751 extern void mfbFillPolyInvert(
752 #if NeedFunctionPrototypes
753 DrawablePtr /*pDrawable*/,
758 DDXPointPtr /*ptsIn*/
763 extern void mfbFillPolyWhite(
764 #if NeedFunctionPrototypes
765 DrawablePtr /*pDrawable*/,
770 DDXPointPtr /*ptsIn*/
775 extern void mfbPaintWindow(
776 #if NeedFunctionPrototypes
778 RegionPtr /*pRegion*/,
784 extern void mfbPolyPoint(
785 #if NeedFunctionPrototypes
786 DrawablePtr /*pDrawable*/,
795 extern void mfbSolidPP(
796 #if NeedFunctionPrototypes
798 PixmapPtr /*pBitMap*/,
799 DrawablePtr /*pDrawable*/,
807 extern void mfbPushPixels(
808 #if NeedFunctionPrototypes
810 PixmapPtr /*pBitMap*/,
811 DrawablePtr /*pDrawable*/,
820 extern Bool mfbCloseScreen(
821 #if NeedFunctionPrototypes
823 ScreenPtr /*pScreen*/
828 extern Bool mfbAllocatePrivates(
829 #if NeedFunctionPrototypes
830 ScreenPtr /*pScreen*/,
836 extern Bool mfbScreenInit(
837 #if NeedFunctionPrototypes
838 ScreenPtr /*pScreen*/,
849 extern void mfbSegmentSS(
850 #if NeedFunctionPrototypes
851 DrawablePtr /*pDrawable*/,
858 extern void mfbSegmentSD(
859 #if NeedFunctionPrototypes
860 DrawablePtr /*pDrawable*/,
868 extern int mfbSetScanline(
869 #if NeedFunctionPrototypes
874 PixelType * /*psrc*/,
876 PixelType * /*pdstBase*/,
881 extern void mfbSetSpans(
882 #if NeedFunctionPrototypes
883 DrawablePtr /*pDrawable*/,
894 extern void mfbTEGlyphBltBlack(
895 #if NeedFunctionPrototypes
896 DrawablePtr /*pDrawable*/,
900 unsigned int /*nglyph*/,
901 CharInfoPtr * /*ppci*/,
902 pointer /*pglyphBase*/
907 extern void mfbTEGlyphBltWhite(
908 #if NeedFunctionPrototypes
909 DrawablePtr /*pDrawable*/,
913 unsigned int /*nglyph*/,
914 CharInfoPtr * /*ppci*/,
915 pointer /*pglyphBase*/
920 extern void mfbTileAreaPPWCopy(
921 #if NeedFunctionPrototypes
922 DrawablePtr /*pDraw*/,
931 extern void mfbTileAreaPPWGeneral(
932 #if NeedFunctionPrototypes
933 DrawablePtr /*pDraw*/,
941 extern void mfbTileAreaPPW(
942 #if NeedFunctionPrototypes
943 DrawablePtr /*pDraw*/,
952 extern Bool mfbCreateWindow(
953 #if NeedFunctionPrototypes
958 extern Bool mfbDestroyWindow(
959 #if NeedFunctionPrototypes
964 extern Bool mfbMapWindow(
965 #if NeedFunctionPrototypes
966 WindowPtr /*pWindow*/
970 extern Bool mfbPositionWindow(
971 #if NeedFunctionPrototypes
978 extern Bool mfbUnmapWindow(
979 #if NeedFunctionPrototypes
980 WindowPtr /*pWindow*/
984 extern void mfbCopyWindow(
985 #if NeedFunctionPrototypes
987 DDXPointRec /*ptOldOrg*/,
988 RegionPtr /*prgnSrc*/
992 extern Bool mfbChangeWindowAttributes(
993 #if NeedFunctionPrototypes
995 unsigned long /*mask*/
1000 extern void mfbZeroPolyArcSS(
1001 #if NeedFunctionPrototypes
1002 DrawablePtr /*pDraw*/,
1010 private filed of pixmap
1011 pixmap.devPrivate = (PixelType *)pointer_to_bits
1012 pixmap.devKind = width_of_pixmap_in_bytes
1014 private field of screen
1015 a pixmap, for which we allocate storage. devPrivate is a pointer to
1016 the bits in the hardware framebuffer. note that devKind can be poked to
1017 make the code work for framebuffers that are wider than their
1018 displayable screen (e.g. the early vsII, which displayed 960 pixels
1019 across, but was 1024 in the hardware.)
1022 Freeing pCompositeClip is done based on the value of
1023 freeCompClip; if freeCompClip is not carefully maintained, we will end
1024 up losing storage or freeing something that isn't ours.
1028 unsigned char rop; /* reduction of rasterop to 1 of 3 */
1029 unsigned char ropOpStip; /* rop for opaque stipple */
1030 unsigned char ropFillArea; /* == alu, rop, or ropOpStip */
1031 unsigned fExpose:1; /* callexposure handling ? */
1032 unsigned freeCompClip:1;
1033 PixmapPtr pRotatedPixmap; /* tile/stipple rotated to align */
1034 RegionPtr pCompositeClip; /* free this based on freeCompClip
1035 flag rather than NULLness */
1036 void (* FillArea)( /* fills regions; look at the code */
1037 #if NeedNestedPrototypes
1038 DrawablePtr /*pDraw*/,
1046 typedef mfbPrivGC *mfbPrivGCPtr;
1048 extern int mfbGCPrivateIndex; /* index into GC private array */
1049 extern int mfbWindowPrivateIndex; /* index into Window private array */
1050 #ifdef PIXMAP_PER_WINDOW
1051 extern int frameWindowPrivateIndex; /* index into Window private array */
1054 /* private field of window */
1056 unsigned char fastBorder; /* non-zero if border tile is 32 bits wide */
1057 unsigned char fastBackground;
1058 unsigned short unused; /* pad for alignment with Sun compiler */
1059 DDXPointRec oldRotate;
1060 PixmapPtr pRotatedBackground;
1061 PixmapPtr pRotatedBorder;
1064 /* Common macros for extracting drawing information */
1066 #define mfbGetTypedWidth(pDrawable,type) (\
1067 (((pDrawable)->type == DRAWABLE_WINDOW) ? \
1068 (int) (((PixmapPtr)((pDrawable)->pScreen->devPrivate))->devKind) : \
1069 (int)(((PixmapPtr)pDrawable)->devKind)) / sizeof (type))
1071 #define mfbGetByteWidth(pDrawable) mfbGetTypedWidth(pDrawable, unsigned char)
1073 #define mfbGetPixelWidth(pDrawable) mfbGetTypedWidth(pDrawable, PixelType)
1075 #define mfbGetTypedWidthAndPointer(pDrawable, width, pointer, wtype, ptype) {\
1077 if ((pDrawable)->type == DRAWABLE_WINDOW) \
1078 _pPix = (PixmapPtr) (pDrawable)->pScreen->devPrivate; \
1080 _pPix = (PixmapPtr) (pDrawable); \
1081 (pointer) = (ptype *) _pPix->devPrivate.ptr; \
1082 (width) = ((int) _pPix->devKind) / sizeof (wtype); \
1085 #define mfbGetByteWidthAndPointer(pDrawable, width, pointer) \
1086 mfbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned char, unsigned char)
1088 #define mfbGetPixelWidthAndPointer(pDrawable, width, pointer) \
1089 mfbGetTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType)
1091 #define mfbGetWindowTypedWidthAndPointer(pWin, width, pointer, wtype, ptype) {\
1092 PixmapPtr _pPix = (PixmapPtr) (pWin)->drawable.pScreen->devPrivate; \
1093 (pointer) = (ptype *) _pPix->devPrivate.ptr; \
1094 (width) = ((int) _pPix->devKind) / sizeof (wtype); \
1097 #define mfbGetWindowPixelWidthAndPointer(pWin, width, pointer) \
1098 mfbGetWindowTypedWidthAndPointer(pWin, width, pointer, PixelType, PixelType)
1100 #define mfbGetWindowByteWidthAndPointer(pWin, width, pointer) \
1101 mfbGetWindowTypedWidthAndPointer(pWin, width, pointer, char, char)
1103 /* mfb uses the following macros to calculate addresses in drawables.
1104 * To support banked framebuffers, the macros come in four flavors.
1105 * All four collapse into the same definition on unbanked devices.
1107 * mfbScanlineFoo - calculate address and do bank switching
1108 * mfbScanlineFooNoBankSwitch - calculate address, don't bank switch
1109 * mfbScanlineFooSrc - calculate address, switch source bank
1110 * mfbScanlineFooDst - calculate address, switch destination bank
1113 /* The NoBankSwitch versions are the same for banked and unbanked cases */
1115 #define mfbScanlineIncNoBankSwitch(_ptr, _off) _ptr += (_off)
1116 #define mfbScanlineOffsetNoBankSwitch(_ptr, _off) ((_ptr) + (_off))
1117 #define mfbScanlineDeltaNoBankSwitch(_ptr, _y, _w) \
1118 mfbScanlineOffsetNoBankSwitch(_ptr, (_y) * (_w))
1119 #define mfbScanlineNoBankSwitch(_ptr, _x, _y, _w) \
1120 mfbScanlineOffsetNoBankSwitch(_ptr, (_y) * (_w) + ((_x) >> MFB_PWSH))
1122 #ifdef MFB_LINE_BANK
1124 #include "mfblinebank.h" /* get macro definitions from this file */
1126 #else /* !MFB_LINE_BANK - unbanked case */
1128 #define mfbScanlineInc(_ptr, _off) mfbScanlineIncNoBankSwitch(_ptr, _off)
1129 #define mfbScanlineIncSrc(_ptr, _off) mfbScanlineInc(_ptr, _off)
1130 #define mfbScanlineIncDst(_ptr, _off) mfbScanlineInc(_ptr, _off)
1132 #define mfbScanlineOffset(_ptr, _off) mfbScanlineOffsetNoBankSwitch(_ptr, _off)
1133 #define mfbScanlineOffsetSrc(_ptr, _off) mfbScanlineOffset(_ptr, _off)
1134 #define mfbScanlineOffsetDst(_ptr, _off) mfbScanlineOffset(_ptr, _off)
1136 #define mfbScanlineSrc(_ptr, _x, _y, _w) mfbScanline(_ptr, _x, _y, _w)
1137 #define mfbScanlineDst(_ptr, _x, _y, _w) mfbScanline(_ptr, _x, _y, _w)
1139 #define mfbScanlineDeltaSrc(_ptr, _y, _w) mfbScanlineDelta(_ptr, _y, _w)
1140 #define mfbScanlineDeltaDst(_ptr, _y, _w) mfbScanlineDelta(_ptr, _y, _w)
1142 #endif /* MFB_LINE_BANK */
1144 #define mfbScanlineDelta(_ptr, _y, _w) \
1145 mfbScanlineOffset(_ptr, (_y) * (_w))
1147 #define mfbScanline(_ptr, _x, _y, _w) \
1148 mfbScanlineOffset(_ptr, (_y) * (_w) + ((_x) >> MFB_PWSH))
1151 /* precomputed information about each glyph for GlyphBlt code.
1152 this saves recalculating the per glyph information for each box.
1154 typedef struct _pos{
1155 int xpos; /* xposition of glyph's origin */
1156 int xchar; /* x position mod 32 */
1161 PixelType *pdstBase; /* longword with character origin */
1162 int widthGlyph; /* width in bytes of this glyph */
1165 /* reduced raster ops for mfb */
1166 #define RROP_BLACK GXclear
1167 #define RROP_WHITE GXset
1168 #define RROP_NOP GXnoop
1169 #define RROP_INVERT GXinvert
1171 /* macros for mfbbitblt.c, mfbfillsp.c
1172 these let the code do one switch on the rop per call, rather
1173 than a switch on the rop per item (span or rectangle.)
1176 #define fnCLEAR(src, dst) (0)
1177 #define fnAND(src, dst) (src & dst)
1178 #define fnANDREVERSE(src, dst) (src & ~dst)
1179 #define fnCOPY(src, dst) (src)
1180 #define fnANDINVERTED(src, dst) (~src & dst)
1181 #define fnNOOP(src, dst) (dst)
1182 #define fnXOR(src, dst) (src ^ dst)
1183 #define fnOR(src, dst) (src | dst)
1184 #define fnNOR(src, dst) (~(src | dst))
1185 #define fnEQUIV(src, dst) (~src ^ dst)
1186 #define fnINVERT(src, dst) (~dst)
1187 #define fnORREVERSE(src, dst) (src | ~dst)
1188 #define fnCOPYINVERTED(src, dst)(~src)
1189 #define fnORINVERTED(src, dst) (~src | dst)
1190 #define fnNAND(src, dst) (~(src & dst))
1191 #define fnSET(src, dst) (~0)
1193 /* Using a "switch" statement is much faster in most cases
1194 * since the compiler can do a look-up table or multi-way branch
1195 * instruction, depending on the architecture. The result on
1196 * A Sun 3/50 is at least 2.5 times faster, assuming a uniform
1197 * distribution of RasterOp operation types.
1199 * However, doing some profiling on a running system reveals
1200 * GXcopy is the operation over 99.5% of the time and
1201 * GXxor is the next most frequent (about .4%), so we make special
1202 * checks for those first.
1204 * Note that this requires a change to the "calling sequence"
1205 * since we can't engineer a "switch" statement to have an lvalue.
1207 #define DoRop(result, alu, src, dst) \
1209 if (alu == GXcopy) \
1210 result = fnCOPY (src, dst); \
1211 else if (alu == GXxor) \
1212 result = fnXOR (src, dst); \
1217 result = fnCLEAR (src, dst); \
1220 result = fnAND (src, dst); \
1222 case GXandReverse: \
1223 result = fnANDREVERSE (src, dst); \
1225 case GXandInverted: \
1226 result = fnANDINVERTED (src, dst); \
1229 result = fnNOOP (src, dst); \
1232 result = fnOR (src, dst); \
1235 result = fnNOR (src, dst); \
1238 result = fnEQUIV (src, dst); \
1241 result = fnINVERT (src, dst); \
1244 result = fnORREVERSE (src, dst); \
1246 case GXcopyInverted: \
1247 result = fnCOPYINVERTED (src, dst); \
1249 case GXorInverted: \
1250 result = fnORINVERTED (src, dst); \
1253 result = fnNAND (src, dst); \
1256 result = fnSET (src, dst); \
1262 /* C expression fragments for various operations. These get passed in
1263 * as -D's on the compile command line. See mfb/Imakefile. This
1266 * This seems like a good place to point out that mfb's use of the
1267 * words black and white is an unfortunate misnomer. In mfb code, black
1268 * means zero, and white means one.
1270 #define MFB_OPEQ_WHITE |=
1271 #define MFB_OPEQ_BLACK &=~
1272 #define MFB_OPEQ_INVERT ^=
1273 #define MFB_EQWHOLEWORD_WHITE =~0
1274 #define MFB_EQWHOLEWORD_BLACK =0
1275 #define MFB_EQWHOLEWORD_INVERT ^=~0
1276 #define MFB_OP_WHITE /* nothing */
1277 #define MFB_OP_BLACK ~