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>
30 fbPushPattern(DrawablePtr pDrawable
,
33 FbStride srcStride
, int srcX
, int x
, int y
, int width
, int height
)
35 FbStip
*s
, bitsMask
, bitsMask0
, bits
;
40 src
+= srcX
>> FB_STIP_SHIFT
;
43 bitsMask0
= FbStipMask(srcX
, 1);
53 if (bits
& bitsMask
) {
59 bitsMask
= FbStipRight(bitsMask
, 1);
62 bitsMask
= FbBitsMask(0, 1);
64 } while (bits
& bitsMask
);
65 fbFill(pDrawable
, pGC
, xspan
, y
, lenspan
, 1);
75 bitsMask
= FbStipRight(bitsMask
, 1);
78 bitsMask
= FbBitsMask(0, 1);
80 } while (!(bits
& bitsMask
));
88 fbPushFill(DrawablePtr pDrawable
,
91 FbStride srcStride
, int srcX
, int x
, int y
, int width
, int height
)
93 FbGCPrivPtr pPriv
= fbGetGCPrivate(pGC
);
95 if (pGC
->fillStyle
== FillSolid
) {
103 fbGetDrawable(pDrawable
, dst
, dstStride
, dstBpp
, dstXoff
, dstYoff
);
104 dst
= dst
+ (y
+ dstYoff
) * dstStride
;
105 dstX
= (x
+ dstXoff
) * dstBpp
;
106 dstWidth
= width
* dstBpp
;
112 FbBitsStrideToStipStride(dstStride
),
116 FbStipple1Rop(pGC
->alu
, pGC
->fgPixel
), pPriv
->pm
, dstBpp
);
128 pPriv
->and, pPriv
->xor,
129 fbAnd(GXnoop
, (FbBits
) 0, FB_ALLONES
),
130 fbXor(GXnoop
, (FbBits
) 0, FB_ALLONES
));
132 fbFinishAccess(pDrawable
);
135 fbPushPattern(pDrawable
, pGC
, src
, srcStride
, srcX
,
136 x
, y
, width
, height
);
141 fbPushImage(DrawablePtr pDrawable
,
144 FbStride srcStride
, int srcX
, int x
, int y
, int width
, int height
)
146 RegionPtr pClip
= fbGetCompositeClip(pGC
);
151 for (nbox
= RegionNumRects(pClip
),
152 pbox
= RegionRects(pClip
); nbox
--; pbox
++) {
165 if (x1
>= x2
|| y1
>= y2
)
167 fbPushFill(pDrawable
,
169 src
+ (y1
- y
) * srcStride
,
170 srcStride
, srcX
+ (x1
- x
), x1
, y1
, x2
- x1
, y2
- y1
);
175 fbPushPixels(GCPtr pGC
,
177 DrawablePtr pDrawable
, int dx
, int dy
, int xOrg
, int yOrg
)
182 _X_UNUSED
int stipXoff
, stipYoff
;
184 fbGetStipDrawable(&pBitmap
->drawable
, stip
, stipStride
, stipBpp
, stipXoff
,
187 fbPushImage(pDrawable
, pGC
, stip
, stipStride
, 0, xOrg
, yOrg
, dx
, dy
);