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>
34 int dstX
, int bpp
, int width
, int height
, FbBits
and, FbBits
xor)
36 FbBits startmask
, endmask
;
38 int startbyte
, endbyte
;
40 if (bpp
== 24 && (!FbCheck24Pix(and) || !FbCheck24Pix(xor))) {
41 fbSolid24(dst
, dstStride
, dstX
, width
, height
, and, xor);
44 dst
+= dstX
>> FB_SHIFT
;
46 FbMaskBitsBytes(dstX
, width
, and == 0, startmask
, startbyte
,
47 nmiddle
, endmask
, endbyte
);
53 FbDoLeftMaskByteRRop(dst
, startbyte
, startmask
, and, xor);
62 WRITE(dst
, FbDoRRop(READ(dst
), and, xor));
66 FbDoRightMaskByteRRop(dst
, endbyte
, endmask
, and, xor);
72 fbSolid24(FbBits
* dst
,
74 int dstX
, int width
, int height
, FbBits
and, FbBits
xor)
76 FbBits startmask
, endmask
;
77 FbBits xor0
= 0, xor1
= 0, xor2
= 0;
78 FbBits and0
= 0, and1
= 0, and2
= 0;
79 FbBits xorS
= 0, andS
= 0, xorE
= 0, andE
= 0;
83 dst
+= dstX
>> FB_SHIFT
;
86 * Rotate pixel values this far across the word to align on
87 * screen pixel boundaries
89 rot
= FbFirst24Rot(dstX
);
90 FbMaskBits(dstX
, width
, startmask
, nmiddle
, endmask
);
96 * Precompute rotated versions of the rasterop values
99 xor = FbRot24(xor, rotS
);
100 and = FbRot24(and, rotS
);
104 xor = FbNext24Pix(xor);
105 and = FbNext24Pix(and);
111 xor1
= FbNext24Pix(xor0
);
112 and1
= FbNext24Pix(and0
);
113 xor2
= FbNext24Pix(xor1
);
114 and2
= FbNext24Pix(and1
);
118 switch (nmiddle
% 3) {
136 WRITE(dst
, FbDoMaskRRop(READ(dst
), andS
, xorS
, startmask
));
157 WRITE(dst
, FbDoRRop(READ(dst
), and0
, xor0
));
159 WRITE(dst
, FbDoRRop(READ(dst
), and1
, xor1
));
161 WRITE(dst
, FbDoRRop(READ(dst
), and2
, xor2
));
166 WRITE(dst
, FbDoRRop(READ(dst
), and0
, xor0
));
170 WRITE(dst
, FbDoRRop(READ(dst
), and1
, xor1
));
176 WRITE(dst
, FbDoMaskRRop(READ(dst
), andE
, xorE
, endmask
));