3 Copyright (C) 1998. The XFree86 Project Inc.
5 Written by Mark Vojkovich (mvojkovi@ucsd.edu)
8 #ifdef HAVE_XORG_CONFIG_H
9 #include <xorg-config.h>
14 #include "xf86_OSproc.h"
17 #include "scrnintstr.h"
18 #include "regionstr.h"
19 #include "windowstr.h"
23 #include "pixmapstr.h"
24 #include "colormapst.h"
30 /** Screen Functions **/
32 static Bool
OverlayCloseScreen (int, ScreenPtr
);
33 static Bool
OverlayCreateGC(GCPtr pGC
);
34 static Bool
OverlayDestroyPixmap(PixmapPtr
);
35 static PixmapPtr
OverlayCreatePixmap(ScreenPtr
, int, int, int);
36 static Bool
OverlayChangeWindowAttributes(WindowPtr
, unsigned long);
37 static void OverlayPaintWindow(WindowPtr
, RegionPtr
, int);
40 static void OverlayValidateGC(GCPtr
, unsigned long, DrawablePtr
);
41 static void OverlayChangeGC(GCPtr
, unsigned long);
42 static void OverlayCopyGC(GCPtr
, unsigned long, GCPtr
);
43 static void OverlayDestroyGC(GCPtr
);
44 static void OverlayChangeClip(GCPtr
, int, pointer
, int);
45 static void OverlayDestroyClip(GCPtr
);
46 static void OverlayCopyClip(GCPtr
, GCPtr
);
49 static PixmapPtr
OverlayRefreshPixmap(PixmapPtr
);
51 static GCFuncs OverlayGCFuncs
= {
52 OverlayValidateGC
, OverlayChangeGC
,
53 OverlayCopyGC
, OverlayDestroyGC
,
54 OverlayChangeClip
, OverlayDestroyClip
,
60 static void PixmapFillSpans(DrawablePtr
, GCPtr
, int, DDXPointPtr
, int *,
62 static void PixmapSetSpans(DrawablePtr
, GCPtr
, char *, DDXPointPtr
,
64 static void PixmapPutImage(DrawablePtr
, GCPtr
, int, int, int, int, int,
66 static void PixmapPushPixels(GCPtr
, PixmapPtr
, DrawablePtr
, int, int,
68 static RegionPtr
PixmapCopyArea(DrawablePtr
, DrawablePtr
, GCPtr
, int, int,
70 static RegionPtr
PixmapCopyPlane(DrawablePtr
, DrawablePtr
, GCPtr
, int, int,
71 int, int, int, int, unsigned long);
72 static void PixmapPolyPoint(DrawablePtr
, GCPtr
, int, int, xPoint
*);
73 static void PixmapPolylines(DrawablePtr
, GCPtr
, int, int, DDXPointPtr
);
74 static void PixmapPolySegment(DrawablePtr
, GCPtr
, int, xSegment
*);
75 static void PixmapPolyRectangle(DrawablePtr
, GCPtr
, int, xRectangle
*);
76 static void PixmapPolyArc(DrawablePtr
, GCPtr
, int, xArc
*);
77 static void PixmapFillPolygon(DrawablePtr
, GCPtr
, int, int, int,
79 static void PixmapPolyFillRect(DrawablePtr
, GCPtr
, int, xRectangle
*);
80 static void PixmapPolyFillArc(DrawablePtr
, GCPtr
, int, xArc
*);
81 static int PixmapPolyText8(DrawablePtr
, GCPtr
, int, int, int, char *);
82 static int PixmapPolyText16(DrawablePtr
, GCPtr
, int, int, int,
84 static void PixmapImageText8(DrawablePtr
, GCPtr
, int, int, int, char *);
85 static void PixmapImageText16(DrawablePtr
, GCPtr
, int, int, int,
87 static void PixmapImageGlyphBlt(DrawablePtr
, GCPtr
, int, int,
88 unsigned int, CharInfoPtr
*, pointer
);
89 static void PixmapPolyGlyphBlt(DrawablePtr
, GCPtr
, int, int,
90 unsigned int, CharInfoPtr
*, pointer
);
92 static GCOps PixmapGCOps
= {
93 PixmapFillSpans
, PixmapSetSpans
,
94 PixmapPutImage
, PixmapCopyArea
,
95 PixmapCopyPlane
, PixmapPolyPoint
,
96 PixmapPolylines
, PixmapPolySegment
,
97 PixmapPolyRectangle
, PixmapPolyArc
,
98 PixmapFillPolygon
, PixmapPolyFillRect
,
99 PixmapPolyFillArc
, PixmapPolyText8
,
100 PixmapPolyText16
, PixmapImageText8
,
101 PixmapImageText16
, PixmapImageGlyphBlt
,
102 PixmapPolyGlyphBlt
, PixmapPushPixels
,
103 {NULL
} /* devPrivate */
108 static void WindowFillSpans(DrawablePtr
, GCPtr
, int, DDXPointPtr
, int *,
110 static void WindowSetSpans(DrawablePtr
, GCPtr
, char *, DDXPointPtr
,
112 static void WindowPutImage(DrawablePtr
, GCPtr
, int, int, int, int, int,
114 static void WindowPushPixels(GCPtr
, PixmapPtr
, DrawablePtr
, int, int,
116 static RegionPtr
WindowCopyArea(DrawablePtr
, DrawablePtr
, GCPtr
, int, int,
118 static RegionPtr
WindowCopyPlane(DrawablePtr
, DrawablePtr
, GCPtr
, int, int,
119 int, int, int, int, unsigned long);
120 static void WindowPolyPoint(DrawablePtr
, GCPtr
, int, int, xPoint
*);
121 static void WindowPolylines(DrawablePtr
, GCPtr
, int, int, DDXPointPtr
);
122 static void WindowPolySegment(DrawablePtr
, GCPtr
, int, xSegment
*);
123 static void WindowPolyRectangle(DrawablePtr
, GCPtr
, int, xRectangle
*);
124 static void WindowPolyArc(DrawablePtr
, GCPtr
, int, xArc
*);
125 static void WindowFillPolygon(DrawablePtr
, GCPtr
, int, int, int,
127 static void WindowPolyFillRect(DrawablePtr
, GCPtr
, int, xRectangle
*);
128 static void WindowPolyFillArc(DrawablePtr
, GCPtr
, int, xArc
*);
129 static int WindowPolyText8(DrawablePtr
, GCPtr
, int, int, int, char *);
130 static int WindowPolyText16(DrawablePtr
, GCPtr
, int, int, int,
132 static void WindowImageText8(DrawablePtr
, GCPtr
, int, int, int, char *);
133 static void WindowImageText16(DrawablePtr
, GCPtr
, int, int, int,
135 static void WindowImageGlyphBlt(DrawablePtr
, GCPtr
, int, int,
136 unsigned int, CharInfoPtr
*, pointer
);
137 static void WindowPolyGlyphBlt(DrawablePtr
, GCPtr
, int, int,
138 unsigned int, CharInfoPtr
*, pointer
);
140 static GCOps WindowGCOps
= {
141 WindowFillSpans
, WindowSetSpans
,
142 WindowPutImage
, WindowCopyArea
,
143 WindowCopyPlane
, WindowPolyPoint
,
144 WindowPolylines
, WindowPolySegment
,
145 WindowPolyRectangle
, WindowPolyArc
,
146 WindowFillPolygon
, WindowPolyFillRect
,
147 WindowPolyFillArc
, WindowPolyText8
,
148 WindowPolyText16
, WindowImageText8
,
149 WindowImageText16
, WindowImageGlyphBlt
,
150 WindowPolyGlyphBlt
, WindowPushPixels
,
151 {NULL
} /* devPrivate */
157 CloseScreenProcPtr CloseScreen
;
158 CreateGCProcPtr CreateGC
;
159 CreatePixmapProcPtr CreatePixmap
;
160 DestroyPixmapProcPtr DestroyPixmap
;
161 ChangeWindowAttributesProcPtr ChangeWindowAttributes
;
162 PaintWindowBackgroundProcPtr PaintWindowBackground
;
163 PaintWindowBorderProcPtr PaintWindowBorder
;
165 } OverlayScreenRec
, *OverlayScreenPtr
;
175 } OverlayGCRec
, *OverlayGCPtr
;
180 } OverlayPixmapRec
, *OverlayPixmapPtr
;
183 static int OverlayScreenIndex
= -1;
184 static int OverlayGCIndex
= -1;
185 static int OverlayPixmapIndex
= -1;
186 static unsigned long OverlayGeneration
= 0;
190 #define TILE_EXISTS(pGC) (!(pGC)->tileIsPixel && (pGC)->tile.pixmap)
192 #define OVERLAY_GET_PIXMAP_PRIVATE(pPix) \
193 (OverlayPixmapPtr)((pPix)->devPrivates[OverlayPixmapIndex].ptr)
195 #define OVERLAY_GET_SCREEN_PRIVATE(pScreen) \
196 (OverlayScreenPtr)((pScreen)->devPrivates[OverlayScreenIndex].ptr)
198 #define OVERLAY_GET_GC_PRIVATE(pGC) \
199 (OverlayGCPtr)((pGC)->devPrivates[OverlayGCIndex].ptr)
201 #define OVERLAY_GC_FUNC_PROLOGUE(pGC)\
202 OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\
203 (pGC)->funcs = pGCPriv->wrapFuncs;\
204 if(pGCPriv->overlayOps) \
205 (pGC)->ops = pGCPriv->wrapOps
207 #define OVERLAY_GC_FUNC_EPILOGUE(pGC)\
208 pGCPriv->wrapFuncs = (pGC)->funcs;\
209 (pGC)->funcs = &OverlayGCFuncs;\
210 if(pGCPriv->overlayOps) { \
211 pGCPriv->wrapOps = (pGC)->ops;\
212 (pGC)->ops = pGCPriv->overlayOps;\
215 #define WINDOW_GC_OP_PROLOGUE(pGC)\
216 OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE((pGC)->pScreen);\
217 OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\
218 unsigned long oldfg = (pGC)->fgPixel;\
219 unsigned long oldbg = (pGC)->bgPixel;\
220 unsigned long oldpm = (pGC)->planemask;\
221 PixmapPtr oldtile = (pGC)->tile.pixmap;\
222 (pGC)->fgPixel = pGCPriv->fg;\
223 (pGC)->bgPixel = pGCPriv->bg;\
224 (pGC)->planemask = pGCPriv->pm;\
225 if(pGCPriv->tile) (pGC)->tile.pixmap = pGCPriv->tile;\
226 (pGC)->funcs = pGCPriv->wrapFuncs;\
227 (pGC)->ops = pGCPriv->wrapOps;\
228 pScreenPriv->LockPrivate++
231 #define WINDOW_GC_OP_EPILOGUE(pGC)\
232 pGCPriv->wrapOps = (pGC)->ops;\
233 pGCPriv->wrapFuncs = (pGC)->funcs;\
234 (pGC)->fgPixel = oldfg;\
235 (pGC)->bgPixel = oldbg;\
236 (pGC)->planemask = oldpm;\
237 (pGC)->tile.pixmap = oldtile;\
238 (pGC)->funcs = &OverlayGCFuncs;\
239 (pGC)->ops = &WindowGCOps;\
240 pScreenPriv->LockPrivate--
243 #define PIXMAP_GC_OP_PROLOGUE(pGC)\
244 OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\
245 OverlayPixmapPtr pPixPriv = OVERLAY_GET_PIXMAP_PRIVATE((PixmapPtr)pDraw);\
246 pGC->funcs = pGCPriv->wrapFuncs;\
247 pGC->ops = pGCPriv->wrapOps
249 #define PIXMAP_GC_OP_EPILOGUE(pGC)\
250 pGCPriv->wrapOps = pGC->ops;\
251 pGC->funcs = &OverlayGCFuncs;\
252 pGC->ops = &PixmapGCOps;\
253 pPixPriv->dirty |= IS_DIRTY
257 xf86Overlay8Plus32Init (ScreenPtr pScreen
)
259 OverlayScreenPtr pScreenPriv
;
261 if(OverlayGeneration
!= serverGeneration
) {
262 if(((OverlayScreenIndex
= AllocateScreenPrivateIndex()) < 0) ||
263 ((OverlayGCIndex
= AllocateGCPrivateIndex()) < 0) ||
264 ((OverlayPixmapIndex
= AllocatePixmapPrivateIndex()) < 0))
267 OverlayGeneration
= serverGeneration
;
270 if (!AllocateGCPrivate(pScreen
, OverlayGCIndex
, sizeof(OverlayGCRec
)))
273 if (!AllocatePixmapPrivate(pScreen
, OverlayPixmapIndex
,
274 sizeof(OverlayPixmapRec
)))
277 if (!(pScreenPriv
= xalloc(sizeof(OverlayScreenRec
))))
280 pScreen
->devPrivates
[OverlayScreenIndex
].ptr
= (pointer
)pScreenPriv
;
282 pScreenPriv
->CreateGC
= pScreen
->CreateGC
;
283 pScreenPriv
->CloseScreen
= pScreen
->CloseScreen
;
284 pScreenPriv
->CreatePixmap
= pScreen
->CreatePixmap
;
285 pScreenPriv
->DestroyPixmap
= pScreen
->DestroyPixmap
;
286 pScreenPriv
->ChangeWindowAttributes
= pScreen
->ChangeWindowAttributes
;
287 pScreenPriv
->PaintWindowBackground
= pScreen
->PaintWindowBackground
;
288 pScreenPriv
->PaintWindowBorder
= pScreen
->PaintWindowBorder
;
290 pScreen
->CreateGC
= OverlayCreateGC
;
291 pScreen
->CloseScreen
= OverlayCloseScreen
;
292 pScreen
->CreatePixmap
= OverlayCreatePixmap
;
293 pScreen
->DestroyPixmap
= OverlayDestroyPixmap
;
294 pScreen
->ChangeWindowAttributes
= OverlayChangeWindowAttributes
;
295 pScreen
->PaintWindowBackground
= OverlayPaintWindow
;
296 pScreen
->PaintWindowBorder
= OverlayPaintWindow
;
298 pScreenPriv
->LockPrivate
= 0;
300 /* allocate the key in the default map */
301 if(pScreen
->defColormap
) {
302 ScrnInfoPtr pScrn
= xf86Screens
[pScreen
->myNum
];
306 pmap
= (ColormapPtr
)LookupIDByType(pScreen
->defColormap
, RT_COLORMAP
);
308 pmap
->red
[pScrn
->colorKey
].refcnt
= AllocPrivate
;
309 pmap
->red
[pScrn
->colorKey
].fShared
= FALSE
;
312 color
.red
= color
.blue
= color
.green
= 0;
313 color
.pixel
= pScrn
->colorKey
;
314 color
.flags
= DoRed
| DoGreen
| DoBlue
;
316 StoreColors(pmap
, 1, &color
);
323 /*********************** Screen Funcs ***********************/
326 OverlayCreateGC(GCPtr pGC
)
328 ScreenPtr pScreen
= pGC
->pScreen
;
329 OverlayGCPtr pGCPriv
= OVERLAY_GET_GC_PRIVATE(pGC
);
330 OverlayScreenPtr pScreenPriv
= OVERLAY_GET_SCREEN_PRIVATE(pScreen
);
333 pScreen
->CreateGC
= pScreenPriv
->CreateGC
;
335 if((ret
= (*pScreen
->CreateGC
)(pGC
)) && (pGC
->depth
!= 1)) {
336 pGCPriv
->wrapFuncs
= pGC
->funcs
;
337 pGC
->funcs
= &OverlayGCFuncs
;
338 pGCPriv
->wrapOps
= NULL
;
339 pGCPriv
->overlayOps
= NULL
;
340 pGCPriv
->tile
= NULL
;
343 pScreen
->CreateGC
= OverlayCreateGC
;
349 OverlayCreatePixmap(ScreenPtr pScreen
, int w
, int h
, int depth
)
351 OverlayScreenPtr pScreenPriv
= OVERLAY_GET_SCREEN_PRIVATE(pScreen
);
354 pScreen
->CreatePixmap
= pScreenPriv
->CreatePixmap
;
355 pPix
= (*pScreen
->CreatePixmap
) (pScreen
, w
, h
, depth
);
356 pScreen
->CreatePixmap
= OverlayCreatePixmap
;
358 /* We initialize all the privates */
360 OverlayPixmapPtr pPriv
= OVERLAY_GET_PIXMAP_PRIVATE(pPix
);
362 pPriv
->dirty
= IS_DIRTY
;
364 pPriv
->dirty
|= IS_SHARED
;
371 OverlayDestroyPixmap(PixmapPtr pPix
)
373 ScreenPtr pScreen
= pPix
->drawable
.pScreen
;
374 OverlayScreenPtr pScreenPriv
= OVERLAY_GET_SCREEN_PRIVATE(pScreen
);
377 pScreen
->DestroyPixmap
= pScreenPriv
->DestroyPixmap
;
379 if((pPix
->refcnt
== 1) && (pPix
->drawable
.bitsPerPixel
== 8)) {
380 OverlayPixmapPtr pPriv
= OVERLAY_GET_PIXMAP_PRIVATE(pPix
);
382 if(pPriv
->pix32
->refcnt
!= 1)
383 ErrorF("Warning! private pix refcnt = %i\n", pPriv
->pix32
->refcnt
);
384 (*pScreen
->DestroyPixmap
)(pPriv
->pix32
);
389 result
= (*pScreen
->DestroyPixmap
) (pPix
);
390 pScreen
->DestroyPixmap
= OverlayDestroyPixmap
;
396 OverlayCloseScreen (int i
, ScreenPtr pScreen
)
398 OverlayScreenPtr pScreenPriv
= OVERLAY_GET_SCREEN_PRIVATE(pScreen
);
400 pScreen
->CreateGC
= pScreenPriv
->CreateGC
;
401 pScreen
->CloseScreen
= pScreenPriv
->CloseScreen
;
402 pScreen
->CreatePixmap
= pScreenPriv
->CreatePixmap
;
403 pScreen
->DestroyPixmap
= pScreenPriv
->DestroyPixmap
;
404 pScreen
->ChangeWindowAttributes
= pScreenPriv
->ChangeWindowAttributes
;
405 pScreen
->PaintWindowBackground
= pScreenPriv
->PaintWindowBackground
;
406 pScreen
->PaintWindowBorder
= pScreenPriv
->PaintWindowBorder
;
408 xfree ((pointer
) pScreenPriv
);
410 return (*pScreen
->CloseScreen
) (i
, pScreen
);
416 OverlayChangeWindowAttributes (WindowPtr pWin
, unsigned long mask
)
418 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
419 OverlayScreenPtr pScreenPriv
= OVERLAY_GET_SCREEN_PRIVATE(pScreen
);
422 if(pWin
->drawable
.depth
== 8) {
423 if((mask
& CWBackPixmap
) &&
424 (pWin
->backgroundState
== BackgroundPixmap
))
425 OverlayRefreshPixmap(pWin
->background
.pixmap
);
427 if((mask
& CWBorderPixmap
) && !pWin
->borderIsPixel
)
428 OverlayRefreshPixmap(pWin
->border
.pixmap
);
431 pScreen
->ChangeWindowAttributes
= pScreenPriv
->ChangeWindowAttributes
;
432 result
= (*pScreen
->ChangeWindowAttributes
) (pWin
, mask
);
433 pScreen
->ChangeWindowAttributes
= OverlayChangeWindowAttributes
;
444 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
445 OverlayScreenPtr pScreenPriv
= OVERLAY_GET_SCREEN_PRIVATE(pScreen
);
446 OverlayPixmapPtr pixPriv
;
447 PixmapPtr oldPix
= NULL
;
449 if(what
== PW_BACKGROUND
) {
450 if(pWin
->drawable
.depth
== 8) {
451 if(pWin
->backgroundState
== ParentRelative
) {
454 } while (pWin
->backgroundState
== ParentRelative
);
457 if(pWin
->backgroundState
== BackgroundPixmap
) {
458 oldPix
= pWin
->background
.pixmap
;
459 pixPriv
= OVERLAY_GET_PIXMAP_PRIVATE(oldPix
);
460 /* have to do this here because alot of applications
461 incorrectly assume changes to a pixmap that is
462 a window background go into effect immediatedly */
463 if(pixPriv
->dirty
& IS_DIRTY
)
464 OverlayRefreshPixmap(pWin
->background
.pixmap
);
465 pWin
->background
.pixmap
= pixPriv
->pix32
;
469 pScreen
->PaintWindowBackground
= pScreenPriv
->PaintWindowBackground
;
470 (*pScreen
->PaintWindowBackground
) (pWin
, pReg
, what
);
471 pScreen
->PaintWindowBackground
= OverlayPaintWindow
;
474 pWin
->background
.pixmap
= oldPix
;
476 if((pWin
->drawable
.depth
== 8) && !pWin
->borderIsPixel
) {
477 oldPix
= pWin
->border
.pixmap
;
478 pixPriv
= OVERLAY_GET_PIXMAP_PRIVATE(oldPix
);
479 if(pixPriv
->dirty
& IS_DIRTY
)
480 OverlayRefreshPixmap(pWin
->border
.pixmap
);
481 pWin
->border
.pixmap
= pixPriv
->pix32
;
484 pScreen
->PaintWindowBorder
= pScreenPriv
->PaintWindowBorder
;
485 (*pScreen
->PaintWindowBorder
) (pWin
, pReg
, what
);
486 pScreen
->PaintWindowBorder
= OverlayPaintWindow
;
489 pWin
->border
.pixmap
= oldPix
;
494 /*********************** GC Funcs *****************************/
498 OverlayRefreshPixmap(PixmapPtr pix8
)
500 OverlayPixmapPtr pixPriv
= OVERLAY_GET_PIXMAP_PRIVATE(pix8
);
501 ScreenPtr pScreen
= pix8
->drawable
.pScreen
;
503 if(!pixPriv
->pix32
) {
506 newPix
= (*pScreen
->CreatePixmap
)(pScreen
, pix8
->drawable
.width
,
507 pix8
->drawable
.height
, 24);
508 newPix
->drawable
.depth
= 8; /* Bad Mark! Bad Mark! */
509 pixPriv
->pix32
= newPix
;
513 OverlayScreenPtr pScreenPriv
= OVERLAY_GET_SCREEN_PRIVATE(pScreen
);
516 pGC
= GetScratchGC(8, pScreen
);
518 pScreenPriv
->LockPrivate
++; /* don't modify this one */
519 ValidateGC((DrawablePtr
)pixPriv
->pix32
, pGC
);
521 (*pGC
->ops
->CopyArea
)((DrawablePtr
)pix8
, (DrawablePtr
)pixPriv
->pix32
,
522 pGC
, 0, 0, pix8
->drawable
.width
, pix8
->drawable
.height
, 0, 0);
523 pScreenPriv
->LockPrivate
--;
526 pixPriv
->dirty
&= ~IS_DIRTY
;
527 pixPriv
->pix32
->drawable
.serialNumber
= NEXT_SERIAL_NUMBER
;
530 return pixPriv
->pix32
;
537 unsigned long changes
,
540 OverlayScreenPtr pScreenPriv
= OVERLAY_GET_SCREEN_PRIVATE(pGC
->pScreen
);
541 OVERLAY_GC_FUNC_PROLOGUE (pGC
);
543 if(pScreenPriv
->LockPrivate
< 0) {
544 ErrorF("Something is wrong in OverlayValidateGC!\n");
545 pScreenPriv
->LockPrivate
= 0;
548 if(pGC
->depth
== 24) {
549 unsigned long oldpm
= pGC
->planemask
;
550 pGCPriv
->overlayOps
= NULL
;
552 if(pDraw
->type
== DRAWABLE_WINDOW
)
553 pGC
->planemask
&= 0x00ffffff;
555 pGC
->planemask
|= 0xff000000;
557 if(oldpm
!= pGC
->planemask
) changes
|= GCPlaneMask
;
559 (*pGC
->funcs
->ValidateGC
)(pGC
, changes
, pDraw
);
561 } else { /* depth == 8 */
562 unsigned long newChanges
= 0;
564 if(pDraw
->bitsPerPixel
== 32) {
566 if(pGC
->fillStyle
== FillTiled
)
567 pGCPriv
->tile
= OverlayRefreshPixmap(pGC
->tile
.pixmap
);
568 else pGCPriv
->tile
= NULL
;
570 if(pGCPriv
->overlayOps
!= &WindowGCOps
) {
571 newChanges
= GCForeground
| GCBackground
| GCPlaneMask
;
573 newChanges
|= GCTile
;
575 pGCPriv
->overlayOps
= &WindowGCOps
;
577 if(!pScreenPriv
->LockPrivate
) {
578 unsigned long oldfg
= pGC
->fgPixel
;
579 unsigned long oldbg
= pGC
->bgPixel
;
580 unsigned long oldpm
= pGC
->planemask
;
581 PixmapPtr oldtile
= pGC
->tile
.pixmap
;
583 pGC
->fgPixel
= pGCPriv
->fg
= oldfg
<< 24;
584 pGC
->bgPixel
= pGCPriv
->bg
= oldbg
<< 24;
585 pGC
->planemask
= pGCPriv
->pm
= oldpm
<< 24;
587 pGC
->tile
.pixmap
= pGCPriv
->tile
;
589 (*pGC
->funcs
->ValidateGC
)(pGC
, changes
| newChanges
, pDraw
);
591 pGC
->fgPixel
= oldfg
;
592 pGC
->bgPixel
= oldbg
;
593 pGC
->planemask
= oldpm
;
594 pGC
->tile
.pixmap
= oldtile
;
596 pGCPriv
->fg
= pGC
->fgPixel
;
597 pGCPriv
->bg
= pGC
->bgPixel
;
598 pGCPriv
->pm
= pGC
->planemask
;
600 (*pGC
->funcs
->ValidateGC
)(pGC
, changes
| newChanges
, pDraw
);
603 } else { /* bitsPerPixel == 8 */
604 if(pGCPriv
->overlayOps
== &WindowGCOps
) {
605 newChanges
= GCForeground
| GCBackground
| GCPlaneMask
;
607 newChanges
|= GCTile
;
609 pGCPriv
->overlayOps
= &PixmapGCOps
;
611 (*pGC
->funcs
->ValidateGC
)(pGC
, changes
| newChanges
, pDraw
);
615 OVERLAY_GC_FUNC_EPILOGUE (pGC
);
620 OverlayDestroyGC(GCPtr pGC
)
622 OVERLAY_GC_FUNC_PROLOGUE (pGC
);
623 (*pGC
->funcs
->DestroyGC
)(pGC
);
624 OVERLAY_GC_FUNC_EPILOGUE (pGC
);
632 OVERLAY_GC_FUNC_PROLOGUE (pGC
);
633 (*pGC
->funcs
->ChangeGC
) (pGC
, mask
);
634 OVERLAY_GC_FUNC_EPILOGUE (pGC
);
643 OVERLAY_GC_FUNC_PROLOGUE (pGCDst
);
644 (*pGCDst
->funcs
->CopyGC
) (pGCSrc
, mask
, pGCDst
);
645 OVERLAY_GC_FUNC_EPILOGUE (pGCDst
);
654 OVERLAY_GC_FUNC_PROLOGUE (pGC
);
655 (*pGC
->funcs
->ChangeClip
) (pGC
, type
, pvalue
, nrects
);
656 OVERLAY_GC_FUNC_EPILOGUE (pGC
);
660 OverlayCopyClip(GCPtr pgcDst
, GCPtr pgcSrc
)
662 OVERLAY_GC_FUNC_PROLOGUE (pgcDst
);
663 (* pgcDst
->funcs
->CopyClip
)(pgcDst
, pgcSrc
);
664 OVERLAY_GC_FUNC_EPILOGUE (pgcDst
);
668 OverlayDestroyClip(GCPtr pGC
)
670 OVERLAY_GC_FUNC_PROLOGUE (pGC
);
671 (* pGC
->funcs
->DestroyClip
)(pGC
);
672 OVERLAY_GC_FUNC_EPILOGUE (pGC
);
677 /******************* Window GC ops ***********************/
688 WINDOW_GC_OP_PROLOGUE(pGC
);
689 (*pGC
->ops
->FillSpans
)(pDraw
, pGC
, nInit
, pptInit
, pwidthInit
, fSorted
);
690 WINDOW_GC_OP_EPILOGUE(pGC
);
698 register DDXPointPtr ppt
,
703 WINDOW_GC_OP_PROLOGUE(pGC
);
704 (*pGC
->ops
->SetSpans
)(pDraw
, pGC
, pcharsrc
, ppt
, pwidth
, nspans
, fSorted
);
705 WINDOW_GC_OP_EPILOGUE(pGC
);
713 int x
, int y
, int w
, int h
,
718 WINDOW_GC_OP_PROLOGUE(pGC
);
719 (*pGC
->ops
->PutImage
)(pDraw
, pGC
, depth
, x
, y
, w
, h
,
720 leftPad
, format
, pImage
);
721 WINDOW_GC_OP_EPILOGUE(pGC
);
730 int width
, int height
,
735 WINDOW_GC_OP_PROLOGUE(pGC
);
736 ret
= (*pGC
->ops
->CopyArea
)(pSrc
, pDst
,
737 pGC
, srcx
, srcy
, width
, height
, dstx
, dsty
);
738 WINDOW_GC_OP_EPILOGUE(pGC
);
748 int width
, int height
,
750 unsigned long bitPlane
754 WINDOW_GC_OP_PROLOGUE(pGC
);
755 ret
= (*pGC
->ops
->CopyPlane
)(pSrc
, pDst
,
756 pGC
, srcx
, srcy
, width
, height
, dstx
, dsty
, bitPlane
);
757 WINDOW_GC_OP_EPILOGUE(pGC
);
769 WINDOW_GC_OP_PROLOGUE(pGC
);
770 (*pGC
->ops
->PolyPoint
)(pDraw
, pGC
, mode
, npt
, pptInit
);
771 WINDOW_GC_OP_EPILOGUE(pGC
);
782 WINDOW_GC_OP_PROLOGUE(pGC
);
783 (*pGC
->ops
->Polylines
)(pDraw
, pGC
, mode
, npt
, pptInit
);
784 WINDOW_GC_OP_EPILOGUE(pGC
);
794 WINDOW_GC_OP_PROLOGUE(pGC
);
795 (*pGC
->ops
->PolySegment
)(pDraw
, pGC
, nseg
, pSeg
);
796 WINDOW_GC_OP_EPILOGUE(pGC
);
804 xRectangle
*pRectsInit
806 WINDOW_GC_OP_PROLOGUE(pGC
);
807 (*pGC
->ops
->PolyRectangle
)(pDraw
, pGC
, nRectsInit
, pRectsInit
);
808 WINDOW_GC_OP_EPILOGUE(pGC
);
818 WINDOW_GC_OP_PROLOGUE(pGC
);
819 (*pGC
->ops
->PolyArc
)(pDraw
, pGC
, narcs
, parcs
);
820 WINDOW_GC_OP_EPILOGUE(pGC
);
832 WINDOW_GC_OP_PROLOGUE(pGC
);
833 (*pGC
->ops
->FillPolygon
)(pDraw
, pGC
, shape
, mode
, count
, ptsIn
);
834 WINDOW_GC_OP_EPILOGUE(pGC
);
842 xRectangle
*prectInit
844 WINDOW_GC_OP_PROLOGUE(pGC
);
845 (*pGC
->ops
->PolyFillRect
)(pDraw
, pGC
, nrectFill
, prectInit
);
846 WINDOW_GC_OP_EPILOGUE(pGC
);
856 WINDOW_GC_OP_PROLOGUE(pGC
);
857 (*pGC
->ops
->PolyFillArc
)(pDraw
, pGC
, narcs
, parcs
);
858 WINDOW_GC_OP_EPILOGUE(pGC
);
872 WINDOW_GC_OP_PROLOGUE(pGC
);
873 ret
= (*pGC
->ops
->PolyText8
)(pDraw
, pGC
, x
, y
, count
, chars
);
874 WINDOW_GC_OP_EPILOGUE(pGC
);
885 unsigned short *chars
889 WINDOW_GC_OP_PROLOGUE(pGC
);
890 ret
= (*pGC
->ops
->PolyText16
)(pDraw
, pGC
, x
, y
, count
, chars
);
891 WINDOW_GC_OP_EPILOGUE(pGC
);
904 WINDOW_GC_OP_PROLOGUE(pGC
);
905 (*pGC
->ops
->ImageText8
)(pDraw
, pGC
, x
, y
, count
, chars
);
906 WINDOW_GC_OP_EPILOGUE(pGC
);
916 unsigned short *chars
918 WINDOW_GC_OP_PROLOGUE(pGC
);
919 (*pGC
->ops
->ImageText16
)(pDraw
, pGC
, x
, y
, count
, chars
);
920 WINDOW_GC_OP_EPILOGUE(pGC
);
927 int xInit
, int yInit
,
932 WINDOW_GC_OP_PROLOGUE(pGC
);
933 (*pGC
->ops
->ImageGlyphBlt
)(pDraw
, pGC
, xInit
, yInit
, nglyph
,
935 WINDOW_GC_OP_EPILOGUE(pGC
);
942 int xInit
, int yInit
,
947 WINDOW_GC_OP_PROLOGUE(pGC
);
948 (*pGC
->ops
->PolyGlyphBlt
)(pDraw
, pGC
, xInit
, yInit
, nglyph
,
950 WINDOW_GC_OP_EPILOGUE(pGC
);
958 int dx
, int dy
, int xOrg
, int yOrg
960 WINDOW_GC_OP_PROLOGUE(pGC
);
961 (*pGC
->ops
->PushPixels
)(pGC
, pBitMap
, pDraw
, dx
, dy
, xOrg
, yOrg
);
962 WINDOW_GC_OP_EPILOGUE(pGC
);
966 /******************* Pixmap GC ops ***********************/
977 PIXMAP_GC_OP_PROLOGUE(pGC
);
978 (*pGC
->ops
->FillSpans
)(pDraw
, pGC
, nInit
, pptInit
, pwidthInit
, fSorted
);
979 PIXMAP_GC_OP_EPILOGUE(pGC
);
987 register DDXPointPtr ppt
,
992 PIXMAP_GC_OP_PROLOGUE(pGC
);
993 (*pGC
->ops
->SetSpans
)(pDraw
, pGC
, pcharsrc
, ppt
, pwidth
, nspans
, fSorted
);
994 PIXMAP_GC_OP_EPILOGUE(pGC
);
1002 int x
, int y
, int w
, int h
,
1007 PIXMAP_GC_OP_PROLOGUE(pGC
);
1008 (*pGC
->ops
->PutImage
)(pDraw
, pGC
, depth
, x
, y
, w
, h
,
1009 leftPad
, format
, pImage
);
1010 PIXMAP_GC_OP_EPILOGUE(pGC
);
1019 int width
, int height
,
1024 PIXMAP_GC_OP_PROLOGUE(pGC
);
1025 ret
= (*pGC
->ops
->CopyArea
)(pSrc
, pDraw
,
1026 pGC
, srcx
, srcy
, width
, height
, dstx
, dsty
);
1027 PIXMAP_GC_OP_EPILOGUE(pGC
);
1037 int width
, int height
,
1039 unsigned long bitPlane
1043 PIXMAP_GC_OP_PROLOGUE(pGC
);
1044 ret
= (*pGC
->ops
->CopyPlane
)(pSrc
, pDraw
,
1045 pGC
, srcx
, srcy
, width
, height
, dstx
, dsty
, bitPlane
);
1046 PIXMAP_GC_OP_EPILOGUE(pGC
);
1058 PIXMAP_GC_OP_PROLOGUE(pGC
);
1059 (*pGC
->ops
->PolyPoint
)(pDraw
, pGC
, mode
, npt
, pptInit
);
1060 PIXMAP_GC_OP_EPILOGUE(pGC
);
1071 PIXMAP_GC_OP_PROLOGUE(pGC
);
1072 (*pGC
->ops
->Polylines
)(pDraw
, pGC
, mode
, npt
, pptInit
);
1073 PIXMAP_GC_OP_EPILOGUE(pGC
);
1083 PIXMAP_GC_OP_PROLOGUE(pGC
);
1084 (*pGC
->ops
->PolySegment
)(pDraw
, pGC
, nseg
, pSeg
);
1085 PIXMAP_GC_OP_EPILOGUE(pGC
);
1089 PixmapPolyRectangle(
1093 xRectangle
*pRectsInit
1095 PIXMAP_GC_OP_PROLOGUE(pGC
);
1096 (*pGC
->ops
->PolyRectangle
)(pDraw
, pGC
, nRectsInit
, pRectsInit
);
1097 PIXMAP_GC_OP_EPILOGUE(pGC
);
1107 PIXMAP_GC_OP_PROLOGUE(pGC
);
1108 (*pGC
->ops
->PolyArc
)(pDraw
, pGC
, narcs
, parcs
);
1109 PIXMAP_GC_OP_EPILOGUE(pGC
);
1121 PIXMAP_GC_OP_PROLOGUE(pGC
);
1122 (*pGC
->ops
->FillPolygon
)(pDraw
, pGC
, shape
, mode
, count
, ptsIn
);
1123 PIXMAP_GC_OP_EPILOGUE(pGC
);
1131 xRectangle
*prectInit
1133 PIXMAP_GC_OP_PROLOGUE(pGC
);
1134 (*pGC
->ops
->PolyFillRect
)(pDraw
, pGC
, nrectFill
, prectInit
);
1135 PIXMAP_GC_OP_EPILOGUE(pGC
);
1145 PIXMAP_GC_OP_PROLOGUE(pGC
);
1146 (*pGC
->ops
->PolyFillArc
)(pDraw
, pGC
, narcs
, parcs
);
1147 PIXMAP_GC_OP_EPILOGUE(pGC
);
1161 PIXMAP_GC_OP_PROLOGUE(pGC
);
1162 ret
= (*pGC
->ops
->PolyText8
)(pDraw
, pGC
, x
, y
, count
, chars
);
1163 PIXMAP_GC_OP_EPILOGUE(pGC
);
1174 unsigned short *chars
1178 PIXMAP_GC_OP_PROLOGUE(pGC
);
1179 ret
= (*pGC
->ops
->PolyText16
)(pDraw
, pGC
, x
, y
, count
, chars
);
1180 PIXMAP_GC_OP_EPILOGUE(pGC
);
1193 PIXMAP_GC_OP_PROLOGUE(pGC
);
1194 (*pGC
->ops
->ImageText8
)(pDraw
, pGC
, x
, y
, count
, chars
);
1195 PIXMAP_GC_OP_EPILOGUE(pGC
);
1205 unsigned short *chars
1207 PIXMAP_GC_OP_PROLOGUE(pGC
);
1208 (*pGC
->ops
->ImageText16
)(pDraw
, pGC
, x
, y
, count
, chars
);
1209 PIXMAP_GC_OP_EPILOGUE(pGC
);
1213 PixmapImageGlyphBlt(
1216 int xInit
, int yInit
,
1217 unsigned int nglyph
,
1221 PIXMAP_GC_OP_PROLOGUE(pGC
);
1222 (*pGC
->ops
->ImageGlyphBlt
)(pDraw
, pGC
, xInit
, yInit
, nglyph
,
1224 PIXMAP_GC_OP_EPILOGUE(pGC
);
1231 int xInit
, int yInit
,
1232 unsigned int nglyph
,
1236 PIXMAP_GC_OP_PROLOGUE(pGC
);
1237 (*pGC
->ops
->PolyGlyphBlt
)(pDraw
, pGC
, xInit
, yInit
, nglyph
,
1239 PIXMAP_GC_OP_EPILOGUE(pGC
);
1247 int dx
, int dy
, int xOrg
, int yOrg
1249 PIXMAP_GC_OP_PROLOGUE(pGC
);
1250 (*pGC
->ops
->PushPixels
)(pGC
, pBitMap
, pDraw
, dx
, dy
, xOrg
, yOrg
);
1251 PIXMAP_GC_OP_EPILOGUE(pGC
);