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 #ifdef HAVE_DIX_CONFIG_H
24 #include <dix-config.h>
29 typedef void (*FbDots
) (FbBits
* dst
,
36 int yorg
, int xoff
, int yoff
, FbBits
and, FbBits
xor);
39 fbDots(FbBits
* dstOrig
,
45 int xorg
, int yorg
, int xoff
, int yoff
, FbBits andOrig
, FbBits xorOrig
)
47 FbStip
*dst
= (FbStip
*) dstOrig
;
54 dstStride
= FbBitsStrideToStipStride(dstStride
);
63 if (x1
<= x
&& x
< x2
&& y1
<= y
&& y
< y2
) {
64 x
= (x
+ xoff
) * dstBpp
;
65 d
= dst
+ ((y
+ yoff
) * dstStride
) + (x
>> FB_STIP_SHIFT
);
68 FbStip leftMask
, rightMask
;
72 rot
= FbFirst24Rot(x
);
73 andT
= FbRot24Stip(and, rot
);
74 xorT
= FbRot24Stip(xor, rot
);
75 FbMaskStip(x
, 24, leftMask
, n
, rightMask
);
77 WRITE(d
, FbDoMaskRRop(READ(d
), andT
, xorT
, leftMask
));
78 andT
= FbNext24Stip(andT
);
79 xorT
= FbNext24Stip(xorT
);
83 WRITE(d
, FbDoMaskRRop(READ(d
), andT
, xorT
, rightMask
));
88 mask
= FbStipMask(x
, dstBpp
);
89 WRITE(d
, FbDoMaskRRop(READ(d
), and, xor, mask
));
96 fbPolyPoint(DrawablePtr pDrawable
,
97 GCPtr pGC
, int mode
, int nptInit
, xPoint
* pptInit
)
99 FbGCPrivPtr pPriv
= fbGetGCPrivate(pGC
);
100 RegionPtr pClip
= fbGetCompositeClip(pGC
);
104 int dstXoff
, dstYoff
;
112 /* make pointlist origin relative */
115 if (mode
== CoordModePrevious
) {
119 ppt
->x
+= (ppt
- 1)->x
;
120 ppt
->y
+= (ppt
- 1)->y
;
123 fbGetDrawable(pDrawable
, dst
, dstStride
, dstBpp
, dstXoff
, dstYoff
);
141 for (nBox
= RegionNumRects(pClip
), pBox
= RegionRects(pClip
);
143 (*dots
) (dst
, dstStride
, dstBpp
, pBox
, pptInit
, nptInit
,
144 pDrawable
->x
, pDrawable
->y
, dstXoff
, dstYoff
, and, xor);
145 fbFinishAccess(pDrawable
);