2 * Copyright © 1998 Keith Packard
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Keith Packard not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. Keith Packard makes no
11 * representations about the suitability of this software for any purpose. It
12 * is provided "as is" without express or implied warranty.
14 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
23 #define FbSelectPart(xor,o,t) xor
25 #ifdef HAVE_DIX_CONFIG_H
26 #include <dix-config.h>
43 FbBits startmask
, endmask
;
45 int startbyte
, endbyte
;
48 if (bpp
== 24 && (!FbCheck24Pix(and) || !FbCheck24Pix(xor)))
50 fbSolid24 (dst
, dstStride
, dstX
, width
, height
, and, xor);
54 dst
+= dstX
>> FB_SHIFT
;
56 FbMaskBitsBytes(dstX
, width
, and == 0, startmask
, startbyte
,
57 nmiddle
, endmask
, endbyte
);
65 FbDoLeftMaskByteRRop(dst
,startbyte
,startmask
,and,xor);
75 WRITE(dst
, FbDoRRop (READ(dst
), and, xor));
79 FbDoRightMaskByteRRop(dst
,endbyte
,endmask
,and,xor);
86 fbSolid24 (FbBits
*dst
,
96 FbBits startmask
, endmask
;
97 FbBits xor0
= 0, xor1
= 0, xor2
= 0;
98 FbBits and0
= 0, and1
= 0, and2
= 0;
99 FbBits xorS
= 0, andS
= 0, xorE
= 0, andE
= 0;
103 dst
+= dstX
>> FB_SHIFT
;
106 * Rotate pixel values this far across the word to align on
107 * screen pixel boundaries
109 rot
= FbFirst24Rot (dstX
);
110 FbMaskBits (dstX
, width
, startmask
, nmiddle
, endmask
);
113 dstStride
-= nmiddle
;
116 * Precompute rotated versions of the rasterop values
119 xor = FbRot24(xor,rotS
);
120 and = FbRot24(and,rotS
);
125 xor = FbNext24Pix(xor);
126 and = FbNext24Pix(and);
133 xor1
= FbNext24Pix(xor0
);
134 and1
= FbNext24Pix(and0
);
135 xor2
= FbNext24Pix(xor1
);
136 and2
= FbNext24Pix(and1
);
141 switch (nmiddle
% 3) {
161 WRITE(dst
, FbDoMaskRRop(READ(dst
), andS
, xorS
, startmask
));
188 WRITE(dst
, FbDoRRop (READ(dst
), and0
, xor0
));
190 WRITE(dst
, FbDoRRop (READ(dst
), and1
, xor1
));
192 WRITE(dst
, FbDoRRop (READ(dst
), and2
, xor2
));
198 WRITE(dst
, FbDoRRop (READ(dst
), and0
, xor0
));
203 WRITE(dst
, FbDoRRop (READ(dst
), and1
, xor1
));
209 WRITE(dst
, FbDoMaskRRop (READ(dst
), andE
, xorE
, endmask
));