1
/* $XFree86: xc/programs/Xserver/ilbm/ilbm.h,v 3.2 1998/04/05 16:42:23 robin Exp $ */
2
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
3
/***********************************************************
5
Copyright (c) 1987 X Consortium
7
Permission is hereby granted, free of charge, to any person obtaining a copy
8
of this software and associated documentation files (the "Software"), to deal
9
in the Software without restriction, including without limitation the rights
10
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
copies of the Software, and to permit persons to whom the Software is
12
furnished to do so, subject to the following conditions:
14
The above copyright notice and this permission notice shall be included in
15
all copies or substantial portions of the Software.
17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
Except as contained in this notice, the name of the X Consortium shall not be
25
used in advertising or otherwise to promote the sale, use or other dealings
26
in this Software without prior written authorization from the X Consortium.
29
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
33
Permission to use, copy, modify, and distribute this software and its
34
documentation for any purpose and without fee is hereby granted,
35
provided that the above copyright notice appear in all copies and that
36
both that copyright notice and this permission notice appear in
37
supporting documentation, and that the name of Digital not be
38
used in advertising or publicity pertaining to distribution of the
39
software without specific, written prior permission.
41
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
42
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
43
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
44
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
45
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
46
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
49
******************************************************************/
50
/* $XConsortium: ilbm.h,v 5.31 94/04/17 20:28:15 dpw Exp $ */
51
/* Monochrome Frame Buffer definitions
52
written by drewry, september 1986
55
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
56
to use interleaved bitplanes instead of normal bitplanes */
62
#include "miscstruct.h"
65
extern int ilbmInverseAlu[];
66
extern int ilbmScreenPrivateIndex;
67
/* warning: PixelType definition duplicated in maskbits.h */
69
#define PixelType unsigned long
70
#endif /* PixelType */
72
#define AFB_MAX_DEPTH 8
76
extern void ilbmDoBitblt(
77
#if NeedFunctionPrototypes
81
RegionPtr /*prgnDst*/,
82
DDXPointPtr /*pptSrc*/,
83
unsigned long /*planemask*/
87
extern RegionPtr ilbmBitBlt(
88
#if NeedFunctionPrototypes
99
unsigned long /*planemask*/
103
extern RegionPtr ilbmCopyArea(
104
#if NeedFunctionPrototypes
105
DrawablePtr /*pSrcDrawable*/,
106
DrawablePtr /*pDstDrawable*/,
117
extern RegionPtr ilbmCopyPlane(
118
#if NeedFunctionPrototypes
119
DrawablePtr /*pSrcDrawable*/,
120
DrawablePtr /*pDstDrawable*/,
128
unsigned long /*plane*/
132
extern void ilbmCopy1ToN(
133
#if NeedFunctionPrototypes
134
DrawablePtr /*pSrc*/,
135
DrawablePtr /*pDst*/,
137
RegionPtr /*prgnDst*/,
138
DDXPointPtr /*pptSrc*/,
139
unsigned long /*planemask*/
144
extern void ilbmDoBitbltCopy(
145
#if NeedFunctionPrototypes
146
DrawablePtr /*pSrc*/,
147
DrawablePtr /*pDst*/,
149
RegionPtr /*prgnDst*/,
150
DDXPointPtr /*pptSrc*/,
151
unsigned long /*planemask*/
156
extern void ilbmDoBitbltCopyInverted(
157
#if NeedFunctionPrototypes
158
DrawablePtr /*pSrc*/,
159
DrawablePtr /*pDst*/,
161
RegionPtr /*prgnDst*/,
162
DDXPointPtr /*pptSrc*/,
163
unsigned long /*planemask*/
168
extern void ilbmDoBitbltGeneral(
169
#if NeedFunctionPrototypes
170
DrawablePtr /*pSrc*/,
171
DrawablePtr /*pDst*/,
173
RegionPtr /*prgnDst*/,
174
DDXPointPtr /*pptSrc*/,
175
unsigned long /*planemask*/
180
extern void ilbmDoBitbltOr(
181
#if NeedFunctionPrototypes
182
DrawablePtr /*pSrc*/,
183
DrawablePtr /*pDst*/,
185
RegionPtr /*prgnDst*/,
186
DDXPointPtr /*pptSrc*/,
187
unsigned long /*planemask*/
192
extern void ilbmDoBitbltXor(
193
#if NeedFunctionPrototypes
194
DrawablePtr /*pSrc*/,
195
DrawablePtr /*pDst*/,
197
RegionPtr /*prgnDst*/,
198
DDXPointPtr /*pptSrc*/,
199
unsigned long /*planemask*/
204
extern void ilbmBresS(
205
#if NeedFunctionPrototypes
206
PixelType * /*addrl*/,
219
unsigned char * /*rrops*/
224
extern void ilbmBresD(
225
#if NeedFunctionPrototypes
226
int * /*pdashIndex*/,
227
unsigned char * /*pDash*/,
228
int /*numInDashList*/,
229
int * /*pdashOffset*/,
230
int /*isDoubleDash*/,
231
PixelType * /*addrl*/,
244
unsigned char * /*rrops*/,
245
unsigned char * /*bgrrops*/
250
extern void ilbmSaveAreas(
251
#if NeedFunctionPrototypes
252
PixmapPtr /*pPixmap*/,
253
RegionPtr /*prgnSave*/,
260
extern void ilbmRestoreAreas(
261
#if NeedFunctionPrototypes
262
PixmapPtr /*pPixmap*/,
263
RegionPtr /*prgnRestore*/,
271
extern RegionPtr ilbmPixmapToRegion(
272
#if NeedFunctionPrototypes
279
extern Bool ilbmInitializeColormap(
280
#if NeedFunctionPrototypes
285
extern void ilbmResolveColor(
286
#if NeedFunctionPrototypes
287
unsigned short * /*pred*/,
288
unsigned short * /*pgreen*/,
289
unsigned short * /*pblue*/,
290
VisualPtr /*pVisual*/
294
extern Bool ilbmSetVisualTypes(
295
#if NeedFunctionPrototypes
304
extern void ilbmPolyFillArcSolid(
305
#if NeedFunctionPrototypes
306
DrawablePtr /*pDraw*/,
314
extern void ilbmPolyFillRect(
315
#if NeedFunctionPrototypes
316
DrawablePtr /*pDrawable*/,
319
xRectangle * /*prectInit*/
324
extern void ilbmFillPolygonSolid(
325
#if NeedFunctionPrototypes
326
DrawablePtr /*pDrawable*/,
331
DDXPointPtr /*ptsIn*/
337
extern void ilbmSolidFS(
338
#if NeedFunctionPrototypes
339
DrawablePtr /*pDrawable*/,
342
DDXPointPtr /*pptInit*/,
343
int * /*pwidthInit*/,
348
extern void ilbmStippleFS(
349
#if NeedFunctionPrototypes
350
DrawablePtr /*pDrawable*/,
353
DDXPointPtr /*pptInit*/,
354
int * /*pwidthInit*/,
359
extern void ilbmTileFS(
360
#if NeedFunctionPrototypes
361
DrawablePtr /*pDrawable*/,
364
DDXPointPtr /*pptInit*/,
365
int * /*pwidthInit*/,
370
extern void ilbmUnnaturalTileFS(
371
#if NeedFunctionPrototypes
372
DrawablePtr /*pDrawable*/,
375
DDXPointPtr /*pptInit*/,
376
int * /*pwidthInit*/,
381
extern void ilbmUnnaturalStippleFS(
382
#if NeedFunctionPrototypes
383
DrawablePtr /*pDrawable*/,
386
DDXPointPtr /*pptInit*/,
387
int * /*pwidthInit*/,
392
extern void ilbmOpaqueStippleFS(
393
#if NeedFunctionPrototypes
394
DrawablePtr /*pDrawable*/,
397
DDXPointPtr /*pptInit*/,
398
int * /*pwidthInit*/,
403
extern void ilbmUnnaturalOpaqueStippleFS(
404
#if NeedFunctionPrototypes
405
DrawablePtr /*pDrawable*/,
408
DDXPointPtr /*pptInit*/,
409
int * /*pwidthInit*/,
416
extern Bool ilbmRealizeFont(
417
#if NeedFunctionPrototypes
423
extern Bool ilbmUnrealizeFont(
424
#if NeedFunctionPrototypes
431
extern Bool ilbmCreateGC(
432
#if NeedFunctionPrototypes
437
extern void ilbmValidateGC(
438
#if NeedFunctionPrototypes
440
unsigned long /*changes*/,
441
DrawablePtr /*pDrawable*/
445
extern void ilbmDestroyGC(
446
#if NeedFunctionPrototypes
451
extern void ilbmReduceRop(
452
#if NeedFunctionPrototypes
455
unsigned long /*planemask*/,
457
unsigned char * /*rrops*/
461
extern void ilbmReduceOpaqueStipple (
462
#if NeedFunctionPrototypes
465
unsigned long /*planemask*/,
467
unsigned char * /*rrops*/
471
extern void ilbmComputeCompositeClip(
472
#if NeedFunctionPrototypes
474
DrawablePtr /*pDrawable*/
480
extern void ilbmGetSpans(
481
#if NeedFunctionPrototypes
482
DrawablePtr /*pDrawable*/,
492
extern int ilbmHorzS(
493
#if NeedFunctionPrototypes
494
PixelType * /*addrl*/,
501
unsigned char * /*rrops*/
505
extern int ilbmVertS(
506
#if NeedFunctionPrototypes
507
PixelType * /*addrl*/,
514
unsigned char * /*rrops*/
519
extern void ilbmImageGlyphBlt (
520
#if NeedFunctionPrototypes
521
DrawablePtr /*pDrawable*/,
525
unsigned int /*nglyph*/,
526
CharInfoPtr * /*ppci*/,
527
pointer /*pglyphBase*/
534
extern void ilbmPutImage(
535
#if NeedFunctionPrototypes
549
extern void ilbmGetImage(
550
#if NeedFunctionPrototypes
551
DrawablePtr /*pDrawable*/,
556
unsigned int /*format*/,
557
unsigned long /*planeMask*/,
563
extern void ilbmLineSS(
564
#if NeedFunctionPrototypes
565
DrawablePtr /*pDrawable*/,
569
DDXPointPtr /*pptInit*/
573
extern void ilbmLineSD(
574
#if NeedFunctionPrototypes
575
DrawablePtr /*pDrawable*/,
579
DDXPointPtr /*pptInit*/
585
extern void ilbmQueryBestSize(
586
#if NeedFunctionPrototypes
588
unsigned short * /*pwidth*/,
589
unsigned short * /*pheight*/,
590
ScreenPtr /*pScreen*/
595
extern void ilbmSolidFillArea(
596
#if NeedFunctionPrototypes
597
DrawablePtr /*pDraw*/,
600
unsigned char * /*rrops*/
604
extern void ilbmStippleAreaPPW(
605
#if NeedFunctionPrototypes
606
DrawablePtr /*pDraw*/,
609
PixmapPtr /*pstipple*/,
610
unsigned char * /*rrops*/
613
extern void ilbmStippleArea(
614
#if NeedFunctionPrototypes
615
DrawablePtr /*pDraw*/,
618
PixmapPtr /*pstipple*/,
621
unsigned char * /*rrops*/
626
extern void ilbmPolyGlyphBlt(
627
#if NeedFunctionPrototypes
628
DrawablePtr /*pDrawable*/,
632
unsigned int /*nglyph*/,
633
CharInfoPtr * /*ppci*/,
634
pointer /*pglyphBase*/
640
extern PixmapPtr ilbmCreatePixmap(
641
#if NeedFunctionPrototypes
642
ScreenPtr /*pScreen*/,
649
extern Bool ilbmDestroyPixmap(
650
#if NeedFunctionPrototypes
651
PixmapPtr /*pPixmap*/
655
extern PixmapPtr ilbmCopyPixmap(
656
#if NeedFunctionPrototypes
661
extern void ilbmPadPixmap(
662
#if NeedFunctionPrototypes
663
PixmapPtr /*pPixmap*/
667
extern void ilbmXRotatePixmap(
668
#if NeedFunctionPrototypes
674
extern void ilbmYRotatePixmap(
675
#if NeedFunctionPrototypes
681
extern void ilbmCopyRotatePixmap(
682
#if NeedFunctionPrototypes
683
PixmapPtr /*psrcPix*/,
684
PixmapPtr * /*ppdstPix*/,
689
extern void ilbmPaintWindow(
690
#if NeedFunctionPrototypes
692
RegionPtr /*pRegion*/,
698
extern void ilbmPolyPoint(
699
#if NeedFunctionPrototypes
700
DrawablePtr /*pDrawable*/,
709
extern void ilbmPushPixels(
710
#if NeedFunctionPrototypes
712
PixmapPtr /*pBitMap*/,
713
DrawablePtr /*pDrawable*/,
722
extern Bool ilbmCloseScreen(
723
#if NeedFunctionPrototypes
725
ScreenPtr /*pScreen*/
730
extern Bool ilbmAllocatePrivates(
731
#if NeedFunctionPrototypes
732
ScreenPtr /*pScreen*/,
738
extern Bool ilbmScreenInit(
739
#if NeedFunctionPrototypes
740
ScreenPtr /*pScreen*/,
750
extern PixmapPtr ilbmGetWindowPixmap(
751
#if NeedFunctionPrototypes
756
extern void ilbmSetWindowPixmap(
757
#if NeedFunctionPrototypes
765
extern void ilbmSegmentSS(
766
#if NeedFunctionPrototypes
767
DrawablePtr /*pDrawable*/,
774
extern void ilbmSegmentSD(
775
#if NeedFunctionPrototypes
776
DrawablePtr /*pDrawable*/,
784
extern int ilbmSetScanline(
785
#if NeedFunctionPrototypes
790
PixelType * /*psrc*/,
792
PixelType * /*pdstBase*/,
800
extern void ilbmSetSpans(
801
#if NeedFunctionPrototypes
802
DrawablePtr /*pDrawable*/,
813
extern void ilbmTEGlyphBlt(
814
#if NeedFunctionPrototypes
815
DrawablePtr /*pDrawable*/,
819
unsigned int /*nglyph*/,
820
CharInfoPtr * /*ppci*/,
821
pointer /*pglyphBase*/
826
extern void ilbmTileAreaPPWCopy(
827
#if NeedFunctionPrototypes
828
DrawablePtr /*pDraw*/,
833
unsigned long /*planemask*/
838
extern void ilbmTileAreaPPWGeneral(
839
#if NeedFunctionPrototypes
840
DrawablePtr /*pDraw*/,
845
unsigned long /*planemask*/
849
extern void ilbmTileAreaCopy(
850
#if NeedFunctionPrototypes
851
DrawablePtr /*pDraw*/,
858
unsigned long /*planemask*/
863
extern void ilbmTileAreaGeneral(
864
#if NeedFunctionPrototypes
865
DrawablePtr /*pDraw*/,
872
unsigned long /*planemask*/
876
extern void ilbmOpaqueStippleAreaPPWCopy(
877
#if NeedFunctionPrototypes
878
DrawablePtr /*pDraw*/,
883
unsigned char */*rropsOS*/,
884
unsigned long /*planemask*/
889
extern void ilbmOpaqueStippleAreaPPWGeneral(
890
#if NeedFunctionPrototypes
891
DrawablePtr /*pDraw*/,
896
unsigned char */*rropsOS*/,
897
unsigned long /*planemask*/
901
extern void ilbmOpaqueStippleAreaCopy(
902
#if NeedFunctionPrototypes
903
DrawablePtr /*pDraw*/,
910
unsigned char */*rropsOS*/,
911
unsigned long /*planemask*/
916
extern void ilbmOpaqueStippleAreaGeneral(
917
#if NeedFunctionPrototypes
918
DrawablePtr /*pDraw*/,
925
unsigned char */*rropsOS*/,
926
unsigned long /*planemask*/
932
extern Bool ilbmCreateWindow(
933
#if NeedFunctionPrototypes
938
extern Bool ilbmDestroyWindow(
939
#if NeedFunctionPrototypes
944
extern Bool ilbmMapWindow(
945
#if NeedFunctionPrototypes
946
WindowPtr /*pWindow*/
950
extern Bool ilbmPositionWindow(
951
#if NeedFunctionPrototypes
958
extern Bool ilbmUnmapWindow(
959
#if NeedFunctionPrototypes
960
WindowPtr /*pWindow*/
964
extern void ilbmCopyWindow(
965
#if NeedFunctionPrototypes
967
DDXPointRec /*ptOldOrg*/,
968
RegionPtr /*prgnSrc*/
972
extern Bool ilbmChangeWindowAttributes(
973
#if NeedFunctionPrototypes
975
unsigned long /*mask*/
980
extern void ilbmZeroPolyArcSS(
981
#if NeedFunctionPrototypes
982
DrawablePtr /*pDraw*/,
990
private field of pixmap
991
pixmap.devPrivate = (PixelType *)pointer_to_bits
992
pixmap.devKind = width_of_pixmap_in_bytes
994
private field of screen
995
a pixmap, for which we allocate storage. devPrivate is a pointer to
996
the bits in the hardware framebuffer. note that devKind can be poked to
997
make the code work for framebuffers that are wider than their
998
displayable screen (e.g. the early vsII, which displayed 960 pixels
999
across, but was 1024 in the hardware.)
1005
unsigned char rrops[AFB_MAX_DEPTH]; /* reduction of rasterop to 1 of 3 */
1006
unsigned char rropOS[AFB_MAX_DEPTH]; /* rop for opaque stipple */
1008
typedef ilbmPrivGC *ilbmPrivGCPtr;
1010
extern int ilbmGCPrivateIndex; /* index into GC private array */
1011
extern int ilbmWindowPrivateIndex; /* index into Window private array */
1012
#ifdef PIXMAP_PER_WINDOW
1013
extern int frameWindowPrivateIndex; /* index into Window private array */
1016
#define ilbmGetGCPrivate(pGC) \
1017
((ilbmPrivGC *)((pGC)->devPrivates[ilbmGCPrivateIndex].ptr))
1019
/* private field of window */
1021
unsigned char fastBorder; /* non-zero if border tile is 32 bits wide */
1022
unsigned char fastBackground;
1023
unsigned short unused; /* pad for alignment with Sun compiler */
1024
DDXPointRec oldRotate;
1025
PixmapPtr pRotatedBackground;
1026
PixmapPtr pRotatedBorder;
1029
/* Common macros for extracting drawing information */
1031
#define ilbmGetPixelWidthAuxDepthAndPointer(pDrawable, width, aux, dep, pointer) {\
1033
if ((pDrawable)->type == DRAWABLE_WINDOW) \
1034
_pPix = (PixmapPtr)(pDrawable)->pScreen->devPrivates[ilbmScreenPrivateIndex].ptr; \
1036
_pPix = (PixmapPtr)(pDrawable); \
1037
(pointer) = (PixelType *)_pPix->devPrivate.ptr; \
1038
(width) = ((int)_pPix->devKind)/sizeof(PixelType); \
1039
(dep) = _pPix->drawable.depth; \
1040
(aux) = (width)*(dep); \
1043
/* ilbm uses the following macros to calculate addresses in drawables.
1044
* To support banked framebuffers, the macros come in four flavors.
1045
* All four collapse into the same definition on unbanked devices.
1047
* ilbmScanlineFoo - calculate address and do bank switching
1048
* ilbmScanlineFooNoBankSwitch - calculate address, don't bank switch
1049
* ilbmScanlineFooSrc - calculate address, switch source bank
1050
* ilbmScanlineFooDst - calculate address, switch destination bank
1053
/* The NoBankSwitch versions are the same for banked and unbanked cases */
1055
#define ilbmScanlineIncNoBankSwitch(_ptr, _off) _ptr += (_off)
1056
#define ilbmScanlineOffsetNoBankSwitch(_ptr, _off) ((_ptr)+(_off))
1057
#define ilbmScanlineDeltaNoBankSwitch(_ptr, _y, _w) \
1058
ilbmScanlineOffsetNoBankSwitch(_ptr, (_y)*(_w))
1059
#define ilbmScanlineNoBankSwitch(_ptr, _x, _y, _w) \
1060
ilbmScanlineOffsetNoBankSwitch(_ptr, (_y)*(_w)+((_x)>>MFB_PWSH))
1062
#ifdef MFB_LINE_BANK
1064
#include "ilbmlinebank.h" /* get macro definitions from this file */
1066
#else /* !MFB_LINE_BANK - unbanked case */
1068
#define ilbmScanlineInc(_ptr, _off) ilbmScanlineIncNoBankSwitch(_ptr, _off)
1069
#define ilbmScanlineIncSrc(_ptr, _off) ilbmScanlineInc(_ptr, _off)
1070
#define ilbmScanlineIncDst(_ptr, _off) ilbmScanlineInc(_ptr, _off)
1072
#define ilbmScanlineOffset(_ptr, _off) ilbmScanlineOffsetNoBankSwitch(_ptr, _off)
1073
#define ilbmScanlineOffsetSrc(_ptr, _off) ilbmScanlineOffset(_ptr, _off)
1074
#define ilbmScanlineOffsetDst(_ptr, _off) ilbmScanlineOffset(_ptr, _off)
1076
#define ilbmScanlineSrc(_ptr, _x, _y, _w) ilbmScanline(_ptr, _x, _y, _w)
1077
#define ilbmScanlineDst(_ptr, _x, _y, _w) ilbmScanline(_ptr, _x, _y, _w)
1079
#define ilbmScanlineDeltaSrc(_ptr, _y, _w) ilbmScanlineDelta(_ptr, _y, _w)
1080
#define ilbmScanlineDeltaDst(_ptr, _y, _w) ilbmScanlineDelta(_ptr, _y, _w)
1082
#endif /* MFB_LINE_BANK */
1084
#define ilbmScanlineDelta(_ptr, _y, _w) \
1085
ilbmScanlineOffset(_ptr, (_y)*(_w))
1087
#define ilbmScanline(_ptr, _x, _y, _w) \
1088
ilbmScanlineOffset(_ptr, (_y)*(_w)+((_x)>>MFB_PWSH))
1090
/* precomputed information about each glyph for GlyphBlt code.
1091
this saves recalculating the per glyph information for each box.
1094
typedef struct _ilbmpos{
1095
int xpos; /* xposition of glyph's origin */
1096
int xchar; /* x position mod 32 */
1101
PixelType *pdstBase; /* longword with character origin */
1102
int widthGlyph; /* width in bytes of this glyph */
1105
/* reduced raster ops for ilbm */
1106
#define RROP_BLACK GXclear
1107
#define RROP_WHITE GXset
1108
#define RROP_NOP GXnoop
1109
#define RROP_INVERT GXinvert
1110
#define RROP_COPY GXcopy
1112
/* macros for ilbmbitblt.c, ilbmfillsp.c
1113
these let the code do one switch on the rop per call, rather
1114
than a switch on the rop per item (span or rectangle.)
1117
#define fnCLEAR(src, dst) (0)
1118
#define fnAND(src, dst) (src & dst)
1119
#define fnANDREVERSE(src, dst) (src & ~dst)
1120
#define fnCOPY(src, dst) (src)
1121
#define fnANDINVERTED(src, dst) (~src & dst)
1122
#define fnNOOP(src, dst) (dst)
1123
#define fnXOR(src, dst) (src ^ dst)
1124
#define fnOR(src, dst) (src | dst)
1125
#define fnNOR(src, dst) (~(src | dst))
1126
#define fnEQUIV(src, dst) (~src ^ dst)
1127
#define fnINVERT(src, dst) (~dst)
1128
#define fnORREVERSE(src, dst) (src | ~dst)
1129
#define fnCOPYINVERTED(src, dst) (~src)
1130
#define fnORINVERTED(src, dst) (~src | dst)
1131
#define fnNAND(src, dst) (~(src & dst))
1132
#define fnSET(src, dst) (~0)
1134
/* Using a "switch" statement is much faster in most cases
1135
* since the compiler can do a look-up table or multi-way branch
1136
* instruction, depending on the architecture. The result on
1137
* A Sun 3/50 is at least 2.5 times faster, assuming a uniform
1138
* distribution of RasterOp operation types.
1140
* However, doing some profiling on a running system reveals
1141
* GXcopy is the operation over 99.5% of the time and
1142
* GXxor is the next most frequent (about .4%), so we make special
1143
* checks for those first.
1145
* Note that this requires a change to the "calling sequence"
1146
* since we can't engineer a "switch" statement to have an lvalue.
1148
#define DoRop(result, alu, src, dst) \
1150
if (alu == GXcopy) \
1151
result = fnCOPY (src, dst); \
1152
else if (alu == GXxor) \
1153
result = fnXOR (src, dst); \
1157
result = fnCLEAR (src, dst); \
1160
result = fnAND (src, dst); \
1162
case GXandReverse: \
1163
result = fnANDREVERSE (src, dst); \
1165
case GXandInverted: \
1166
result = fnANDINVERTED (src, dst); \
1169
result = fnNOOP (src, dst); \
1172
result = fnOR (src, dst); \
1175
result = fnNOR (src, dst); \
1178
result = fnEQUIV (src, dst); \
1181
result = fnINVERT (src, dst); \
1184
result = fnORREVERSE (src, dst); \
1186
case GXcopyInverted: \
1187
result = fnCOPYINVERTED (src, dst); \
1189
case GXorInverted: \
1190
result = fnORINVERTED (src, dst); \
1193
result = fnNAND (src, dst); \
1196
result = fnSET (src, dst); \
1202
/* C expression fragments for various operations. These get passed in
1203
* as -D's on the compile command line. See ilbm/Imakefile. This
1206
* This seems like a good place to point out that ilbm's use of the
1207
* words black and white is an unfortunate misnomer. In ilbm code, black
1208
* means zero, and white means one.
1210
#define MFB_OPEQ_WHITE |=
1211
#define MFB_OPEQ_BLACK &=~
1212
#define MFB_OPEQ_INVERT ^=
1213
#define MFB_EQWHOLEWORD_WHITE =~0
1214
#define MFB_EQWHOLEWORD_BLACK =0
1215
#define MFB_EQWHOLEWORD_INVERT ^=~0
1216
#define MFB_OP_WHITE /* nothing */
1217
#define MFB_OP_BLACK ~