3 Copyright 1993 by Davor Matic
5 Permission to use, copy, modify, distribute, and sell this software
6 and its documentation for any purpose is hereby granted without fee,
7 provided that the above copyright notice appear in all copies and that
8 both that copyright notice and this permission notice appear in
9 supporting documentation. Davor Matic makes no representations about
10 the suitability of this software for any purpose. It is provided "as
11 is" without express or implied warranty.
15 #ifdef HAVE_XNEST_CONFIG_H
16 #include <xnest-config.h>
20 #include <X11/Xproto.h>
21 #include "regionstr.h"
22 #include <X11/fonts/fontstruct.h>
24 #include "scrnintstr.h"
25 #include "windowstr.h"
26 #include "pixmapstr.h"
41 xnestFillSpans(DrawablePtr pDrawable
, GCPtr pGC
, int nSpans
, xPoint
*pPoints
,
42 int *pWidths
, int fSorted
)
44 ErrorF("xnest warning: function xnestFillSpans not implemented\n");
48 xnestSetSpans(DrawablePtr pDrawable
, GCPtr pGC
, char *pSrc
,
49 xPoint
*pPoints
, int *pWidths
, int nSpans
, int fSorted
)
51 ErrorF("xnest warning: function xnestSetSpans not implemented\n");
55 xnestGetSpans(DrawablePtr pDrawable
, int maxWidth
, DDXPointPtr pPoints
,
56 int *pWidths
, int nSpans
, char *pBuffer
)
58 ErrorF("xnest warning: function xnestGetSpans not implemented\n");
62 xnestQueryBestSize(int class, unsigned short *pWidth
, unsigned short *pHeight
,
65 unsigned int width
, height
;
70 XQueryBestSize(xnestDisplay
, class,
71 xnestDefaultWindows
[pScreen
->myNum
],
72 width
, height
, &width
, &height
);
79 xnestPutImage(DrawablePtr pDrawable
, GCPtr pGC
, int depth
, int x
, int y
,
80 int w
, int h
, int leftPad
, int format
, char *pImage
)
84 ximage
= XCreateImage(xnestDisplay
, xnestDefaultVisual(pDrawable
->pScreen
),
85 depth
, format
, leftPad
, (char *)pImage
,
86 w
, h
, BitmapPad(xnestDisplay
),
88 PixmapBytePad(w
, depth
) : BitmapBytePad(w
+leftPad
));
91 XPutImage(xnestDisplay
, xnestDrawable(pDrawable
), xnestGC(pGC
),
92 ximage
, 0, 0, x
, y
, w
, h
);
98 xnestGetImage(DrawablePtr pDrawable
, int x
, int y
, int w
, int h
,
99 unsigned int format
, unsigned long planeMask
,
105 ximage
= XGetImage(xnestDisplay
, xnestDrawable(pDrawable
),
106 x
, y
, w
, h
, planeMask
, format
);
109 length
= ximage
->bytes_per_line
* ximage
->height
;
111 memmove(pImage
, ximage
->data
, length
);
113 XDestroyImage(ximage
);
118 xnestBitBlitPredicate(Display
*display
, XEvent
*event
, char *args
)
120 return (event
->type
== GraphicsExpose
|| event
->type
== NoExpose
);
124 xnestBitBlitHelper(GCPtr pGC
)
126 if (!pGC
->graphicsExposures
)
130 RegionPtr pReg
, pTmpReg
;
132 Bool pending
, overlap
;
134 pReg
= REGION_CREATE(pGC
->pScreen
, NULL
, 1);
135 pTmpReg
= REGION_CREATE(pGC
->pScreen
, NULL
, 1);
136 if(!pReg
|| !pTmpReg
) return NullRegion
;
140 XIfEvent(xnestDisplay
, &event
, xnestBitBlitPredicate
, NULL
);
142 switch (event
.type
) {
148 Box
.x1
= event
.xgraphicsexpose
.x
;
149 Box
.y1
= event
.xgraphicsexpose
.y
;
150 Box
.x2
= event
.xgraphicsexpose
.x
+ event
.xgraphicsexpose
.width
;
151 Box
.y2
= event
.xgraphicsexpose
.y
+ event
.xgraphicsexpose
.height
;
152 REGION_RESET(pGC
->pScreen
, pTmpReg
, &Box
);
153 REGION_APPEND(pGC
->pScreen
, pReg
, pTmpReg
);
154 pending
= event
.xgraphicsexpose
.count
;
159 REGION_DESTROY(pGC
->pScreen
, pTmpReg
);
160 REGION_VALIDATE(pGC
->pScreen
, pReg
, &overlap
);
166 xnestCopyArea(DrawablePtr pSrcDrawable
, DrawablePtr pDstDrawable
,
167 GCPtr pGC
, int srcx
, int srcy
, int width
, int height
,
170 XCopyArea(xnestDisplay
,
171 xnestDrawable(pSrcDrawable
), xnestDrawable(pDstDrawable
),
172 xnestGC(pGC
), srcx
, srcy
, width
, height
, dstx
, dsty
);
174 return xnestBitBlitHelper(pGC
);
178 xnestCopyPlane(DrawablePtr pSrcDrawable
, DrawablePtr pDstDrawable
,
179 GCPtr pGC
, int srcx
, int srcy
, int width
, int height
,
180 int dstx
, int dsty
, unsigned long plane
)
182 XCopyPlane(xnestDisplay
,
183 xnestDrawable(pSrcDrawable
), xnestDrawable(pDstDrawable
),
184 xnestGC(pGC
), srcx
, srcy
, width
, height
, dstx
, dsty
, plane
);
186 return xnestBitBlitHelper(pGC
);
190 xnestPolyPoint(DrawablePtr pDrawable
, GCPtr pGC
, int mode
, int nPoints
,
193 XDrawPoints(xnestDisplay
, xnestDrawable(pDrawable
), xnestGC(pGC
),
194 (XPoint
*)pPoints
, nPoints
, mode
);
198 xnestPolylines(DrawablePtr pDrawable
, GCPtr pGC
, int mode
, int nPoints
,
201 XDrawLines(xnestDisplay
, xnestDrawable(pDrawable
), xnestGC(pGC
),
202 (XPoint
*)pPoints
, nPoints
, mode
);
206 xnestPolySegment(DrawablePtr pDrawable
, GCPtr pGC
, int nSegments
,
209 XDrawSegments(xnestDisplay
, xnestDrawable(pDrawable
), xnestGC(pGC
),
210 (XSegment
*)pSegments
, nSegments
);
214 xnestPolyRectangle(DrawablePtr pDrawable
, GCPtr pGC
, int nRectangles
,
215 xRectangle
*pRectangles
)
217 XDrawRectangles(xnestDisplay
, xnestDrawable(pDrawable
), xnestGC(pGC
),
218 (XRectangle
*)pRectangles
, nRectangles
);
222 xnestPolyArc(DrawablePtr pDrawable
, GCPtr pGC
, int nArcs
, xArc
*pArcs
)
224 XDrawArcs(xnestDisplay
, xnestDrawable(pDrawable
), xnestGC(pGC
),
225 (XArc
*)pArcs
, nArcs
);
229 xnestFillPolygon(DrawablePtr pDrawable
, GCPtr pGC
, int shape
, int mode
,
230 int nPoints
, DDXPointPtr pPoints
)
232 XFillPolygon(xnestDisplay
, xnestDrawable(pDrawable
), xnestGC(pGC
),
233 (XPoint
*)pPoints
, nPoints
, shape
, mode
);
237 xnestPolyFillRect(DrawablePtr pDrawable
, GCPtr pGC
, int nRectangles
,
238 xRectangle
*pRectangles
)
240 XFillRectangles(xnestDisplay
, xnestDrawable(pDrawable
), xnestGC(pGC
),
241 (XRectangle
*)pRectangles
, nRectangles
);
245 xnestPolyFillArc(DrawablePtr pDrawable
, GCPtr pGC
, int nArcs
, xArc
*pArcs
)
247 XFillArcs(xnestDisplay
, xnestDrawable(pDrawable
), xnestGC(pGC
),
248 (XArc
*)pArcs
, nArcs
);
252 xnestPolyText8(DrawablePtr pDrawable
, GCPtr pGC
, int x
, int y
, int count
,
257 XDrawString(xnestDisplay
, xnestDrawable(pDrawable
), xnestGC(pGC
),
258 x
, y
, string
, count
);
260 width
= XTextWidth(xnestFontStruct(pGC
->font
), string
, count
);
266 xnestPolyText16(DrawablePtr pDrawable
, GCPtr pGC
, int x
, int y
, int count
,
267 unsigned short *string
)
271 XDrawString16(xnestDisplay
, xnestDrawable(pDrawable
), xnestGC(pGC
),
272 x
, y
, (XChar2b
*)string
, count
);
274 width
= XTextWidth16(xnestFontStruct(pGC
->font
), (XChar2b
*)string
, count
);
280 xnestImageText8(DrawablePtr pDrawable
, GCPtr pGC
, int x
, int y
, int count
,
283 XDrawImageString(xnestDisplay
, xnestDrawable(pDrawable
), xnestGC(pGC
),
284 x
, y
, string
, count
);
288 xnestImageText16(DrawablePtr pDrawable
, GCPtr pGC
, int x
, int y
, int count
,
289 unsigned short *string
)
291 XDrawImageString16(xnestDisplay
, xnestDrawable(pDrawable
), xnestGC(pGC
),
292 x
, y
, (XChar2b
*)string
, count
);
296 xnestImageGlyphBlt(DrawablePtr pDrawable
, GCPtr pGC
, int x
, int y
,
297 unsigned int nGlyphs
, CharInfoPtr
*pCharInfo
,
300 ErrorF("xnest warning: function xnestImageGlyphBlt not implemented\n");
304 xnestPolyGlyphBlt(DrawablePtr pDrawable
, GCPtr pGC
, int x
, int y
,
305 unsigned int nGlyphs
, CharInfoPtr
*pCharInfo
,
308 ErrorF("xnest warning: function xnestPolyGlyphBlt not implemented\n");
312 xnestPushPixels(GCPtr pGC
, PixmapPtr pBitmap
, DrawablePtr pDst
,
313 int width
, int height
, int x
, int y
)
315 /* only works for solid bitmaps */
316 if (pGC
->fillStyle
== FillSolid
)
318 XSetStipple (xnestDisplay
, xnestGC(pGC
), xnestPixmap(pBitmap
));
319 XSetTSOrigin (xnestDisplay
, xnestGC(pGC
), x
, y
);
320 XSetFillStyle (xnestDisplay
, xnestGC(pGC
), FillStippled
);
321 XFillRectangle (xnestDisplay
, xnestDrawable(pDst
),
322 xnestGC(pGC
), x
, y
, width
, height
);
323 XSetFillStyle (xnestDisplay
, xnestGC(pGC
), FillSolid
);
326 ErrorF("xnest warning: function xnestPushPixels not implemented\n");