xref: /OK3568_Linux_fs/external/xserver/hw/dmx/dmxgcops.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * All Rights Reserved.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * Permission is hereby granted, free of charge, to any person obtaining
7*4882a593Smuzhiyun  * a copy of this software and associated documentation files (the
8*4882a593Smuzhiyun  * "Software"), to deal in the Software without restriction, including
9*4882a593Smuzhiyun  * without limitation on the rights to use, copy, modify, merge,
10*4882a593Smuzhiyun  * publish, distribute, sublicense, and/or sell copies of the Software,
11*4882a593Smuzhiyun  * and to permit persons to whom the Software is furnished to do so,
12*4882a593Smuzhiyun  * subject to the following conditions:
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  * The above copyright notice and this permission notice (including the
15*4882a593Smuzhiyun  * next paragraph) shall be included in all copies or substantial
16*4882a593Smuzhiyun  * portions of the Software.
17*4882a593Smuzhiyun  *
18*4882a593Smuzhiyun  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19*4882a593Smuzhiyun  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20*4882a593Smuzhiyun  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21*4882a593Smuzhiyun  * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
22*4882a593Smuzhiyun  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23*4882a593Smuzhiyun  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24*4882a593Smuzhiyun  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25*4882a593Smuzhiyun  * SOFTWARE.
26*4882a593Smuzhiyun  */
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun /*
29*4882a593Smuzhiyun  * Authors:
30*4882a593Smuzhiyun  *   Kevin E. Martin <kem@redhat.com>
31*4882a593Smuzhiyun  *
32*4882a593Smuzhiyun  */
33*4882a593Smuzhiyun 
34*4882a593Smuzhiyun /** \file
35*4882a593Smuzhiyun  * This file provides support for GC operations. */
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun #ifdef HAVE_DMX_CONFIG_H
38*4882a593Smuzhiyun #include <dmx-config.h>
39*4882a593Smuzhiyun #endif
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun #include "dmx.h"
42*4882a593Smuzhiyun #include "dmxsync.h"
43*4882a593Smuzhiyun #include "dmxgc.h"
44*4882a593Smuzhiyun #include "dmxgcops.h"
45*4882a593Smuzhiyun #include "dmxwindow.h"
46*4882a593Smuzhiyun #include "dmxpixmap.h"
47*4882a593Smuzhiyun 
48*4882a593Smuzhiyun #include "mi.h"
49*4882a593Smuzhiyun #include "gcstruct.h"
50*4882a593Smuzhiyun #include "pixmapstr.h"
51*4882a593Smuzhiyun #include "dixfontstr.h"
52*4882a593Smuzhiyun 
53*4882a593Smuzhiyun #ifdef PANORAMIX
54*4882a593Smuzhiyun #include "panoramiXsrv.h"
55*4882a593Smuzhiyun #endif
56*4882a593Smuzhiyun 
57*4882a593Smuzhiyun #define DMX_GCOPS_SET_DRAWABLE(_pDraw, _draw)				\
58*4882a593Smuzhiyun do {									\
59*4882a593Smuzhiyun     if ((_pDraw)->type == DRAWABLE_WINDOW) {				\
60*4882a593Smuzhiyun 	dmxWinPrivPtr  pWinPriv =					\
61*4882a593Smuzhiyun 	    DMX_GET_WINDOW_PRIV((WindowPtr)(_pDraw));			\
62*4882a593Smuzhiyun 	(_draw) = (Drawable)pWinPriv->window;				\
63*4882a593Smuzhiyun     } else {								\
64*4882a593Smuzhiyun 	dmxPixPrivPtr  pPixPriv =					\
65*4882a593Smuzhiyun 	    DMX_GET_PIXMAP_PRIV((PixmapPtr)(_pDraw));			\
66*4882a593Smuzhiyun 	(_draw) = (Drawable)pPixPriv->pixmap;				\
67*4882a593Smuzhiyun     }									\
68*4882a593Smuzhiyun } while (0)
69*4882a593Smuzhiyun 
70*4882a593Smuzhiyun #define DMX_GCOPS_OFFSCREEN(_pDraw)					\
71*4882a593Smuzhiyun     (!dmxScreens[(_pDraw)->pScreen->myNum].beDisplay ||			\
72*4882a593Smuzhiyun      (dmxOffScreenOpt &&						\
73*4882a593Smuzhiyun       (_pDraw)->type == DRAWABLE_WINDOW &&				\
74*4882a593Smuzhiyun       (DMX_GET_WINDOW_PRIV((WindowPtr)(_pDraw))->offscreen ||		\
75*4882a593Smuzhiyun        !DMX_GET_WINDOW_PRIV((WindowPtr)(_pDraw))->window)))
76*4882a593Smuzhiyun 
77*4882a593Smuzhiyun /** Fill spans -- this function should never be called. */
78*4882a593Smuzhiyun void
dmxFillSpans(DrawablePtr pDrawable,GCPtr pGC,int nInit,DDXPointPtr pptInit,int * pwidthInit,int fSorted)79*4882a593Smuzhiyun dmxFillSpans(DrawablePtr pDrawable, GCPtr pGC,
80*4882a593Smuzhiyun              int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted)
81*4882a593Smuzhiyun {
82*4882a593Smuzhiyun     /* Error -- this should never happen! */
83*4882a593Smuzhiyun }
84*4882a593Smuzhiyun 
85*4882a593Smuzhiyun /** Set spans -- this function should never be called. */
86*4882a593Smuzhiyun void
dmxSetSpans(DrawablePtr pDrawable,GCPtr pGC,char * psrc,DDXPointPtr ppt,int * pwidth,int nspans,int fSorted)87*4882a593Smuzhiyun dmxSetSpans(DrawablePtr pDrawable, GCPtr pGC,
88*4882a593Smuzhiyun             char *psrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
89*4882a593Smuzhiyun {
90*4882a593Smuzhiyun     /* Error -- this should never happen! */
91*4882a593Smuzhiyun }
92*4882a593Smuzhiyun 
93*4882a593Smuzhiyun /** Transfer \a pBits image to back-end server associated with \a
94*4882a593Smuzhiyun  *  pDrawable's screen.  If primitive subdivision optimization is
95*4882a593Smuzhiyun  *  enabled, then only transfer the sections of \a pBits that are
96*4882a593Smuzhiyun  *  visible (i.e., not-clipped) to the back-end server. */
97*4882a593Smuzhiyun void
dmxPutImage(DrawablePtr pDrawable,GCPtr pGC,int depth,int x,int y,int w,int h,int leftPad,int format,char * pBits)98*4882a593Smuzhiyun dmxPutImage(DrawablePtr pDrawable, GCPtr pGC,
99*4882a593Smuzhiyun             int depth, int x, int y, int w, int h,
100*4882a593Smuzhiyun             int leftPad, int format, char *pBits)
101*4882a593Smuzhiyun {
102*4882a593Smuzhiyun     DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
103*4882a593Smuzhiyun     dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
104*4882a593Smuzhiyun     XImage *img;
105*4882a593Smuzhiyun 
106*4882a593Smuzhiyun     if (DMX_GCOPS_OFFSCREEN(pDrawable))
107*4882a593Smuzhiyun         return;
108*4882a593Smuzhiyun 
109*4882a593Smuzhiyun     img = XCreateImage(dmxScreen->beDisplay,
110*4882a593Smuzhiyun                        dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
111*4882a593Smuzhiyun                        depth, format, leftPad, pBits, w, h,
112*4882a593Smuzhiyun                        BitmapPad(dmxScreen->beDisplay),
113*4882a593Smuzhiyun                        (format == ZPixmap) ?
114*4882a593Smuzhiyun                        PixmapBytePad(w, depth) : BitmapBytePad(w + leftPad));
115*4882a593Smuzhiyun 
116*4882a593Smuzhiyun     if (img) {
117*4882a593Smuzhiyun         Drawable draw;
118*4882a593Smuzhiyun 
119*4882a593Smuzhiyun         DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
120*4882a593Smuzhiyun 
121*4882a593Smuzhiyun         if (dmxSubdividePrimitives && pGC->pCompositeClip) {
122*4882a593Smuzhiyun             RegionPtr pSubImages;
123*4882a593Smuzhiyun             RegionPtr pClip;
124*4882a593Smuzhiyun             BoxRec box;
125*4882a593Smuzhiyun             BoxPtr pBox;
126*4882a593Smuzhiyun             int nBox;
127*4882a593Smuzhiyun 
128*4882a593Smuzhiyun             box.x1 = x;
129*4882a593Smuzhiyun             box.y1 = y;
130*4882a593Smuzhiyun             box.x2 = x + w;
131*4882a593Smuzhiyun             box.y2 = y + h;
132*4882a593Smuzhiyun             pSubImages = RegionCreate(&box, 1);
133*4882a593Smuzhiyun 
134*4882a593Smuzhiyun             pClip = RegionCreate(NullBox, 1);
135*4882a593Smuzhiyun             RegionCopy(pClip, pGC->pCompositeClip);
136*4882a593Smuzhiyun             RegionTranslate(pClip, -pDrawable->x, -pDrawable->y);
137*4882a593Smuzhiyun             RegionIntersect(pSubImages, pSubImages, pClip);
138*4882a593Smuzhiyun 
139*4882a593Smuzhiyun             nBox = RegionNumRects(pSubImages);
140*4882a593Smuzhiyun             pBox = RegionRects(pSubImages);
141*4882a593Smuzhiyun 
142*4882a593Smuzhiyun             while (nBox--) {
143*4882a593Smuzhiyun                 XPutImage(dmxScreen->beDisplay, draw, pGCPriv->gc, img,
144*4882a593Smuzhiyun                           pBox->x1 - box.x1,
145*4882a593Smuzhiyun                           pBox->y1 - box.y1,
146*4882a593Smuzhiyun                           pBox->x1,
147*4882a593Smuzhiyun                           pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1);
148*4882a593Smuzhiyun                 pBox++;
149*4882a593Smuzhiyun             }
150*4882a593Smuzhiyun             RegionDestroy(pClip);
151*4882a593Smuzhiyun             RegionDestroy(pSubImages);
152*4882a593Smuzhiyun         }
153*4882a593Smuzhiyun         else {
154*4882a593Smuzhiyun             XPutImage(dmxScreen->beDisplay, draw, pGCPriv->gc,
155*4882a593Smuzhiyun                       img, 0, 0, x, y, w, h);
156*4882a593Smuzhiyun         }
157*4882a593Smuzhiyun         XFree(img);             /* Use XFree instead of XDestroyImage
158*4882a593Smuzhiyun                                  * because pBits is passed in from the
159*4882a593Smuzhiyun                                  * caller. */
160*4882a593Smuzhiyun 
161*4882a593Smuzhiyun         dmxSync(dmxScreen, FALSE);
162*4882a593Smuzhiyun     }
163*4882a593Smuzhiyun     else {
164*4882a593Smuzhiyun         /* Error -- this should not happen! */
165*4882a593Smuzhiyun     }
166*4882a593Smuzhiyun }
167*4882a593Smuzhiyun 
168*4882a593Smuzhiyun /** Copy area from \a pSrc drawable to \a pDst drawable on the back-end
169*4882a593Smuzhiyun  *  server associated with \a pSrc drawable's screen.  If the offscreen
170*4882a593Smuzhiyun  *  optimization is enabled, only copy when both \a pSrc and \a pDst are
171*4882a593Smuzhiyun  *  at least partially visible. */
172*4882a593Smuzhiyun RegionPtr
dmxCopyArea(DrawablePtr pSrc,DrawablePtr pDst,GCPtr pGC,int srcx,int srcy,int w,int h,int dstx,int dsty)173*4882a593Smuzhiyun dmxCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
174*4882a593Smuzhiyun             int srcx, int srcy, int w, int h, int dstx, int dsty)
175*4882a593Smuzhiyun {
176*4882a593Smuzhiyun     DMXScreenInfo *dmxScreen = &dmxScreens[pSrc->pScreen->myNum];
177*4882a593Smuzhiyun     dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
178*4882a593Smuzhiyun     Drawable srcDraw, dstDraw;
179*4882a593Smuzhiyun 
180*4882a593Smuzhiyun     if (DMX_GCOPS_OFFSCREEN(pSrc) || DMX_GCOPS_OFFSCREEN(pDst))
181*4882a593Smuzhiyun         return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, w, h,
182*4882a593Smuzhiyun                                  dstx, dsty);
183*4882a593Smuzhiyun 
184*4882a593Smuzhiyun     DMX_GCOPS_SET_DRAWABLE(pSrc, srcDraw);
185*4882a593Smuzhiyun     DMX_GCOPS_SET_DRAWABLE(pDst, dstDraw);
186*4882a593Smuzhiyun 
187*4882a593Smuzhiyun     XCopyArea(dmxScreen->beDisplay, srcDraw, dstDraw, pGCPriv->gc,
188*4882a593Smuzhiyun               srcx, srcy, w, h, dstx, dsty);
189*4882a593Smuzhiyun     dmxSync(dmxScreen, FALSE);
190*4882a593Smuzhiyun 
191*4882a593Smuzhiyun     return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
192*4882a593Smuzhiyun }
193*4882a593Smuzhiyun 
194*4882a593Smuzhiyun /** Copy plane number \a bitPlane from \a pSrc drawable to \a pDst
195*4882a593Smuzhiyun  *  drawable on the back-end server associated with \a pSrc drawable's
196*4882a593Smuzhiyun  *  screen.  If the offscreen optimization is enabled, only copy when
197*4882a593Smuzhiyun  *  both \a pSrc and \a pDst are at least partially visible. */
198*4882a593Smuzhiyun RegionPtr
dmxCopyPlane(DrawablePtr pSrc,DrawablePtr pDst,GCPtr pGC,int srcx,int srcy,int width,int height,int dstx,int dsty,unsigned long bitPlane)199*4882a593Smuzhiyun dmxCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
200*4882a593Smuzhiyun              int srcx, int srcy, int width, int height,
201*4882a593Smuzhiyun              int dstx, int dsty, unsigned long bitPlane)
202*4882a593Smuzhiyun {
203*4882a593Smuzhiyun     DMXScreenInfo *dmxScreen = &dmxScreens[pSrc->pScreen->myNum];
204*4882a593Smuzhiyun     dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
205*4882a593Smuzhiyun     Drawable srcDraw, dstDraw;
206*4882a593Smuzhiyun 
207*4882a593Smuzhiyun     if (DMX_GCOPS_OFFSCREEN(pSrc) || DMX_GCOPS_OFFSCREEN(pDst))
208*4882a593Smuzhiyun         return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, width, height,
209*4882a593Smuzhiyun                                  dstx, dsty);
210*4882a593Smuzhiyun 
211*4882a593Smuzhiyun     DMX_GCOPS_SET_DRAWABLE(pSrc, srcDraw);
212*4882a593Smuzhiyun     DMX_GCOPS_SET_DRAWABLE(pDst, dstDraw);
213*4882a593Smuzhiyun 
214*4882a593Smuzhiyun     XCopyPlane(dmxScreen->beDisplay, srcDraw, dstDraw, pGCPriv->gc,
215*4882a593Smuzhiyun                srcx, srcy, width, height, dstx, dsty, bitPlane);
216*4882a593Smuzhiyun     dmxSync(dmxScreen, FALSE);
217*4882a593Smuzhiyun 
218*4882a593Smuzhiyun     return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, width, height,
219*4882a593Smuzhiyun                              dstx, dsty);
220*4882a593Smuzhiyun }
221*4882a593Smuzhiyun 
222*4882a593Smuzhiyun /** Render list of points, \a pptInit in \a pDrawable on the back-end
223*4882a593Smuzhiyun  *  server associated with \a pDrawable's screen.  If the offscreen
224*4882a593Smuzhiyun  *  optimization is enabled, only draw when \a pDrawable is at least
225*4882a593Smuzhiyun  *  partially visible. */
226*4882a593Smuzhiyun void
dmxPolyPoint(DrawablePtr pDrawable,GCPtr pGC,int mode,int npt,DDXPointPtr pptInit)227*4882a593Smuzhiyun dmxPolyPoint(DrawablePtr pDrawable, GCPtr pGC,
228*4882a593Smuzhiyun              int mode, int npt, DDXPointPtr pptInit)
229*4882a593Smuzhiyun {
230*4882a593Smuzhiyun     DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
231*4882a593Smuzhiyun     dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
232*4882a593Smuzhiyun     Drawable draw;
233*4882a593Smuzhiyun 
234*4882a593Smuzhiyun     if (DMX_GCOPS_OFFSCREEN(pDrawable))
235*4882a593Smuzhiyun         return;
236*4882a593Smuzhiyun 
237*4882a593Smuzhiyun     DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
238*4882a593Smuzhiyun 
239*4882a593Smuzhiyun     XDrawPoints(dmxScreen->beDisplay, draw, pGCPriv->gc,
240*4882a593Smuzhiyun                 (XPoint *) pptInit, npt, mode);
241*4882a593Smuzhiyun     dmxSync(dmxScreen, FALSE);
242*4882a593Smuzhiyun }
243*4882a593Smuzhiyun 
244*4882a593Smuzhiyun /** Render list of connected lines, \a pptInit in \a pDrawable on the
245*4882a593Smuzhiyun  *  back-end server associated with \a pDrawable's screen.  If the
246*4882a593Smuzhiyun  *  offscreen optimization is enabled, only draw when \a pDrawable is at
247*4882a593Smuzhiyun  *  least partially visible. */
248*4882a593Smuzhiyun void
dmxPolylines(DrawablePtr pDrawable,GCPtr pGC,int mode,int npt,DDXPointPtr pptInit)249*4882a593Smuzhiyun dmxPolylines(DrawablePtr pDrawable, GCPtr pGC,
250*4882a593Smuzhiyun              int mode, int npt, DDXPointPtr pptInit)
251*4882a593Smuzhiyun {
252*4882a593Smuzhiyun     DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
253*4882a593Smuzhiyun     dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
254*4882a593Smuzhiyun     Drawable draw;
255*4882a593Smuzhiyun 
256*4882a593Smuzhiyun     if (DMX_GCOPS_OFFSCREEN(pDrawable))
257*4882a593Smuzhiyun         return;
258*4882a593Smuzhiyun 
259*4882a593Smuzhiyun     DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
260*4882a593Smuzhiyun 
261*4882a593Smuzhiyun     XDrawLines(dmxScreen->beDisplay, draw, pGCPriv->gc,
262*4882a593Smuzhiyun                (XPoint *) pptInit, npt, mode);
263*4882a593Smuzhiyun     dmxSync(dmxScreen, FALSE);
264*4882a593Smuzhiyun }
265*4882a593Smuzhiyun 
266*4882a593Smuzhiyun /** Render list of disjoint segments, \a pSegs in \a pDrawable on the
267*4882a593Smuzhiyun  *  back-end server associated with \a pDrawable's screen.  If the
268*4882a593Smuzhiyun  *  offscreen optimization is enabled, only draw when \a pDrawable is at
269*4882a593Smuzhiyun  *  least partially visible. */
270*4882a593Smuzhiyun void
dmxPolySegment(DrawablePtr pDrawable,GCPtr pGC,int nseg,xSegment * pSegs)271*4882a593Smuzhiyun dmxPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSegs)
272*4882a593Smuzhiyun {
273*4882a593Smuzhiyun     DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
274*4882a593Smuzhiyun     dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
275*4882a593Smuzhiyun     Drawable draw;
276*4882a593Smuzhiyun 
277*4882a593Smuzhiyun     if (DMX_GCOPS_OFFSCREEN(pDrawable))
278*4882a593Smuzhiyun         return;
279*4882a593Smuzhiyun 
280*4882a593Smuzhiyun     DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
281*4882a593Smuzhiyun 
282*4882a593Smuzhiyun     XDrawSegments(dmxScreen->beDisplay, draw, pGCPriv->gc,
283*4882a593Smuzhiyun                   (XSegment *) pSegs, nseg);
284*4882a593Smuzhiyun     dmxSync(dmxScreen, FALSE);
285*4882a593Smuzhiyun }
286*4882a593Smuzhiyun 
287*4882a593Smuzhiyun /** Render list of rectangle outlines, \a pRects in \a pDrawable on the
288*4882a593Smuzhiyun  *  back-end server associated with \a pDrawable's screen.  If the
289*4882a593Smuzhiyun  *  offscreen optimization is enabled, only draw when \a pDrawable is at
290*4882a593Smuzhiyun  *  least partially visible. */
291*4882a593Smuzhiyun void
dmxPolyRectangle(DrawablePtr pDrawable,GCPtr pGC,int nrects,xRectangle * pRects)292*4882a593Smuzhiyun dmxPolyRectangle(DrawablePtr pDrawable, GCPtr pGC,
293*4882a593Smuzhiyun                  int nrects, xRectangle *pRects)
294*4882a593Smuzhiyun {
295*4882a593Smuzhiyun     DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
296*4882a593Smuzhiyun     dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
297*4882a593Smuzhiyun     Drawable draw;
298*4882a593Smuzhiyun 
299*4882a593Smuzhiyun     if (DMX_GCOPS_OFFSCREEN(pDrawable))
300*4882a593Smuzhiyun         return;
301*4882a593Smuzhiyun 
302*4882a593Smuzhiyun     DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
303*4882a593Smuzhiyun 
304*4882a593Smuzhiyun     XDrawRectangles(dmxScreen->beDisplay, draw, pGCPriv->gc,
305*4882a593Smuzhiyun                     (XRectangle *) pRects, nrects);
306*4882a593Smuzhiyun 
307*4882a593Smuzhiyun     dmxSync(dmxScreen, FALSE);
308*4882a593Smuzhiyun }
309*4882a593Smuzhiyun 
310*4882a593Smuzhiyun /** Render list of arc outlines, \a parcs in \a pDrawable on the
311*4882a593Smuzhiyun  *  back-end server associated with \a pDrawable's screen.  If the
312*4882a593Smuzhiyun  *  offscreen optimization is enabled, only draw when \a pDrawable is at
313*4882a593Smuzhiyun  *  least partially visible. */
314*4882a593Smuzhiyun void
dmxPolyArc(DrawablePtr pDrawable,GCPtr pGC,int narcs,xArc * parcs)315*4882a593Smuzhiyun dmxPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs)
316*4882a593Smuzhiyun {
317*4882a593Smuzhiyun     DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
318*4882a593Smuzhiyun     dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
319*4882a593Smuzhiyun     Drawable draw;
320*4882a593Smuzhiyun 
321*4882a593Smuzhiyun     if (DMX_GCOPS_OFFSCREEN(pDrawable))
322*4882a593Smuzhiyun         return;
323*4882a593Smuzhiyun 
324*4882a593Smuzhiyun     DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
325*4882a593Smuzhiyun 
326*4882a593Smuzhiyun     XDrawArcs(dmxScreen->beDisplay, draw, pGCPriv->gc, (XArc *) parcs, narcs);
327*4882a593Smuzhiyun     dmxSync(dmxScreen, FALSE);
328*4882a593Smuzhiyun }
329*4882a593Smuzhiyun 
330*4882a593Smuzhiyun /** Render a filled polygons in \a pDrawable on the back-end server
331*4882a593Smuzhiyun  *  associated with \a pDrawable's screen.  If the offscreen
332*4882a593Smuzhiyun  *  optimization is enabled, only draw when \a pDrawable is at least
333*4882a593Smuzhiyun  *  partially visible. */
334*4882a593Smuzhiyun void
dmxFillPolygon(DrawablePtr pDrawable,GCPtr pGC,int shape,int mode,int count,DDXPointPtr pPts)335*4882a593Smuzhiyun dmxFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
336*4882a593Smuzhiyun                int shape, int mode, int count, DDXPointPtr pPts)
337*4882a593Smuzhiyun {
338*4882a593Smuzhiyun     DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
339*4882a593Smuzhiyun     dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
340*4882a593Smuzhiyun     Drawable draw;
341*4882a593Smuzhiyun 
342*4882a593Smuzhiyun     if (DMX_GCOPS_OFFSCREEN(pDrawable))
343*4882a593Smuzhiyun         return;
344*4882a593Smuzhiyun 
345*4882a593Smuzhiyun     DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
346*4882a593Smuzhiyun 
347*4882a593Smuzhiyun     XFillPolygon(dmxScreen->beDisplay, draw, pGCPriv->gc,
348*4882a593Smuzhiyun                  (XPoint *) pPts, count, shape, mode);
349*4882a593Smuzhiyun     dmxSync(dmxScreen, FALSE);
350*4882a593Smuzhiyun }
351*4882a593Smuzhiyun 
352*4882a593Smuzhiyun /** Render list of filled rectangles, \a prectInit in \a pDrawable on
353*4882a593Smuzhiyun  *  the back-end server associated with \a pDrawable's screen.  If the
354*4882a593Smuzhiyun  *  offscreen optimization is enabled, only draw when \a pDrawable is at
355*4882a593Smuzhiyun  *  least partially visible. */
356*4882a593Smuzhiyun void
dmxPolyFillRect(DrawablePtr pDrawable,GCPtr pGC,int nrectFill,xRectangle * prectInit)357*4882a593Smuzhiyun dmxPolyFillRect(DrawablePtr pDrawable, GCPtr pGC,
358*4882a593Smuzhiyun                 int nrectFill, xRectangle *prectInit)
359*4882a593Smuzhiyun {
360*4882a593Smuzhiyun     DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
361*4882a593Smuzhiyun     dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
362*4882a593Smuzhiyun     Drawable draw;
363*4882a593Smuzhiyun 
364*4882a593Smuzhiyun     if (DMX_GCOPS_OFFSCREEN(pDrawable))
365*4882a593Smuzhiyun         return;
366*4882a593Smuzhiyun 
367*4882a593Smuzhiyun     DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
368*4882a593Smuzhiyun 
369*4882a593Smuzhiyun     XFillRectangles(dmxScreen->beDisplay, draw, pGCPriv->gc,
370*4882a593Smuzhiyun                     (XRectangle *) prectInit, nrectFill);
371*4882a593Smuzhiyun     dmxSync(dmxScreen, FALSE);
372*4882a593Smuzhiyun }
373*4882a593Smuzhiyun 
374*4882a593Smuzhiyun /** Render list of filled arcs, \a parcs in \a pDrawable on the back-end
375*4882a593Smuzhiyun  *  server associated with \a pDrawable's screen.  If the offscreen
376*4882a593Smuzhiyun  *  optimization is enabled, only draw when \a pDrawable is at least
377*4882a593Smuzhiyun  *  partially visible. */
378*4882a593Smuzhiyun void
dmxPolyFillArc(DrawablePtr pDrawable,GCPtr pGC,int narcs,xArc * parcs)379*4882a593Smuzhiyun dmxPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs)
380*4882a593Smuzhiyun {
381*4882a593Smuzhiyun     DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
382*4882a593Smuzhiyun     dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
383*4882a593Smuzhiyun     Drawable draw;
384*4882a593Smuzhiyun 
385*4882a593Smuzhiyun     if (DMX_GCOPS_OFFSCREEN(pDrawable))
386*4882a593Smuzhiyun         return;
387*4882a593Smuzhiyun 
388*4882a593Smuzhiyun     DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
389*4882a593Smuzhiyun 
390*4882a593Smuzhiyun     XFillArcs(dmxScreen->beDisplay, draw, pGCPriv->gc, (XArc *) parcs, narcs);
391*4882a593Smuzhiyun     dmxSync(dmxScreen, FALSE);
392*4882a593Smuzhiyun }
393*4882a593Smuzhiyun 
394*4882a593Smuzhiyun /** Render string of 8-bit \a chars (foreground only) in \a pDrawable on
395*4882a593Smuzhiyun  *  the back-end server associated with \a pDrawable's screen.  If the
396*4882a593Smuzhiyun  *  offscreen optimization is enabled, only draw when \a pDrawable is at
397*4882a593Smuzhiyun  *  least partially visible. */
398*4882a593Smuzhiyun int
dmxPolyText8(DrawablePtr pDrawable,GCPtr pGC,int x,int y,int count,char * chars)399*4882a593Smuzhiyun dmxPolyText8(DrawablePtr pDrawable, GCPtr pGC,
400*4882a593Smuzhiyun              int x, int y, int count, char *chars)
401*4882a593Smuzhiyun {
402*4882a593Smuzhiyun     DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
403*4882a593Smuzhiyun     dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
404*4882a593Smuzhiyun     unsigned long n, i;
405*4882a593Smuzhiyun     int w;
406*4882a593Smuzhiyun     CharInfoPtr charinfo[255];
407*4882a593Smuzhiyun     Drawable draw;
408*4882a593Smuzhiyun 
409*4882a593Smuzhiyun     GetGlyphs(pGC->font, (unsigned long) count, (unsigned char *) chars,
410*4882a593Smuzhiyun               Linear8Bit, &n, charinfo);
411*4882a593Smuzhiyun 
412*4882a593Smuzhiyun     /* Calculate text width */
413*4882a593Smuzhiyun     w = 0;
414*4882a593Smuzhiyun     for (i = 0; i < n; i++)
415*4882a593Smuzhiyun         w += charinfo[i]->metrics.characterWidth;
416*4882a593Smuzhiyun 
417*4882a593Smuzhiyun     if (n != 0 && !DMX_GCOPS_OFFSCREEN(pDrawable)) {
418*4882a593Smuzhiyun         DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
419*4882a593Smuzhiyun 
420*4882a593Smuzhiyun         XDrawString(dmxScreen->beDisplay, draw, pGCPriv->gc,
421*4882a593Smuzhiyun                     x, y, chars, count);
422*4882a593Smuzhiyun         dmxSync(dmxScreen, FALSE);
423*4882a593Smuzhiyun     }
424*4882a593Smuzhiyun 
425*4882a593Smuzhiyun     return x + w;
426*4882a593Smuzhiyun }
427*4882a593Smuzhiyun 
428*4882a593Smuzhiyun /** Render string of 16-bit \a chars (foreground only) in \a pDrawable
429*4882a593Smuzhiyun  *  on the back-end server associated with \a pDrawable's screen.  If
430*4882a593Smuzhiyun  *  the offscreen optimization is enabled, only draw when \a pDrawable
431*4882a593Smuzhiyun  *  is at least partially visible. */
432*4882a593Smuzhiyun int
dmxPolyText16(DrawablePtr pDrawable,GCPtr pGC,int x,int y,int count,unsigned short * chars)433*4882a593Smuzhiyun dmxPolyText16(DrawablePtr pDrawable, GCPtr pGC,
434*4882a593Smuzhiyun               int x, int y, int count, unsigned short *chars)
435*4882a593Smuzhiyun {
436*4882a593Smuzhiyun     DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
437*4882a593Smuzhiyun     dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
438*4882a593Smuzhiyun     unsigned long n, i;
439*4882a593Smuzhiyun     int w;
440*4882a593Smuzhiyun     CharInfoPtr charinfo[255];
441*4882a593Smuzhiyun     Drawable draw;
442*4882a593Smuzhiyun 
443*4882a593Smuzhiyun     GetGlyphs(pGC->font, (unsigned long) count, (unsigned char *) chars,
444*4882a593Smuzhiyun               (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
445*4882a593Smuzhiyun               &n, charinfo);
446*4882a593Smuzhiyun 
447*4882a593Smuzhiyun     /* Calculate text width */
448*4882a593Smuzhiyun     w = 0;
449*4882a593Smuzhiyun     for (i = 0; i < n; i++)
450*4882a593Smuzhiyun         w += charinfo[i]->metrics.characterWidth;
451*4882a593Smuzhiyun 
452*4882a593Smuzhiyun     if (n != 0 && !DMX_GCOPS_OFFSCREEN(pDrawable)) {
453*4882a593Smuzhiyun         DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
454*4882a593Smuzhiyun 
455*4882a593Smuzhiyun         XDrawString16(dmxScreen->beDisplay, draw, pGCPriv->gc,
456*4882a593Smuzhiyun                       x, y, (XChar2b *) chars, count);
457*4882a593Smuzhiyun         dmxSync(dmxScreen, FALSE);
458*4882a593Smuzhiyun     }
459*4882a593Smuzhiyun 
460*4882a593Smuzhiyun     return x + w;
461*4882a593Smuzhiyun }
462*4882a593Smuzhiyun 
463*4882a593Smuzhiyun /** Render string of 8-bit \a chars (both foreground and background) in
464*4882a593Smuzhiyun  *  \a pDrawable on the back-end server associated with \a pDrawable's
465*4882a593Smuzhiyun  *  screen.  If the offscreen optimization is enabled, only draw when \a
466*4882a593Smuzhiyun  *  pDrawable is at least partially visible. */
467*4882a593Smuzhiyun void
dmxImageText8(DrawablePtr pDrawable,GCPtr pGC,int x,int y,int count,char * chars)468*4882a593Smuzhiyun dmxImageText8(DrawablePtr pDrawable, GCPtr pGC,
469*4882a593Smuzhiyun               int x, int y, int count, char *chars)
470*4882a593Smuzhiyun {
471*4882a593Smuzhiyun     DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
472*4882a593Smuzhiyun     dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
473*4882a593Smuzhiyun     Drawable draw;
474*4882a593Smuzhiyun 
475*4882a593Smuzhiyun     if (DMX_GCOPS_OFFSCREEN(pDrawable))
476*4882a593Smuzhiyun         return;
477*4882a593Smuzhiyun 
478*4882a593Smuzhiyun     DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
479*4882a593Smuzhiyun 
480*4882a593Smuzhiyun     XDrawImageString(dmxScreen->beDisplay, draw, pGCPriv->gc,
481*4882a593Smuzhiyun                      x, y, chars, count);
482*4882a593Smuzhiyun     dmxSync(dmxScreen, FALSE);
483*4882a593Smuzhiyun }
484*4882a593Smuzhiyun 
485*4882a593Smuzhiyun /** Render string of 16-bit \a chars (both foreground and background) in
486*4882a593Smuzhiyun  *  \a pDrawable on the back-end server associated with \a pDrawable's
487*4882a593Smuzhiyun  *  screen.  If the offscreen optimization is enabled, only draw when \a
488*4882a593Smuzhiyun  *  pDrawable is at least partially visible. */
489*4882a593Smuzhiyun void
dmxImageText16(DrawablePtr pDrawable,GCPtr pGC,int x,int y,int count,unsigned short * chars)490*4882a593Smuzhiyun dmxImageText16(DrawablePtr pDrawable, GCPtr pGC,
491*4882a593Smuzhiyun                int x, int y, int count, unsigned short *chars)
492*4882a593Smuzhiyun {
493*4882a593Smuzhiyun     DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
494*4882a593Smuzhiyun     dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
495*4882a593Smuzhiyun     Drawable draw;
496*4882a593Smuzhiyun 
497*4882a593Smuzhiyun     if (DMX_GCOPS_OFFSCREEN(pDrawable))
498*4882a593Smuzhiyun         return;
499*4882a593Smuzhiyun 
500*4882a593Smuzhiyun     DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
501*4882a593Smuzhiyun 
502*4882a593Smuzhiyun     XDrawImageString16(dmxScreen->beDisplay, draw, pGCPriv->gc,
503*4882a593Smuzhiyun                        x, y, (XChar2b *) chars, count);
504*4882a593Smuzhiyun     dmxSync(dmxScreen, FALSE);
505*4882a593Smuzhiyun }
506*4882a593Smuzhiyun 
507*4882a593Smuzhiyun /** Image Glyph Blt -- this function should never be called. */
508*4882a593Smuzhiyun void
dmxImageGlyphBlt(DrawablePtr pDrawable,GCPtr pGC,int x,int y,unsigned int nglyph,CharInfoPtr * ppci,void * pglyphBase)509*4882a593Smuzhiyun dmxImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
510*4882a593Smuzhiyun                  int x, int y, unsigned int nglyph,
511*4882a593Smuzhiyun                  CharInfoPtr * ppci, void *pglyphBase)
512*4882a593Smuzhiyun {
513*4882a593Smuzhiyun     /* Error -- this should never happen! */
514*4882a593Smuzhiyun }
515*4882a593Smuzhiyun 
516*4882a593Smuzhiyun /** Poly Glyph Blt -- this function should never be called. */
517*4882a593Smuzhiyun void
dmxPolyGlyphBlt(DrawablePtr pDrawable,GCPtr pGC,int x,int y,unsigned int nglyph,CharInfoPtr * ppci,void * pglyphBase)518*4882a593Smuzhiyun dmxPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
519*4882a593Smuzhiyun                 int x, int y, unsigned int nglyph,
520*4882a593Smuzhiyun                 CharInfoPtr * ppci, void *pglyphBase)
521*4882a593Smuzhiyun {
522*4882a593Smuzhiyun     /* Error -- this should never happen! */
523*4882a593Smuzhiyun }
524*4882a593Smuzhiyun 
525*4882a593Smuzhiyun /** Push Pixels -- this function should never be called. */
526*4882a593Smuzhiyun void
dmxPushPixels(GCPtr pGC,PixmapPtr pBitMap,DrawablePtr pDst,int w,int h,int x,int y)527*4882a593Smuzhiyun dmxPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
528*4882a593Smuzhiyun               int w, int h, int x, int y)
529*4882a593Smuzhiyun {
530*4882a593Smuzhiyun     /* Error -- this should never happen! */
531*4882a593Smuzhiyun }
532*4882a593Smuzhiyun 
533*4882a593Smuzhiyun /**********************************************************************
534*4882a593Smuzhiyun  * Miscellaneous drawing commands
535*4882a593Smuzhiyun  */
536*4882a593Smuzhiyun 
537*4882a593Smuzhiyun /** When Xinerama is active, the client pixmaps are always obtained from
538*4882a593Smuzhiyun  * screen 0.  When screen 0 is detached, the pixmaps must be obtained
539*4882a593Smuzhiyun  * from any other screen that is not detached.  Usually, this is screen
540*4882a593Smuzhiyun  * 1. */
541*4882a593Smuzhiyun static DMXScreenInfo *
dmxFindAlternatePixmap(DrawablePtr pDrawable,XID * draw)542*4882a593Smuzhiyun dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw)
543*4882a593Smuzhiyun {
544*4882a593Smuzhiyun #ifdef PANORAMIX
545*4882a593Smuzhiyun     PanoramiXRes *pXinPix;
546*4882a593Smuzhiyun     int i;
547*4882a593Smuzhiyun     DMXScreenInfo *dmxScreen;
548*4882a593Smuzhiyun 
549*4882a593Smuzhiyun     if (noPanoramiXExtension)
550*4882a593Smuzhiyun         return NULL;
551*4882a593Smuzhiyun     if (pDrawable->type != DRAWABLE_PIXMAP)
552*4882a593Smuzhiyun         return NULL;
553*4882a593Smuzhiyun 
554*4882a593Smuzhiyun     if (Success != dixLookupResourceByType((void **) &pXinPix,
555*4882a593Smuzhiyun                                            pDrawable->id, XRT_PIXMAP,
556*4882a593Smuzhiyun                                            NullClient, DixUnknownAccess))
557*4882a593Smuzhiyun         return NULL;
558*4882a593Smuzhiyun 
559*4882a593Smuzhiyun     FOR_NSCREENS_FORWARD_SKIP(i) {
560*4882a593Smuzhiyun         dmxScreen = &dmxScreens[i];
561*4882a593Smuzhiyun         if (dmxScreen->beDisplay) {
562*4882a593Smuzhiyun             PixmapPtr pSrc;
563*4882a593Smuzhiyun             dmxPixPrivPtr pSrcPriv;
564*4882a593Smuzhiyun 
565*4882a593Smuzhiyun             dixLookupResourceByType((void **) &pSrc, pXinPix->info[i].id,
566*4882a593Smuzhiyun                                     RT_PIXMAP, NullClient, DixUnknownAccess);
567*4882a593Smuzhiyun             pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
568*4882a593Smuzhiyun             if (pSrcPriv->pixmap) {
569*4882a593Smuzhiyun                 *draw = pSrcPriv->pixmap;
570*4882a593Smuzhiyun                 return dmxScreen;
571*4882a593Smuzhiyun             }
572*4882a593Smuzhiyun         }
573*4882a593Smuzhiyun     }
574*4882a593Smuzhiyun #endif
575*4882a593Smuzhiyun     return NULL;
576*4882a593Smuzhiyun }
577*4882a593Smuzhiyun 
578*4882a593Smuzhiyun /** Get an image from the back-end server associated with \a pDrawable's
579*4882a593Smuzhiyun  *  screen.  If \a pDrawable is a window, it must be viewable to get an
580*4882a593Smuzhiyun  *  image from it.  If it is not viewable, then get the image from the
581*4882a593Smuzhiyun  *  first ancestor of \a pDrawable that is viewable.  If no viewable
582*4882a593Smuzhiyun  *  ancestor is found, then simply return without getting an image.  */
583*4882a593Smuzhiyun void
dmxGetImage(DrawablePtr pDrawable,int sx,int sy,int w,int h,unsigned int format,unsigned long planeMask,char * pdstLine)584*4882a593Smuzhiyun dmxGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
585*4882a593Smuzhiyun             unsigned int format, unsigned long planeMask, char *pdstLine)
586*4882a593Smuzhiyun {
587*4882a593Smuzhiyun     DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
588*4882a593Smuzhiyun     XImage *img;
589*4882a593Smuzhiyun     Drawable draw;
590*4882a593Smuzhiyun 
591*4882a593Smuzhiyun     /* Cannot get image from unviewable window */
592*4882a593Smuzhiyun     if (pDrawable->type == DRAWABLE_WINDOW) {
593*4882a593Smuzhiyun         WindowPtr pWindow = (WindowPtr) pDrawable;
594*4882a593Smuzhiyun 
595*4882a593Smuzhiyun         if (!pWindow->viewable) {
596*4882a593Smuzhiyun             while (!pWindow->viewable && pWindow->parent) {
597*4882a593Smuzhiyun                 sx += pWindow->origin.x - wBorderWidth(pWindow);
598*4882a593Smuzhiyun                 sx += pWindow->origin.y - wBorderWidth(pWindow);
599*4882a593Smuzhiyun                 pWindow = pWindow->parent;
600*4882a593Smuzhiyun             }
601*4882a593Smuzhiyun             if (!pWindow->viewable) {
602*4882a593Smuzhiyun                 return;
603*4882a593Smuzhiyun             }
604*4882a593Smuzhiyun         }
605*4882a593Smuzhiyun         DMX_GCOPS_SET_DRAWABLE(&pWindow->drawable, draw);
606*4882a593Smuzhiyun         if (DMX_GCOPS_OFFSCREEN(&pWindow->drawable))
607*4882a593Smuzhiyun             return;
608*4882a593Smuzhiyun     }
609*4882a593Smuzhiyun     else {
610*4882a593Smuzhiyun         DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
611*4882a593Smuzhiyun         if (DMX_GCOPS_OFFSCREEN(pDrawable)) {
612*4882a593Smuzhiyun             /* Try to find the pixmap on a non-detached Xinerama screen */
613*4882a593Smuzhiyun             dmxScreen = dmxFindAlternatePixmap(pDrawable, &draw);
614*4882a593Smuzhiyun             if (!dmxScreen)
615*4882a593Smuzhiyun                 return;
616*4882a593Smuzhiyun         }
617*4882a593Smuzhiyun     }
618*4882a593Smuzhiyun 
619*4882a593Smuzhiyun     img = XGetImage(dmxScreen->beDisplay, draw,
620*4882a593Smuzhiyun                     sx, sy, w, h, planeMask, format);
621*4882a593Smuzhiyun     if (img) {
622*4882a593Smuzhiyun         int len = img->bytes_per_line * img->height;
623*4882a593Smuzhiyun 
624*4882a593Smuzhiyun         memmove(pdstLine, img->data, len);
625*4882a593Smuzhiyun         XDestroyImage(img);
626*4882a593Smuzhiyun     }
627*4882a593Smuzhiyun 
628*4882a593Smuzhiyun     dmxSync(dmxScreen, FALSE);
629*4882a593Smuzhiyun }
630*4882a593Smuzhiyun 
631*4882a593Smuzhiyun /** Get Spans -- this function should never be called. */
632*4882a593Smuzhiyun void
dmxGetSpans(DrawablePtr pDrawable,int wMax,DDXPointPtr ppt,int * pwidth,int nspans,char * pdstStart)633*4882a593Smuzhiyun dmxGetSpans(DrawablePtr pDrawable, int wMax,
634*4882a593Smuzhiyun             DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart)
635*4882a593Smuzhiyun {
636*4882a593Smuzhiyun     /* Error -- this should never happen! */
637*4882a593Smuzhiyun }
638