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 fbFill (DrawablePtr pDrawable
,
41 FbGCPrivPtr pPriv
= fbGetGCPrivate(pGC
);
43 fbGetDrawable (pDrawable
, dst
, dstStride
, dstBpp
, dstXoff
, dstYoff
);
45 switch (pGC
->fillStyle
) {
47 #ifndef FB_ACCESS_WRAPPER
48 if (pPriv
->and || !pixman_fill ((uint32_t *)dst
, dstStride
, dstBpp
,
49 x
+ dstXoff
, y
+ dstYoff
,
53 fbSolid (dst
+ (y
+ dstYoff
) * dstStride
,
55 (x
+ dstXoff
) * dstBpp
,
57 width
* dstBpp
, height
,
58 pPriv
->and, pPriv
->xor);
61 case FillOpaqueStippled
: {
62 PixmapPtr pStip
= pGC
->stipple
;
63 int stipWidth
= pStip
->drawable
.width
;
64 int stipHeight
= pStip
->drawable
.height
;
72 int stipXoff
, stipYoff
; /* XXX assumed to be zero */
74 if (pGC
->fillStyle
== FillStippled
)
75 alu
= FbStipple1Rop(pGC
->alu
,pGC
->fgPixel
);
77 alu
= FbOpaqueStipple1Rop(pGC
->alu
,pGC
->fgPixel
,pGC
->bgPixel
);
78 fbGetDrawable (&pStip
->drawable
, stip
, stipStride
, stipBpp
, stipXoff
, stipYoff
);
79 fbTile (dst
+ (y
+ dstYoff
) * dstStride
,
91 (pGC
->patOrg
.x
+ pDrawable
->x
+ dstXoff
),
92 pGC
->patOrg
.y
+ pDrawable
->y
- y
);
93 fbFinishAccess (&pStip
->drawable
);
100 int stipXoff
, stipYoff
; /* XXX assumed to be zero */
101 FbBits fgand
, fgxor
, bgand
, bgxor
;
105 if (pGC
->fillStyle
== FillStippled
)
107 bgand
= fbAnd(GXnoop
,(FbBits
) 0,FB_ALLONES
);
108 bgxor
= fbXor(GXnoop
,(FbBits
) 0,FB_ALLONES
);
112 bgand
= pPriv
->bgand
;
113 bgxor
= pPriv
->bgxor
;
116 fbGetStipDrawable (&pStip
->drawable
, stip
, stipStride
, stipBpp
, stipXoff
, stipYoff
);
117 fbStipple (dst
+ (y
+ dstYoff
) * dstStride
,
119 (x
+ dstXoff
) * dstBpp
,
121 width
* dstBpp
, height
,
129 pGC
->patOrg
.x
+ pDrawable
->x
+ dstXoff
,
130 pGC
->patOrg
.y
+ pDrawable
->y
- y
);
131 fbFinishAccess (&pStip
->drawable
);
136 PixmapPtr pTile
= pGC
->tile
.pixmap
;
142 int tileXoff
, tileYoff
; /* XXX assumed to be zero */
144 fbGetDrawable (&pTile
->drawable
, tile
, tileStride
, tileBpp
, tileXoff
, tileYoff
);
145 tileWidth
= pTile
->drawable
.width
;
146 tileHeight
= pTile
->drawable
.height
;
147 fbTile (dst
+ (y
+ dstYoff
) * dstStride
,
149 (x
+ dstXoff
) * dstBpp
,
150 width
* dstBpp
, height
,
158 (pGC
->patOrg
.x
+ pDrawable
->x
+ dstXoff
) * dstBpp
,
159 pGC
->patOrg
.y
+ pDrawable
->y
- y
);
160 fbFinishAccess (&pTile
->drawable
);
164 fbValidateDrawable (pDrawable
);
165 fbFinishAccess (pDrawable
);
169 fbSolidBoxClipped (DrawablePtr pDrawable
,
181 int dstXoff
, dstYoff
;
184 int partX1
, partX2
, partY1
, partY2
;
186 fbGetDrawable (pDrawable
, dst
, dstStride
, dstBpp
, dstXoff
, dstYoff
);
188 for (nbox
= REGION_NUM_RECTS(pClip
), pbox
= REGION_RECTS(pClip
);
200 if (partX2
<= partX1
)
211 if (partY2
<= partY1
)
214 #ifndef FB_ACCESS_WRAPPER
215 if (and || !pixman_fill ((uint32_t *)dst
, dstStride
, dstBpp
,
216 partX1
+ dstXoff
, partY1
+ dstYoff
,
217 (partX2
- partX1
), (partY2
- partY1
),
220 fbSolid (dst
+ (partY1
+ dstYoff
) * dstStride
,
222 (partX1
+ dstXoff
) * dstBpp
,
225 (partX2
- partX1
) * dstBpp
,
229 fbFinishAccess (pDrawable
);