~ubuntu-branches/ubuntu/intrepid/xserver-xgl/intrepid

« back to all changes in this revision

Viewing changes to hw/xfree86/xf8_32bpp/xf86overlay.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-02-13 14:21:43 UTC
  • Revision ID: james.westby@ubuntu.com-20060213142143-mad6z9xzem7hzxz9
Tags: upstream-7.0.0
ImportĀ upstreamĀ versionĀ 7.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_32bpp/xf86overlay.c,v 1.8 2000/03/25 20:14:43 mvojkovi Exp $ */
 
2
 
 
3
/*
 
4
   Copyright (C) 1998.  The XFree86 Project Inc.
 
5
 
 
6
   Written by Mark Vojkovich (mvojkovi@ucsd.edu)
 
7
*/
 
8
 
 
9
#ifdef HAVE_XORG_CONFIG_H
 
10
#include <xorg-config.h>
 
11
#endif
 
12
 
 
13
#include "misc.h"
 
14
#include "xf86.h"
 
15
#include "xf86_ansic.h"
 
16
#include "xf86_OSproc.h"
 
17
 
 
18
#include <X11/X.h>
 
19
#include "scrnintstr.h"
 
20
#include "regionstr.h"
 
21
#include "windowstr.h"
 
22
#include "xf86str.h"
 
23
#include "migc.h"
 
24
#include "gcstruct.h"
 
25
#include "pixmapstr.h"
 
26
#include "colormapst.h"
 
27
#include "cfb8_32.h"
 
28
 
 
29
#define IS_DIRTY        1
 
30
#define IS_SHARED       2
 
31
 
 
32
/** Screen Functions **/
 
33
 
 
34
static Bool OverlayCloseScreen (int, ScreenPtr);
 
35
static Bool OverlayCreateGC(GCPtr pGC);
 
36
static Bool OverlayDestroyPixmap(PixmapPtr);
 
37
static PixmapPtr OverlayCreatePixmap(ScreenPtr, int, int, int);
 
38
static Bool OverlayChangeWindowAttributes(WindowPtr, unsigned long);
 
39
static void OverlayPaintWindow(WindowPtr, RegionPtr, int);
 
40
 
 
41
/** Funcs **/
 
42
static void OverlayValidateGC(GCPtr, unsigned long, DrawablePtr);
 
43
static void OverlayChangeGC(GCPtr, unsigned long);
 
44
static void OverlayCopyGC(GCPtr, unsigned long, GCPtr);
 
45
static void OverlayDestroyGC(GCPtr);
 
46
static void OverlayChangeClip(GCPtr, int, pointer, int);
 
47
static void OverlayDestroyClip(GCPtr);
 
48
static void OverlayCopyClip(GCPtr, GCPtr);
 
49
 
 
50
 
 
51
static PixmapPtr OverlayRefreshPixmap(PixmapPtr);
 
52
 
 
53
static GCFuncs OverlayGCFuncs = {
 
54
   OverlayValidateGC, OverlayChangeGC, 
 
55
   OverlayCopyGC, OverlayDestroyGC,
 
56
   OverlayChangeClip, OverlayDestroyClip, 
 
57
   OverlayCopyClip
 
58
};
 
59
 
 
60
 
 
61
/** Pixmap Ops */
 
62
static void      PixmapFillSpans(DrawablePtr, GCPtr, int, DDXPointPtr, int *,
 
63
                                  int);
 
64
static void      PixmapSetSpans(DrawablePtr, GCPtr, char *, DDXPointPtr,
 
65
                                 int *, int, int);
 
66
static void      PixmapPutImage(DrawablePtr, GCPtr, int, int, int, int, int,
 
67
                                 int, int, char *);
 
68
static void      PixmapPushPixels(GCPtr, PixmapPtr, DrawablePtr, int, int,
 
69
                                   int, int);
 
70
static RegionPtr PixmapCopyArea(DrawablePtr, DrawablePtr, GCPtr, int, int,
 
71
                                 int, int, int, int);
 
72
static RegionPtr PixmapCopyPlane(DrawablePtr, DrawablePtr, GCPtr, int, int,
 
73
                                  int, int, int, int, unsigned long);
 
74
static void      PixmapPolyPoint(DrawablePtr, GCPtr, int, int, xPoint *);
 
75
static void      PixmapPolylines(DrawablePtr, GCPtr, int, int, DDXPointPtr);
 
76
static void      PixmapPolySegment(DrawablePtr, GCPtr, int, xSegment *);
 
77
static void      PixmapPolyRectangle(DrawablePtr, GCPtr, int, xRectangle *);
 
78
static void      PixmapPolyArc(DrawablePtr, GCPtr, int, xArc *);
 
79
static void      PixmapFillPolygon(DrawablePtr, GCPtr, int, int, int,
 
80
                                    DDXPointPtr);
 
81
static void      PixmapPolyFillRect(DrawablePtr, GCPtr, int, xRectangle *);
 
82
static void      PixmapPolyFillArc(DrawablePtr, GCPtr, int, xArc *);
 
83
static int       PixmapPolyText8(DrawablePtr, GCPtr, int, int, int, char *);
 
84
static int       PixmapPolyText16(DrawablePtr, GCPtr, int, int, int,
 
85
                                   unsigned short *);
 
86
static void      PixmapImageText8(DrawablePtr, GCPtr, int, int, int, char *);
 
87
static void      PixmapImageText16(DrawablePtr, GCPtr, int, int, int,
 
88
                                    unsigned short *);
 
89
static void      PixmapImageGlyphBlt(DrawablePtr, GCPtr, int, int,
 
90
                                      unsigned int, CharInfoPtr *, pointer);
 
91
static void      PixmapPolyGlyphBlt(DrawablePtr, GCPtr, int, int,
 
92
                                     unsigned int, CharInfoPtr *, pointer);
 
93
 
 
94
static GCOps PixmapGCOps = {
 
95
    PixmapFillSpans, PixmapSetSpans, 
 
96
    PixmapPutImage, PixmapCopyArea, 
 
97
    PixmapCopyPlane, PixmapPolyPoint, 
 
98
    PixmapPolylines, PixmapPolySegment, 
 
99
    PixmapPolyRectangle, PixmapPolyArc, 
 
100
    PixmapFillPolygon, PixmapPolyFillRect, 
 
101
    PixmapPolyFillArc, PixmapPolyText8, 
 
102
    PixmapPolyText16, PixmapImageText8, 
 
103
    PixmapImageText16, PixmapImageGlyphBlt, 
 
104
    PixmapPolyGlyphBlt, PixmapPushPixels,
 
105
#ifdef NEED_LINEHELPER
 
106
    NULL,
 
107
#endif
 
108
    {NULL}              /* devPrivate */
 
109
};
 
110
 
 
111
 
 
112
/** Window Ops **/
 
113
static void      WindowFillSpans(DrawablePtr, GCPtr, int, DDXPointPtr, int *,
 
114
                                  int);
 
115
static void      WindowSetSpans(DrawablePtr, GCPtr, char *, DDXPointPtr,
 
116
                                 int *, int, int);
 
117
static void      WindowPutImage(DrawablePtr, GCPtr, int, int, int, int, int,
 
118
                                 int, int, char *);
 
119
static void      WindowPushPixels(GCPtr, PixmapPtr, DrawablePtr, int, int,
 
120
                                   int, int);
 
121
static RegionPtr WindowCopyArea(DrawablePtr, DrawablePtr, GCPtr, int, int,
 
122
                                 int, int, int, int);
 
123
static RegionPtr WindowCopyPlane(DrawablePtr, DrawablePtr, GCPtr, int, int,
 
124
                                  int, int, int, int, unsigned long);
 
125
static void      WindowPolyPoint(DrawablePtr, GCPtr, int, int, xPoint *);
 
126
static void      WindowPolylines(DrawablePtr, GCPtr, int, int, DDXPointPtr);
 
127
static void      WindowPolySegment(DrawablePtr, GCPtr, int, xSegment *);
 
128
static void      WindowPolyRectangle(DrawablePtr, GCPtr, int, xRectangle *);
 
129
static void      WindowPolyArc(DrawablePtr, GCPtr, int, xArc *);
 
130
static void      WindowFillPolygon(DrawablePtr, GCPtr, int, int, int,
 
131
                                    DDXPointPtr);
 
132
static void      WindowPolyFillRect(DrawablePtr, GCPtr, int, xRectangle *);
 
133
static void      WindowPolyFillArc(DrawablePtr, GCPtr, int, xArc *);
 
134
static int       WindowPolyText8(DrawablePtr, GCPtr, int, int, int, char *);
 
135
static int       WindowPolyText16(DrawablePtr, GCPtr, int, int, int,
 
136
                                   unsigned short *);
 
137
static void      WindowImageText8(DrawablePtr, GCPtr, int, int, int, char *);
 
138
static void      WindowImageText16(DrawablePtr, GCPtr, int, int, int,
 
139
                                    unsigned short *);
 
140
static void      WindowImageGlyphBlt(DrawablePtr, GCPtr, int, int,
 
141
                                      unsigned int, CharInfoPtr *, pointer);
 
142
static void      WindowPolyGlyphBlt(DrawablePtr, GCPtr, int, int,
 
143
                                     unsigned int, CharInfoPtr *, pointer);
 
144
 
 
145
static GCOps WindowGCOps = {
 
146
    WindowFillSpans, WindowSetSpans, 
 
147
    WindowPutImage, WindowCopyArea, 
 
148
    WindowCopyPlane, WindowPolyPoint, 
 
149
    WindowPolylines, WindowPolySegment, 
 
150
    WindowPolyRectangle, WindowPolyArc, 
 
151
    WindowFillPolygon, WindowPolyFillRect, 
 
152
    WindowPolyFillArc, WindowPolyText8, 
 
153
    WindowPolyText16, WindowImageText8, 
 
154
    WindowImageText16, WindowImageGlyphBlt, 
 
155
    WindowPolyGlyphBlt, WindowPushPixels,
 
156
#ifdef NEED_LINEHELPER
 
157
    NULL,
 
158
#endif
 
159
    {NULL}              /* devPrivate */
 
160
};
 
161
 
 
162
/** privates **/
 
163
 
 
164
typedef struct {
 
165
   CloseScreenProcPtr           CloseScreen;
 
166
   CreateGCProcPtr              CreateGC;
 
167
   CreatePixmapProcPtr          CreatePixmap;
 
168
   DestroyPixmapProcPtr         DestroyPixmap;
 
169
   ChangeWindowAttributesProcPtr ChangeWindowAttributes;
 
170
   PaintWindowBackgroundProcPtr PaintWindowBackground;
 
171
   PaintWindowBorderProcPtr     PaintWindowBorder;
 
172
   int                          LockPrivate;
 
173
} OverlayScreenRec, *OverlayScreenPtr;
 
174
 
 
175
typedef struct {
 
176
   GCFuncs              *wrapFuncs;
 
177
   GCOps                *wrapOps;
 
178
   GCOps                *overlayOps;
 
179
   unsigned long        fg;
 
180
   unsigned long        bg;
 
181
   unsigned long        pm;
 
182
   PixmapPtr            tile;
 
183
} OverlayGCRec, *OverlayGCPtr;
 
184
 
 
185
typedef struct {
 
186
   PixmapPtr            pix32;
 
187
   CARD32               dirty;
 
188
} OverlayPixmapRec, *OverlayPixmapPtr;
 
189
 
 
190
 
 
191
static int OverlayScreenIndex = -1;
 
192
static int OverlayGCIndex = -1;
 
193
static int OverlayPixmapIndex = -1;
 
194
static unsigned long OverlayGeneration = 0;
 
195
 
 
196
/** Macros **/
 
197
 
 
198
#define TILE_EXISTS(pGC) (!(pGC)->tileIsPixel && (pGC)->tile.pixmap)
 
199
 
 
200
#define OVERLAY_GET_PIXMAP_PRIVATE(pPix) \
 
201
    (OverlayPixmapPtr)((pPix)->devPrivates[OverlayPixmapIndex].ptr)
 
202
 
 
203
#define OVERLAY_GET_SCREEN_PRIVATE(pScreen) \
 
204
    (OverlayScreenPtr)((pScreen)->devPrivates[OverlayScreenIndex].ptr)
 
205
 
 
206
#define OVERLAY_GET_GC_PRIVATE(pGC) \
 
207
    (OverlayGCPtr)((pGC)->devPrivates[OverlayGCIndex].ptr)
 
208
 
 
209
#define OVERLAY_GC_FUNC_PROLOGUE(pGC)\
 
210
    OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\
 
211
    (pGC)->funcs = pGCPriv->wrapFuncs;\
 
212
    if(pGCPriv->overlayOps) \
 
213
        (pGC)->ops = pGCPriv->wrapOps
 
214
 
 
215
#define OVERLAY_GC_FUNC_EPILOGUE(pGC)\
 
216
    pGCPriv->wrapFuncs = (pGC)->funcs;\
 
217
    (pGC)->funcs = &OverlayGCFuncs;\
 
218
    if(pGCPriv->overlayOps) { \
 
219
        pGCPriv->wrapOps = (pGC)->ops;\
 
220
        (pGC)->ops = pGCPriv->overlayOps;\
 
221
    }
 
222
 
 
223
#define WINDOW_GC_OP_PROLOGUE(pGC)\
 
224
    OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE((pGC)->pScreen);\
 
225
    OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\
 
226
    unsigned long oldfg = (pGC)->fgPixel;\
 
227
    unsigned long oldbg = (pGC)->bgPixel;\
 
228
    unsigned long oldpm = (pGC)->planemask;\
 
229
    PixmapPtr oldtile = (pGC)->tile.pixmap;\
 
230
    (pGC)->fgPixel = pGCPriv->fg;\
 
231
    (pGC)->bgPixel = pGCPriv->bg;\
 
232
    (pGC)->planemask = pGCPriv->pm;\
 
233
    if(pGCPriv->tile) (pGC)->tile.pixmap = pGCPriv->tile;\
 
234
    (pGC)->funcs = pGCPriv->wrapFuncs;\
 
235
    (pGC)->ops = pGCPriv->wrapOps;\
 
236
    pScreenPriv->LockPrivate++
 
237
    
 
238
 
 
239
#define WINDOW_GC_OP_EPILOGUE(pGC)\
 
240
    pGCPriv->wrapOps = (pGC)->ops;\
 
241
    pGCPriv->wrapFuncs = (pGC)->funcs;\
 
242
    (pGC)->fgPixel = oldfg;\
 
243
    (pGC)->bgPixel = oldbg;\
 
244
    (pGC)->planemask = oldpm;\
 
245
    (pGC)->tile.pixmap = oldtile;\
 
246
    (pGC)->funcs = &OverlayGCFuncs;\
 
247
    (pGC)->ops   = &WindowGCOps;\
 
248
    pScreenPriv->LockPrivate--
 
249
 
 
250
 
 
251
#define PIXMAP_GC_OP_PROLOGUE(pGC)\
 
252
    OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\
 
253
    OverlayPixmapPtr pPixPriv = OVERLAY_GET_PIXMAP_PRIVATE((PixmapPtr)pDraw);\
 
254
    pGC->funcs = pGCPriv->wrapFuncs;\
 
255
    pGC->ops = pGCPriv->wrapOps
 
256
    
 
257
#define PIXMAP_GC_OP_EPILOGUE(pGC)\
 
258
    pGCPriv->wrapOps = pGC->ops;\
 
259
    pGC->funcs = &OverlayGCFuncs;\
 
260
    pGC->ops = &PixmapGCOps;\
 
261
    pPixPriv->dirty |= IS_DIRTY
 
262
    
 
263
 
 
264
Bool
 
265
xf86Overlay8Plus32Init (ScreenPtr pScreen)
 
266
{
 
267
    OverlayScreenPtr pScreenPriv;
 
268
 
 
269
    if(OverlayGeneration != serverGeneration) {
 
270
        if(((OverlayScreenIndex = AllocateScreenPrivateIndex()) < 0) ||
 
271
           ((OverlayGCIndex = AllocateGCPrivateIndex()) < 0) ||
 
272
           ((OverlayPixmapIndex = AllocatePixmapPrivateIndex()) < 0))
 
273
                return FALSE;
 
274
 
 
275
        OverlayGeneration = serverGeneration;
 
276
    }
 
277
 
 
278
    if (!AllocateGCPrivate(pScreen, OverlayGCIndex, sizeof(OverlayGCRec)))
 
279
        return FALSE;
 
280
 
 
281
    if (!AllocatePixmapPrivate(pScreen, OverlayPixmapIndex, 
 
282
                                                sizeof(OverlayPixmapRec)))
 
283
        return FALSE;
 
284
 
 
285
    if (!(pScreenPriv = xalloc(sizeof(OverlayScreenRec))))
 
286
        return FALSE;
 
287
 
 
288
    pScreen->devPrivates[OverlayScreenIndex].ptr = (pointer)pScreenPriv;
 
289
 
 
290
    pScreenPriv->CreateGC = pScreen->CreateGC;
 
291
    pScreenPriv->CloseScreen = pScreen->CloseScreen;
 
292
    pScreenPriv->CreatePixmap = pScreen->CreatePixmap;
 
293
    pScreenPriv->DestroyPixmap = pScreen->DestroyPixmap;
 
294
    pScreenPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
 
295
    pScreenPriv->PaintWindowBackground = pScreen->PaintWindowBackground;
 
296
    pScreenPriv->PaintWindowBorder = pScreen->PaintWindowBorder;
 
297
 
 
298
    pScreen->CreateGC = OverlayCreateGC;
 
299
    pScreen->CloseScreen = OverlayCloseScreen;
 
300
    pScreen->CreatePixmap = OverlayCreatePixmap; 
 
301
    pScreen->DestroyPixmap = OverlayDestroyPixmap; 
 
302
    pScreen->ChangeWindowAttributes = OverlayChangeWindowAttributes; 
 
303
    pScreen->PaintWindowBackground = OverlayPaintWindow; 
 
304
    pScreen->PaintWindowBorder = OverlayPaintWindow; 
 
305
 
 
306
    pScreenPriv->LockPrivate = 0; 
 
307
 
 
308
    /* allocate the key in the default map */
 
309
    if(pScreen->defColormap) {
 
310
        ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
 
311
        ColormapPtr pmap;
 
312
        xColorItem color;
 
313
 
 
314
        pmap = (ColormapPtr)LookupIDByType(pScreen->defColormap, RT_COLORMAP);
 
315
 
 
316
        pmap->red[pScrn->colorKey].refcnt = AllocPrivate;
 
317
        pmap->red[pScrn->colorKey].fShared = FALSE;
 
318
        pmap->freeRed--;
 
319
        
 
320
        color.red = color.blue = color.green = 0;
 
321
        color.pixel = pScrn->colorKey;
 
322
        color.flags = DoRed | DoGreen | DoBlue;
 
323
 
 
324
        StoreColors(pmap, 1, &color);
 
325
    }
 
326
 
 
327
    return TRUE;
 
328
}
 
329
 
 
330
 
 
331
/*********************** Screen Funcs ***********************/
 
332
 
 
333
Bool
 
334
OverlayCreateGC(GCPtr pGC)
 
335
{
 
336
    ScreenPtr    pScreen = pGC->pScreen;
 
337
    OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);
 
338
    OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
 
339
    Bool ret;
 
340
 
 
341
    pScreen->CreateGC = pScreenPriv->CreateGC;
 
342
 
 
343
    if((ret = (*pScreen->CreateGC)(pGC)) && (pGC->depth != 1)) {
 
344
        pGCPriv->wrapFuncs = pGC->funcs;
 
345
        pGC->funcs = &OverlayGCFuncs;
 
346
        pGCPriv->wrapOps = NULL;
 
347
        pGCPriv->overlayOps = NULL;
 
348
        pGCPriv->tile = NULL;
 
349
    }
 
350
 
 
351
    pScreen->CreateGC = OverlayCreateGC;
 
352
 
 
353
    return ret;
 
354
}
 
355
 
 
356
static PixmapPtr 
 
357
OverlayCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
 
358
{
 
359
    OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
 
360
    PixmapPtr pPix;
 
361
    
 
362
    pScreen->CreatePixmap = pScreenPriv->CreatePixmap;
 
363
    pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth);
 
364
    pScreen->CreatePixmap = OverlayCreatePixmap;
 
365
 
 
366
    /* We initialize all the privates */
 
367
    if(pPix) {
 
368
        OverlayPixmapPtr pPriv = OVERLAY_GET_PIXMAP_PRIVATE(pPix);
 
369
        pPriv->pix32 = NULL;
 
370
        pPriv->dirty = IS_DIRTY;
 
371
        if(!w || !h)
 
372
           pPriv->dirty |= IS_SHARED;
 
373
    }
 
374
 
 
375
    return pPix;
 
376
}
 
377
 
 
378
static Bool
 
379
OverlayDestroyPixmap(PixmapPtr pPix)
 
380
{
 
381
    ScreenPtr pScreen = pPix->drawable.pScreen;
 
382
    OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
 
383
    Bool result;
 
384
 
 
385
    pScreen->DestroyPixmap = pScreenPriv->DestroyPixmap;
 
386
 
 
387
    if((pPix->refcnt == 1) && (pPix->drawable.bitsPerPixel == 8)) {
 
388
        OverlayPixmapPtr pPriv = OVERLAY_GET_PIXMAP_PRIVATE(pPix);
 
389
        if(pPriv->pix32) {
 
390
           if(pPriv->pix32->refcnt != 1)
 
391
             ErrorF("Warning! private pix refcnt = %i\n", pPriv->pix32->refcnt);
 
392
           (*pScreen->DestroyPixmap)(pPriv->pix32);
 
393
        }
 
394
        pPriv->pix32 = NULL;
 
395
    }
 
396
 
 
397
    result = (*pScreen->DestroyPixmap) (pPix);
 
398
    pScreen->DestroyPixmap = OverlayDestroyPixmap;
 
399
 
 
400
    return result;
 
401
}
 
402
 
 
403
static Bool
 
404
OverlayCloseScreen (int i, ScreenPtr pScreen)
 
405
{
 
406
    OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
 
407
 
 
408
    pScreen->CreateGC = pScreenPriv->CreateGC;
 
409
    pScreen->CloseScreen = pScreenPriv->CloseScreen;
 
410
    pScreen->CreatePixmap = pScreenPriv->CreatePixmap;
 
411
    pScreen->DestroyPixmap = pScreenPriv->DestroyPixmap;
 
412
    pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes;
 
413
    pScreen->PaintWindowBackground = pScreenPriv->PaintWindowBackground;
 
414
    pScreen->PaintWindowBorder = pScreenPriv->PaintWindowBorder;
 
415
 
 
416
    xfree ((pointer) pScreenPriv);
 
417
 
 
418
    return (*pScreen->CloseScreen) (i, pScreen);
 
419
}
 
420
 
 
421
 
 
422
 
 
423
static Bool
 
424
OverlayChangeWindowAttributes (WindowPtr pWin, unsigned long mask)
 
425
{
 
426
    ScreenPtr pScreen = pWin->drawable.pScreen;
 
427
    OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
 
428
    Bool result;    
 
429
 
 
430
    if(pWin->drawable.depth == 8) {
 
431
        if((mask & CWBackPixmap) && 
 
432
           (pWin->backgroundState == BackgroundPixmap))         
 
433
                OverlayRefreshPixmap(pWin->background.pixmap);
 
434
 
 
435
        if((mask & CWBorderPixmap) && !pWin->borderIsPixel)
 
436
                OverlayRefreshPixmap(pWin->border.pixmap);
 
437
    }
 
438
 
 
439
    pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes;
 
440
    result = (*pScreen->ChangeWindowAttributes) (pWin, mask);
 
441
    pScreen->ChangeWindowAttributes = OverlayChangeWindowAttributes;
 
442
 
 
443
    return result;
 
444
}
 
445
 
 
446
static void
 
447
OverlayPaintWindow(
 
448
  WindowPtr pWin,
 
449
  RegionPtr pReg,
 
450
  int what
 
451
){
 
452
    ScreenPtr pScreen = pWin->drawable.pScreen;
 
453
    OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
 
454
    OverlayPixmapPtr pixPriv;
 
455
    PixmapPtr oldPix = NULL;
 
456
 
 
457
    if(what == PW_BACKGROUND) {
 
458
        if(pWin->drawable.depth == 8) {
 
459
           if(pWin->backgroundState == ParentRelative) {
 
460
                do {
 
461
                   pWin = pWin->parent;
 
462
                } while (pWin->backgroundState == ParentRelative);
 
463
           }
 
464
 
 
465
           if(pWin->backgroundState == BackgroundPixmap) {
 
466
                oldPix = pWin->background.pixmap;
 
467
                pixPriv = OVERLAY_GET_PIXMAP_PRIVATE(oldPix);
 
468
                /* have to do this here because alot of applications
 
469
                   incorrectly assume changes to a pixmap that is
 
470
                   a window background go into effect immediatedly */
 
471
                if(pixPriv->dirty & IS_DIRTY)
 
472
                    OverlayRefreshPixmap(pWin->background.pixmap);
 
473
                pWin->background.pixmap = pixPriv->pix32;
 
474
           }
 
475
        }
 
476
 
 
477
        pScreen->PaintWindowBackground = pScreenPriv->PaintWindowBackground;
 
478
        (*pScreen->PaintWindowBackground) (pWin, pReg, what);
 
479
        pScreen->PaintWindowBackground = OverlayPaintWindow;
 
480
 
 
481
        if(oldPix)
 
482
           pWin->background.pixmap = oldPix;
 
483
    } else {
 
484
        if((pWin->drawable.depth == 8) && !pWin->borderIsPixel) {
 
485
           oldPix = pWin->border.pixmap;
 
486
           pixPriv = OVERLAY_GET_PIXMAP_PRIVATE(oldPix);
 
487
           if(pixPriv->dirty & IS_DIRTY)
 
488
                OverlayRefreshPixmap(pWin->border.pixmap);
 
489
           pWin->border.pixmap = pixPriv->pix32;
 
490
        }
 
491
 
 
492
        pScreen->PaintWindowBorder = pScreenPriv->PaintWindowBorder;
 
493
        (*pScreen->PaintWindowBorder) (pWin, pReg, what);
 
494
        pScreen->PaintWindowBorder = OverlayPaintWindow;
 
495
 
 
496
        if(oldPix)
 
497
           pWin->border.pixmap = oldPix;
 
498
    }
 
499
}
 
500
 
 
501
 
 
502
/*********************** GC Funcs *****************************/
 
503
 
 
504
 
 
505
static PixmapPtr
 
506
OverlayRefreshPixmap(PixmapPtr pix8) 
 
507
{
 
508
    OverlayPixmapPtr pixPriv = OVERLAY_GET_PIXMAP_PRIVATE(pix8);
 
509
    ScreenPtr pScreen = pix8->drawable.pScreen;
 
510
 
 
511
    if(!pixPriv->pix32) {
 
512
        PixmapPtr newPix;
 
513
 
 
514
        newPix = (*pScreen->CreatePixmap)(pScreen, pix8->drawable.width,
 
515
                pix8->drawable.height, 24);
 
516
        newPix->drawable.depth = 8;  /* Bad Mark! Bad Mark! */
 
517
        pixPriv->pix32 = newPix;
 
518
    }
 
519
 
 
520
    if(pixPriv->dirty) {
 
521
        OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
 
522
        GCPtr pGC;
 
523
 
 
524
        pGC = GetScratchGC(8, pScreen);
 
525
 
 
526
        pScreenPriv->LockPrivate++;  /* don't modify this one */
 
527
        ValidateGC((DrawablePtr)pixPriv->pix32, pGC);
 
528
 
 
529
        (*pGC->ops->CopyArea)((DrawablePtr)pix8, (DrawablePtr)pixPriv->pix32,
 
530
                pGC, 0, 0, pix8->drawable.width, pix8->drawable.height, 0, 0);  
 
531
        pScreenPriv->LockPrivate--;
 
532
        FreeScratchGC(pGC);
 
533
 
 
534
        pixPriv->dirty &= ~IS_DIRTY;
 
535
        pixPriv->pix32->drawable.serialNumber = NEXT_SERIAL_NUMBER;    
 
536
    }
 
537
 
 
538
    return pixPriv->pix32;
 
539
}
 
540
 
 
541
 
 
542
static void
 
543
OverlayValidateGC(
 
544
   GCPtr         pGC,
 
545
   unsigned long changes,
 
546
   DrawablePtr   pDraw 
 
547
){
 
548
    OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pGC->pScreen);
 
549
    OVERLAY_GC_FUNC_PROLOGUE (pGC);
 
550
 
 
551
    if(pScreenPriv->LockPrivate < 0) {
 
552
        ErrorF("Something is wrong in OverlayValidateGC!\n");
 
553
        pScreenPriv->LockPrivate = 0;
 
554
    }
 
555
 
 
556
    if(pGC->depth == 24) {
 
557
        unsigned long oldpm = pGC->planemask;
 
558
        pGCPriv->overlayOps = NULL;
 
559
 
 
560
        if(pDraw->type == DRAWABLE_WINDOW)
 
561
           pGC->planemask &= 0x00ffffff;
 
562
        else
 
563
           pGC->planemask |= 0xff000000; 
 
564
 
 
565
        if(oldpm != pGC->planemask) changes |= GCPlaneMask;
 
566
 
 
567
        (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
 
568
 
 
569
    } else { /* depth == 8 */
 
570
        unsigned long newChanges = 0;
 
571
 
 
572
        if(pDraw->bitsPerPixel == 32) {
 
573
        
 
574
            if(pGC->fillStyle == FillTiled)
 
575
                pGCPriv->tile = OverlayRefreshPixmap(pGC->tile.pixmap);
 
576
            else pGCPriv->tile = NULL;
 
577
 
 
578
            if(pGCPriv->overlayOps != &WindowGCOps) {
 
579
                newChanges = GCForeground | GCBackground | GCPlaneMask;
 
580
                if(pGCPriv->tile) 
 
581
                    newChanges |= GCTile;
 
582
            }
 
583
            pGCPriv->overlayOps = &WindowGCOps;
 
584
 
 
585
            if(!pScreenPriv->LockPrivate) {
 
586
                unsigned long oldfg = pGC->fgPixel;
 
587
                unsigned long oldbg = pGC->bgPixel;
 
588
                unsigned long oldpm = pGC->planemask;
 
589
                PixmapPtr oldtile = pGC->tile.pixmap;
 
590
 
 
591
                pGC->fgPixel = pGCPriv->fg = oldfg << 24;
 
592
                pGC->bgPixel = pGCPriv->bg = oldbg << 24;
 
593
                pGC->planemask = pGCPriv->pm = oldpm << 24;
 
594
                if(pGCPriv->tile)
 
595
                    pGC->tile.pixmap = pGCPriv->tile;
 
596
 
 
597
                (*pGC->funcs->ValidateGC)(pGC, changes | newChanges, pDraw);
 
598
 
 
599
                pGC->fgPixel = oldfg;
 
600
                pGC->bgPixel = oldbg;
 
601
                pGC->planemask = oldpm;
 
602
                pGC->tile.pixmap = oldtile;
 
603
            } else {
 
604
                pGCPriv->fg = pGC->fgPixel;
 
605
                pGCPriv->bg = pGC->bgPixel;
 
606
                pGCPriv->pm = pGC->planemask;
 
607
 
 
608
                (*pGC->funcs->ValidateGC)(pGC, changes | newChanges, pDraw);
 
609
            }
 
610
 
 
611
        } else {  /* bitsPerPixel == 8 */
 
612
            if(pGCPriv->overlayOps == &WindowGCOps) {
 
613
                newChanges = GCForeground | GCBackground | GCPlaneMask;
 
614
                if(pGCPriv->tile) 
 
615
                    newChanges |= GCTile;
 
616
            }
 
617
            pGCPriv->overlayOps = &PixmapGCOps;
 
618
 
 
619
            (*pGC->funcs->ValidateGC)(pGC, changes | newChanges, pDraw);
 
620
        }
 
621
    }
 
622
 
 
623
    OVERLAY_GC_FUNC_EPILOGUE (pGC);
 
624
}
 
625
 
 
626
 
 
627
static void
 
628
OverlayDestroyGC(GCPtr pGC)
 
629
{
 
630
    OVERLAY_GC_FUNC_PROLOGUE (pGC);
 
631
    (*pGC->funcs->DestroyGC)(pGC);
 
632
    OVERLAY_GC_FUNC_EPILOGUE (pGC);
 
633
}
 
634
 
 
635
static void
 
636
OverlayChangeGC (
 
637
    GCPtr           pGC,
 
638
    unsigned long   mask
 
639
){
 
640
    OVERLAY_GC_FUNC_PROLOGUE (pGC);
 
641
    (*pGC->funcs->ChangeGC) (pGC, mask);
 
642
    OVERLAY_GC_FUNC_EPILOGUE (pGC);
 
643
}
 
644
 
 
645
static void
 
646
OverlayCopyGC (
 
647
    GCPtr           pGCSrc, 
 
648
    unsigned long   mask,
 
649
    GCPtr           pGCDst
 
650
){
 
651
    OVERLAY_GC_FUNC_PROLOGUE (pGCDst);
 
652
    (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
 
653
    OVERLAY_GC_FUNC_EPILOGUE (pGCDst);
 
654
}
 
655
static void
 
656
OverlayChangeClip (
 
657
    GCPtr   pGC,
 
658
    int         type,
 
659
    pointer     pvalue,
 
660
    int         nrects
 
661
){
 
662
    OVERLAY_GC_FUNC_PROLOGUE (pGC);
 
663
    (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
 
664
    OVERLAY_GC_FUNC_EPILOGUE (pGC);
 
665
}
 
666
 
 
667
static void
 
668
OverlayCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
 
669
{
 
670
    OVERLAY_GC_FUNC_PROLOGUE (pgcDst);
 
671
    (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
 
672
    OVERLAY_GC_FUNC_EPILOGUE (pgcDst);
 
673
}
 
674
 
 
675
static void
 
676
OverlayDestroyClip(GCPtr pGC)
 
677
{
 
678
    OVERLAY_GC_FUNC_PROLOGUE (pGC);
 
679
    (* pGC->funcs->DestroyClip)(pGC);
 
680
    OVERLAY_GC_FUNC_EPILOGUE (pGC);
 
681
}
 
682
 
 
683
 
 
684
 
 
685
/******************* Window GC ops ***********************/
 
686
 
 
687
static void
 
688
WindowFillSpans(
 
689
    DrawablePtr pDraw,
 
690
    GC          *pGC,
 
691
    int         nInit,  
 
692
    DDXPointPtr pptInit,        
 
693
    int *pwidthInit,            
 
694
    int fSorted 
 
695
){
 
696
    WINDOW_GC_OP_PROLOGUE(pGC);
 
697
    (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
 
698
    WINDOW_GC_OP_EPILOGUE(pGC);
 
699
}
 
700
 
 
701
static void
 
702
WindowSetSpans(
 
703
    DrawablePtr         pDraw,
 
704
    GCPtr               pGC,
 
705
    char                *pcharsrc,
 
706
    register DDXPointPtr ppt,
 
707
    int                 *pwidth,
 
708
    int                 nspans,
 
709
    int                 fSorted 
 
710
){
 
711
    WINDOW_GC_OP_PROLOGUE(pGC);
 
712
    (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
 
713
    WINDOW_GC_OP_EPILOGUE(pGC);
 
714
}
 
715
 
 
716
static void
 
717
WindowPutImage(
 
718
    DrawablePtr pDraw,
 
719
    GCPtr       pGC,
 
720
    int         depth, 
 
721
    int x, int y, int w, int h,
 
722
    int         leftPad,
 
723
    int         format,
 
724
    char        *pImage 
 
725
){
 
726
    WINDOW_GC_OP_PROLOGUE(pGC);
 
727
    (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h, 
 
728
                                                leftPad, format, pImage);
 
729
    WINDOW_GC_OP_EPILOGUE(pGC);
 
730
}
 
731
 
 
732
static RegionPtr
 
733
WindowCopyArea(
 
734
    DrawablePtr pSrc,
 
735
    DrawablePtr pDst,
 
736
    GC *pGC,
 
737
    int srcx, int srcy,
 
738
    int width, int height,
 
739
    int dstx, int dsty 
 
740
){
 
741
    RegionPtr ret;
 
742
 
 
743
    WINDOW_GC_OP_PROLOGUE(pGC);
 
744
    ret = (*pGC->ops->CopyArea)(pSrc, pDst,
 
745
            pGC, srcx, srcy, width, height, dstx, dsty);
 
746
    WINDOW_GC_OP_EPILOGUE(pGC);
 
747
    return ret;
 
748
}
 
749
 
 
750
static RegionPtr
 
751
WindowCopyPlane(
 
752
    DrawablePtr pSrc,
 
753
    DrawablePtr pDst,
 
754
    GCPtr pGC,
 
755
    int srcx, int srcy,
 
756
    int width, int height,
 
757
    int dstx, int dsty,
 
758
    unsigned long bitPlane 
 
759
){
 
760
    RegionPtr ret;
 
761
 
 
762
    WINDOW_GC_OP_PROLOGUE(pGC);
 
763
    ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
 
764
               pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
 
765
    WINDOW_GC_OP_EPILOGUE(pGC);
 
766
    return ret;
 
767
}
 
768
 
 
769
static void
 
770
WindowPolyPoint(
 
771
    DrawablePtr pDraw,
 
772
    GCPtr pGC,
 
773
    int mode,
 
774
    int npt,
 
775
    xPoint *pptInit
 
776
){
 
777
    WINDOW_GC_OP_PROLOGUE(pGC);
 
778
    (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
 
779
    WINDOW_GC_OP_EPILOGUE(pGC);
 
780
}
 
781
 
 
782
static void
 
783
WindowPolylines(
 
784
    DrawablePtr pDraw,
 
785
    GCPtr       pGC,
 
786
    int         mode,           
 
787
    int         npt,            
 
788
    DDXPointPtr pptInit 
 
789
){
 
790
    WINDOW_GC_OP_PROLOGUE(pGC);
 
791
    (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
 
792
    WINDOW_GC_OP_EPILOGUE(pGC);
 
793
}
 
794
 
 
795
static void 
 
796
WindowPolySegment(
 
797
    DrawablePtr pDraw,
 
798
    GCPtr       pGC,
 
799
    int         nseg,
 
800
    xSegment    *pSeg 
 
801
){
 
802
    WINDOW_GC_OP_PROLOGUE(pGC);
 
803
    (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
 
804
    WINDOW_GC_OP_EPILOGUE(pGC);
 
805
}
 
806
 
 
807
static void
 
808
WindowPolyRectangle(
 
809
    DrawablePtr  pDraw,
 
810
    GCPtr        pGC,
 
811
    int          nRectsInit,
 
812
    xRectangle  *pRectsInit 
 
813
){
 
814
    WINDOW_GC_OP_PROLOGUE(pGC);
 
815
    (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
 
816
    WINDOW_GC_OP_EPILOGUE(pGC);
 
817
}
 
818
 
 
819
static void
 
820
WindowPolyArc(
 
821
    DrawablePtr pDraw,
 
822
    GCPtr       pGC,
 
823
    int         narcs,
 
824
    xArc        *parcs 
 
825
){
 
826
    WINDOW_GC_OP_PROLOGUE(pGC);
 
827
    (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
 
828
    WINDOW_GC_OP_EPILOGUE(pGC);
 
829
}
 
830
 
 
831
static void
 
832
WindowFillPolygon(
 
833
    DrawablePtr pDraw,
 
834
    GCPtr       pGC,
 
835
    int         shape,
 
836
    int         mode,
 
837
    int         count,
 
838
    DDXPointPtr ptsIn 
 
839
){
 
840
    WINDOW_GC_OP_PROLOGUE(pGC);
 
841
    (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
 
842
    WINDOW_GC_OP_EPILOGUE(pGC);
 
843
}
 
844
 
 
845
static void 
 
846
WindowPolyFillRect(
 
847
    DrawablePtr pDraw,
 
848
    GCPtr       pGC,
 
849
    int         nrectFill, 
 
850
    xRectangle  *prectInit 
 
851
){
 
852
    WINDOW_GC_OP_PROLOGUE(pGC);
 
853
    (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
 
854
    WINDOW_GC_OP_EPILOGUE(pGC);
 
855
}
 
856
 
 
857
static void
 
858
WindowPolyFillArc(
 
859
    DrawablePtr pDraw,
 
860
    GCPtr       pGC,
 
861
    int         narcs,
 
862
    xArc        *parcs 
 
863
){
 
864
    WINDOW_GC_OP_PROLOGUE(pGC);
 
865
    (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
 
866
    WINDOW_GC_OP_EPILOGUE(pGC);
 
867
}
 
868
 
 
869
static int
 
870
WindowPolyText8(
 
871
    DrawablePtr pDraw,
 
872
    GCPtr       pGC,
 
873
    int         x, 
 
874
    int         y,
 
875
    int         count,
 
876
    char        *chars 
 
877
){
 
878
    int ret;
 
879
 
 
880
    WINDOW_GC_OP_PROLOGUE(pGC);
 
881
    ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
 
882
    WINDOW_GC_OP_EPILOGUE(pGC);
 
883
    return ret;
 
884
}
 
885
 
 
886
static int
 
887
WindowPolyText16(
 
888
    DrawablePtr pDraw,
 
889
    GCPtr       pGC,
 
890
    int         x,
 
891
    int         y,
 
892
    int         count,
 
893
    unsigned short *chars 
 
894
){
 
895
    int ret;
 
896
 
 
897
    WINDOW_GC_OP_PROLOGUE(pGC);
 
898
    ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
 
899
    WINDOW_GC_OP_EPILOGUE(pGC);
 
900
    return ret;
 
901
}
 
902
 
 
903
static void
 
904
WindowImageText8(
 
905
    DrawablePtr pDraw,
 
906
    GCPtr       pGC,
 
907
    int         x, 
 
908
    int         y,
 
909
    int         count,
 
910
    char        *chars 
 
911
){
 
912
    WINDOW_GC_OP_PROLOGUE(pGC);
 
913
    (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
 
914
    WINDOW_GC_OP_EPILOGUE(pGC);
 
915
}
 
916
 
 
917
static void
 
918
WindowImageText16(
 
919
    DrawablePtr pDraw,
 
920
    GCPtr       pGC,
 
921
    int         x,
 
922
    int         y,
 
923
    int         count,
 
924
    unsigned short *chars 
 
925
){
 
926
    WINDOW_GC_OP_PROLOGUE(pGC);
 
927
    (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
 
928
    WINDOW_GC_OP_EPILOGUE(pGC);
 
929
}
 
930
 
 
931
static void
 
932
WindowImageGlyphBlt(
 
933
    DrawablePtr pDraw,
 
934
    GCPtr pGC,
 
935
    int xInit, int yInit,
 
936
    unsigned int nglyph,
 
937
    CharInfoPtr *ppci,
 
938
    pointer pglyphBase 
 
939
){
 
940
    WINDOW_GC_OP_PROLOGUE(pGC);
 
941
    (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, 
 
942
                                        ppci, pglyphBase);
 
943
    WINDOW_GC_OP_EPILOGUE(pGC);
 
944
}
 
945
 
 
946
static void
 
947
WindowPolyGlyphBlt(
 
948
    DrawablePtr pDraw,
 
949
    GCPtr pGC,
 
950
    int xInit, int yInit,
 
951
    unsigned int nglyph,
 
952
    CharInfoPtr *ppci,
 
953
    pointer pglyphBase 
 
954
){
 
955
    WINDOW_GC_OP_PROLOGUE(pGC);
 
956
    (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, 
 
957
                                                ppci, pglyphBase);
 
958
    WINDOW_GC_OP_EPILOGUE(pGC);
 
959
}
 
960
 
 
961
static void
 
962
WindowPushPixels(
 
963
    GCPtr       pGC,
 
964
    PixmapPtr   pBitMap,
 
965
    DrawablePtr pDraw,
 
966
    int dx, int dy, int xOrg, int yOrg 
 
967
){
 
968
    WINDOW_GC_OP_PROLOGUE(pGC);
 
969
    (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
 
970
    WINDOW_GC_OP_EPILOGUE(pGC);
 
971
}
 
972
 
 
973
 
 
974
/******************* Pixmap GC ops ***********************/
 
975
 
 
976
static void
 
977
PixmapFillSpans(
 
978
    DrawablePtr pDraw,
 
979
    GC          *pGC,
 
980
    int         nInit,  
 
981
    DDXPointPtr pptInit,        
 
982
    int *pwidthInit,            
 
983
    int fSorted 
 
984
){
 
985
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
986
    (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
 
987
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
988
}
 
989
 
 
990
static void
 
991
PixmapSetSpans(
 
992
    DrawablePtr         pDraw,
 
993
    GCPtr               pGC,
 
994
    char                *pcharsrc,
 
995
    register DDXPointPtr ppt,
 
996
    int                 *pwidth,
 
997
    int                 nspans,
 
998
    int                 fSorted 
 
999
){
 
1000
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
1001
    (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
 
1002
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
1003
}
 
1004
 
 
1005
static void
 
1006
PixmapPutImage(
 
1007
    DrawablePtr pDraw,
 
1008
    GCPtr       pGC,
 
1009
    int         depth, 
 
1010
    int x, int y, int w, int h,
 
1011
    int         leftPad,
 
1012
    int         format,
 
1013
    char        *pImage 
 
1014
){
 
1015
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
1016
    (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h, 
 
1017
                                                leftPad, format, pImage);
 
1018
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
1019
}
 
1020
 
 
1021
static RegionPtr
 
1022
PixmapCopyArea(
 
1023
    DrawablePtr pSrc,
 
1024
    DrawablePtr pDraw,
 
1025
    GC *pGC,
 
1026
    int srcx, int srcy,
 
1027
    int width, int height,
 
1028
    int dstx, int dsty 
 
1029
){
 
1030
    RegionPtr ret;
 
1031
 
 
1032
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
1033
    ret = (*pGC->ops->CopyArea)(pSrc, pDraw,
 
1034
            pGC, srcx, srcy, width, height, dstx, dsty);
 
1035
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
1036
    return ret;
 
1037
}
 
1038
 
 
1039
static RegionPtr
 
1040
PixmapCopyPlane(
 
1041
    DrawablePtr pSrc,
 
1042
    DrawablePtr pDraw,
 
1043
    GCPtr pGC,
 
1044
    int srcx, int srcy,
 
1045
    int width, int height,
 
1046
    int dstx, int dsty,
 
1047
    unsigned long bitPlane 
 
1048
){
 
1049
    RegionPtr ret;
 
1050
 
 
1051
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
1052
    ret = (*pGC->ops->CopyPlane)(pSrc, pDraw,
 
1053
               pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
 
1054
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
1055
    return ret;
 
1056
}
 
1057
 
 
1058
static void
 
1059
PixmapPolyPoint(
 
1060
    DrawablePtr pDraw,
 
1061
    GCPtr pGC,
 
1062
    int mode,
 
1063
    int npt,
 
1064
    xPoint *pptInit
 
1065
){
 
1066
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
1067
    (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
 
1068
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
1069
}
 
1070
 
 
1071
static void
 
1072
PixmapPolylines(
 
1073
    DrawablePtr pDraw,
 
1074
    GCPtr       pGC,
 
1075
    int         mode,           
 
1076
    int         npt,            
 
1077
    DDXPointPtr pptInit 
 
1078
){
 
1079
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
1080
    (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
 
1081
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
1082
}
 
1083
 
 
1084
static void 
 
1085
PixmapPolySegment(
 
1086
    DrawablePtr pDraw,
 
1087
    GCPtr       pGC,
 
1088
    int         nseg,
 
1089
    xSegment    *pSeg 
 
1090
){
 
1091
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
1092
    (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
 
1093
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
1094
}
 
1095
 
 
1096
static void
 
1097
PixmapPolyRectangle(
 
1098
    DrawablePtr  pDraw,
 
1099
    GCPtr        pGC,
 
1100
    int          nRectsInit,
 
1101
    xRectangle  *pRectsInit 
 
1102
){
 
1103
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
1104
    (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
 
1105
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
1106
}
 
1107
 
 
1108
static void
 
1109
PixmapPolyArc(
 
1110
    DrawablePtr pDraw,
 
1111
    GCPtr       pGC,
 
1112
    int         narcs,
 
1113
    xArc        *parcs 
 
1114
){
 
1115
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
1116
    (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
 
1117
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
1118
}
 
1119
 
 
1120
static void
 
1121
PixmapFillPolygon(
 
1122
    DrawablePtr pDraw,
 
1123
    GCPtr       pGC,
 
1124
    int         shape,
 
1125
    int         mode,
 
1126
    int         count,
 
1127
    DDXPointPtr ptsIn 
 
1128
){
 
1129
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
1130
    (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
 
1131
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
1132
}
 
1133
 
 
1134
static void 
 
1135
PixmapPolyFillRect(
 
1136
    DrawablePtr pDraw,
 
1137
    GCPtr       pGC,
 
1138
    int         nrectFill, 
 
1139
    xRectangle  *prectInit 
 
1140
){
 
1141
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
1142
    (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
 
1143
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
1144
}
 
1145
 
 
1146
static void
 
1147
PixmapPolyFillArc(
 
1148
    DrawablePtr pDraw,
 
1149
    GCPtr       pGC,
 
1150
    int         narcs,
 
1151
    xArc        *parcs 
 
1152
){
 
1153
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
1154
    (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
 
1155
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
1156
}
 
1157
 
 
1158
static int
 
1159
PixmapPolyText8(
 
1160
    DrawablePtr pDraw,
 
1161
    GCPtr       pGC,
 
1162
    int         x, 
 
1163
    int         y,
 
1164
    int         count,
 
1165
    char        *chars 
 
1166
){
 
1167
    int ret;
 
1168
 
 
1169
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
1170
    ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
 
1171
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
1172
    return ret;
 
1173
}
 
1174
 
 
1175
static int
 
1176
PixmapPolyText16(
 
1177
    DrawablePtr pDraw,
 
1178
    GCPtr       pGC,
 
1179
    int         x,
 
1180
    int         y,
 
1181
    int         count,
 
1182
    unsigned short *chars 
 
1183
){
 
1184
    int ret;
 
1185
 
 
1186
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
1187
    ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
 
1188
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
1189
    return ret;
 
1190
}
 
1191
 
 
1192
static void
 
1193
PixmapImageText8(
 
1194
    DrawablePtr pDraw,
 
1195
    GCPtr       pGC,
 
1196
    int         x, 
 
1197
    int         y,
 
1198
    int         count,
 
1199
    char        *chars 
 
1200
){
 
1201
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
1202
    (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
 
1203
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
1204
}
 
1205
 
 
1206
static void
 
1207
PixmapImageText16(
 
1208
    DrawablePtr pDraw,
 
1209
    GCPtr       pGC,
 
1210
    int         x,
 
1211
    int         y,
 
1212
    int         count,
 
1213
    unsigned short *chars 
 
1214
){
 
1215
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
1216
    (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
 
1217
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
1218
}
 
1219
 
 
1220
static void
 
1221
PixmapImageGlyphBlt(
 
1222
    DrawablePtr pDraw,
 
1223
    GCPtr pGC,
 
1224
    int xInit, int yInit,
 
1225
    unsigned int nglyph,
 
1226
    CharInfoPtr *ppci,
 
1227
    pointer pglyphBase 
 
1228
){
 
1229
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
1230
    (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, 
 
1231
                                        ppci, pglyphBase);
 
1232
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
1233
}
 
1234
 
 
1235
static void
 
1236
PixmapPolyGlyphBlt(
 
1237
    DrawablePtr pDraw,
 
1238
    GCPtr pGC,
 
1239
    int xInit, int yInit,
 
1240
    unsigned int nglyph,
 
1241
    CharInfoPtr *ppci,
 
1242
    pointer pglyphBase 
 
1243
){
 
1244
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
1245
    (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, 
 
1246
                                                ppci, pglyphBase);
 
1247
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
1248
}
 
1249
 
 
1250
static void
 
1251
PixmapPushPixels(
 
1252
    GCPtr       pGC,
 
1253
    PixmapPtr   pBitMap,
 
1254
    DrawablePtr pDraw,
 
1255
    int dx, int dy, int xOrg, int yOrg 
 
1256
){
 
1257
    PIXMAP_GC_OP_PROLOGUE(pGC);
 
1258
    (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
 
1259
    PIXMAP_GC_OP_EPILOGUE(pGC);
 
1260
}
 
1261
 
 
1262