~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/hw/xfree86/rac/xf86RAC.c

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $XFree86: xc/programs/Xserver/hw/xfree86/rac/xf86RAC.c,v 1.7 2002/09/16 18:06:18 eich Exp $ */
 
2
 
 
3
#include "misc.h"
 
4
#include "xf86.h"
 
5
#include "xf86_ansic.h"
 
6
#include "xf86_OSproc.h"
 
7
 
 
8
#include "X.h"
 
9
#include "colormapst.h"
 
10
#include "scrnintstr.h"
 
11
#include "screenint.h"
 
12
#include "gcstruct.h"
 
13
#include "pixmapstr.h"
 
14
#include "pixmap.h"
 
15
#include "windowstr.h"
 
16
#include "window.h"
 
17
#include "xf86str.h"
 
18
#include "xf86RAC.h"
 
19
#include "mipointer.h"
 
20
#include "mipointrst.h"
 
21
#ifdef RENDER
 
22
# include "picturestr.h"
 
23
#endif
 
24
 
 
25
#ifdef DEBUG
 
26
#define DPRINT_S(x,y) ErrorF(x ": %i\n",y);
 
27
#define DPRINT(x) ErrorF(x "\n");
 
28
#else
 
29
#define DPRINT_S(x,y)
 
30
#define DPRINT(x)
 
31
#endif
 
32
 
 
33
#define WRAP_SCREEN(x,y)     {pScreenPriv->x = pScreen->x;\
 
34
                              pScreen->x = y;}
 
35
#define WRAP_SCREEN_COND(x,y,cond) \
 
36
                             {pScreenPriv->x = pScreen->x;\
 
37
                                if (flag & (cond))\
 
38
                                  pScreen->x = y;}
 
39
#define UNWRAP_SCREEN(x)    pScreen->x = pScreenPriv->x
 
40
 
 
41
#define SCREEN_PROLOG(x) \
 
42
            pScreen->x = \
 
43
             ((RACScreenPtr) (pScreen)->devPrivates[RACScreenIndex].ptr)->x
 
44
#define SCREEN_EPILOG(x,y) pScreen->x = y;
 
45
 
 
46
#define WRAP_PICT_COND(x,y,cond) if (ps)\
 
47
                                {pScreenPriv->x = ps->x;\
 
48
                                        if (flag & (cond))\
 
49
                                        ps->x = y;}
 
50
#define UNWRAP_PICT(x)  if (ps) {ps->x = pScreenPriv->x;}
 
51
 
 
52
#define PICTURE_PROLOGUE(field) \
 
53
        ps->field = \
 
54
        ((RACScreenPtr) (pScreen)->devPrivates[RACScreenIndex].ptr)->field
 
55
#define PICTURE_EPILOGUE(field, wrap) \
 
56
        ps->field = wrap
 
57
 
 
58
#define WRAP_SCREEN_INFO(x,y) {pScreenPriv->x = pScrn->x;\
 
59
                                   pScrn->x = y;}
 
60
#define WRAP_SCREEN_INFO_COND(x,y,cond) \
 
61
                              {pScreenPriv->x = pScrn->x;\
 
62
                                  if (flag & (cond))\
 
63
                                     pScrn->x = y;}
 
64
#define UNWRAP_SCREEN_INFO(x)    pScrn->x = pScreenPriv->x
 
65
 
 
66
#define SPRITE_PROLOG     miPointerScreenPtr PointPriv = \
 
67
(miPointerScreenPtr)pScreen->devPrivates[miPointerScreenIndex].ptr;\
 
68
                               RACScreenPtr pScreenPriv = \
 
69
((RACScreenPtr) (pScreen)->devPrivates[RACScreenIndex].ptr);\
 
70
                        PointPriv->spriteFuncs = pScreenPriv->miSprite;
 
71
#define SPRITE_EPILOG pScreenPriv->miSprite = PointPriv->spriteFuncs;\
 
72
                      PointPriv->spriteFuncs  = &RACSpriteFuncs;
 
73
#define WRAP_SPRITE_COND(cond){pScreenPriv->miSprite = PointPriv->spriteFuncs;\
 
74
                              if(flag & (cond))\
 
75
                              PointPriv->spriteFuncs  = &RACSpriteFuncs;}
 
76
#define UNWRAP_SPRITE PointPriv->spriteFuncs = pScreenPriv->miSprite
 
77
    
 
78
            
 
79
#define GC_WRAP(x) pGCPriv->wrapOps = (x)->ops;\
 
80
                 pGCPriv->wrapFuncs = (x)->funcs;\
 
81
                           (x)->ops = &RACGCOps;\
 
82
                         (x)->funcs = &RACGCFuncs;
 
83
#define GC_UNWRAP(x)\
 
84
           RACGCPtr  pGCPriv = (RACGCPtr) (x)->devPrivates[RACGCIndex].ptr;\
 
85
                    (x)->ops = pGCPriv->wrapOps;\
 
86
                  (x)->funcs = pGCPriv->wrapFuncs;
 
87
 
 
88
#define GC_SCREEN register ScrnInfoPtr pScrn \
 
89
                           = xf86Screens[pGC->pScreen->myNum]
 
90
 
 
91
#define ENABLE xf86EnableAccess(xf86Screens[pScreen->myNum])
 
92
#define ENABLE_GC  xf86EnableAccess(xf86Screens[pGC->pScreen->myNum])
 
93
 
 
94
typedef struct _RACScreen {
 
95
    CreateGCProcPtr             CreateGC;
 
96
    CloseScreenProcPtr          CloseScreen;
 
97
    GetImageProcPtr             GetImage;
 
98
    GetSpansProcPtr             GetSpans;
 
99
    SourceValidateProcPtr       SourceValidate;
 
100
    PaintWindowBackgroundProcPtr PaintWindowBackground;
 
101
    PaintWindowBorderProcPtr    PaintWindowBorder;
 
102
    CopyWindowProcPtr           CopyWindow;
 
103
    ClearToBackgroundProcPtr    ClearToBackground;
 
104
    BSFuncRec                   BackingStoreFuncs;
 
105
    CreatePixmapProcPtr         CreatePixmap;
 
106
    SaveScreenProcPtr           SaveScreen;
 
107
    /* Colormap */
 
108
    StoreColorsProcPtr          StoreColors;
 
109
    /* Cursor */
 
110
    DisplayCursorProcPtr         DisplayCursor;
 
111
    RealizeCursorProcPtr         RealizeCursor;
 
112
    UnrealizeCursorProcPtr       UnrealizeCursor;
 
113
    RecolorCursorProcPtr         RecolorCursor;
 
114
    SetCursorPositionProcPtr     SetCursorPosition;
 
115
    void                         (*AdjustFrame)(int,int,int,int);
 
116
    Bool                         (*SwitchMode)(int, DisplayModePtr,int);
 
117
    Bool                         (*EnterVT)(int, int);
 
118
    void                         (*LeaveVT)(int, int);
 
119
    void                         (*FreeScreen)(int, int);
 
120
    miPointerSpriteFuncPtr       miSprite;
 
121
#ifdef RENDER
 
122
    CompositeProcPtr                    Composite;
 
123
    GlyphsProcPtr                       Glyphs;
 
124
    CompositeRectsProcPtr               CompositeRects;
 
125
#endif
 
126
} RACScreenRec, *RACScreenPtr;
 
127
 
 
128
typedef struct _RACGC {
 
129
    GCOps       *wrapOps;
 
130
    GCFuncs     *wrapFuncs;
 
131
} RACGCRec, *RACGCPtr;
 
132
 
 
133
/* Screen funcs */                   
 
134
static Bool RACCloseScreen (int i, ScreenPtr pScreen);
 
135
static void RACGetImage (DrawablePtr pDrawable, int sx, int sy,
 
136
                         int w, int h, unsigned int format,
 
137
                         unsigned long planemask, char *pdstLine);
 
138
static void RACGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr   ppt,
 
139
                         int *pwidth, int nspans, char  *pdstStart);
 
140
static void RACSourceValidate (DrawablePtr      pDrawable,
 
141
                               int x, int y, int width, int height );
 
142
static void RACPaintWindowBackground(WindowPtr pWin, RegionPtr prgn, int what);
 
143
static void RACPaintWindowBorder(WindowPtr pWin, RegionPtr prgn, int what);
 
144
static void RACCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
 
145
                          RegionPtr prgnSrc );
 
146
static void RACClearToBackground (WindowPtr pWin, int x, int y,
 
147
                                  int w, int h, Bool generateExposures );
 
148
static void RACSaveAreas (PixmapPtr pPixmap, RegionPtr prgnSave,
 
149
                          int xorg, int yorg, WindowPtr pWin);
 
150
static void RACRestoreAreas (PixmapPtr pPixmap, RegionPtr prgnRestore,
 
151
                             int xorg, int yorg, WindowPtr pWin);
 
152
static PixmapPtr RACCreatePixmap(ScreenPtr pScreen, int w, int h, int depth);
 
153
static Bool  RACCreateGC(GCPtr pGC);
 
154
static Bool RACSaveScreen(ScreenPtr pScreen, Bool unblank);
 
155
static void RACStoreColors (ColormapPtr pmap, int ndef, xColorItem *pdefs);
 
156
static void RACRecolorCursor (ScreenPtr pScreen, CursorPtr pCurs,
 
157
                              Bool displayed);
 
158
static Bool RACRealizeCursor (ScreenPtr   pScreen, CursorPtr   pCursor);
 
159
static Bool RACUnrealizeCursor (ScreenPtr   pScreen, CursorPtr   pCursor);
 
160
static Bool RACDisplayCursor (ScreenPtr pScreen, CursorPtr pCursor);
 
161
static Bool RACSetCursorPosition (ScreenPtr   pScreen, int x, int y,
 
162
                                  Bool generateEvent);
 
163
static void RACAdjustFrame(int index, int x, int y, int flags);
 
164
static Bool RACSwitchMode(int index, DisplayModePtr mode, int flags);
 
165
static Bool RACEnterVT(int index, int flags);
 
166
static void RACLeaveVT(int index, int flags);
 
167
static void RACFreeScreen(int index, int flags);
 
168
/* GC funcs */
 
169
static void RACValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
 
170
static void RACChangeGC(GCPtr pGC, unsigned long mask);
 
171
static void RACCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
 
172
static void RACDestroyGC(GCPtr pGC);
 
173
static void RACChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
 
174
static void RACDestroyClip(GCPtr pGC);
 
175
static void RACCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
 
176
/* GC ops */
 
177
static void RACFillSpans( DrawablePtr pDraw, GC *pGC, int nInit,        
 
178
                          DDXPointPtr pptInit, int *pwidthInit, int fSorted );
 
179
static void RACSetSpans(DrawablePtr pDraw, GCPtr pGC, char *pcharsrc,
 
180
                        register DDXPointPtr ppt, int *pwidth, int nspans,
 
181
                        int fSorted );
 
182
static void RACPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, 
 
183
                        int x, int y, int w, int h, int leftPad,
 
184
                        int format, char *pImage );
 
185
static RegionPtr RACCopyArea(DrawablePtr pSrc, DrawablePtr pDst,
 
186
                             GC *pGC, int srcx, int srcy,
 
187
                             int width, int height,
 
188
                             int dstx, int dsty );
 
189
static RegionPtr RACCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
 
190
                              GCPtr pGC, int srcx, int srcy,
 
191
                              int width, int height, int dstx, int dsty,
 
192
                              unsigned long bitPlane );
 
193
static void RACPolyPoint(DrawablePtr pDraw, GCPtr pGC, int mode,
 
194
                         int npt, xPoint *pptInit );
 
195
static void RACPolylines(DrawablePtr pDraw, GCPtr pGC, int mode,
 
196
                         int npt, DDXPointPtr pptInit );
 
197
static void RACPolySegment(DrawablePtr  pDraw, GCPtr pGC, int nseg,
 
198
                           xSegment     *pSeg );
 
199
static void RACPolyRectangle(DrawablePtr  pDraw, GCPtr pGC, int  nRectsInit,
 
200
                             xRectangle  *pRectsInit );
 
201
static void RACPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs,
 
202
                       xArc *parcs );
 
203
static void RACFillPolygon(DrawablePtr  pDraw, GCPtr pGC, int shape, int mode,
 
204
                           int count, DDXPointPtr ptsIn );
 
205
static void RACPolyFillRect( DrawablePtr pDraw, GCPtr   pGC, int nrectFill, 
 
206
                             xRectangle *prectInit );
 
207
static void RACPolyFillArc(DrawablePtr  pDraw, GCPtr pGC, int   narcs,
 
208
                           xArc *parcs );
 
209
static int RACPolyText8(DrawablePtr pDraw, GCPtr pGC, int x, int y,
 
210
                        int count,  char *chars );
 
211
static int RACPolyText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
 
212
                         int count, unsigned short *chars );
 
213
static void RACImageText8(DrawablePtr pDraw, GCPtr pGC, int x, int y,
 
214
                          int   count, char *chars );
 
215
static void RACImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
 
216
                           int  count, unsigned short *chars );
 
217
static void RACImageGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
 
218
                             int yInit, unsigned int nglyph,
 
219
                             CharInfoPtr *ppci, pointer pglyphBase );
 
220
static void RACPolyGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
 
221
                            int yInit, unsigned int nglyph,
 
222
                            CharInfoPtr *ppci, pointer pglyphBase );
 
223
static void RACPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDraw,
 
224
                          int dx, int dy, int xOrg, int yOrg );
 
225
/* miSpriteFuncs */
 
226
static Bool RACSpriteRealizeCursor(ScreenPtr pScreen, CursorPtr pCur);
 
227
static Bool RACSpriteUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCur);
 
228
static void RACSpriteSetCursor(ScreenPtr pScreen, CursorPtr pCur,
 
229
                               int x, int y);
 
230
static void RACSpriteMoveCursor(ScreenPtr pScreen, int x, int y);
 
231
#ifdef RENDER
 
232
static void RACComposite(CARD8 op, PicturePtr pSrc,  PicturePtr pMask,
 
233
                         PicturePtr pDst, INT16 xSrc, INT16 ySrc,
 
234
                         INT16 xMask, INT16 yMask, INT16 xDst,
 
235
                         INT16 yDst, CARD16 width, CARD16 height);
 
236
static void RACGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
 
237
                      PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
 
238
                      int nlist, GlyphListPtr list, GlyphPtr *glyphs);
 
239
static void RACCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color,
 
240
                              int nRect, xRectangle *rects);
 
241
#endif
 
242
 
 
243
GCFuncs RACGCFuncs = {
 
244
    RACValidateGC, RACChangeGC, RACCopyGC, RACDestroyGC,
 
245
    RACChangeClip, RACDestroyClip, RACCopyClip
 
246
};
 
247
 
 
248
GCOps RACGCOps = {
 
249
    RACFillSpans, RACSetSpans, RACPutImage, RACCopyArea, 
 
250
    RACCopyPlane, RACPolyPoint, RACPolylines, RACPolySegment, 
 
251
    RACPolyRectangle, RACPolyArc, RACFillPolygon, RACPolyFillRect, 
 
252
    RACPolyFillArc, RACPolyText8, RACPolyText16, RACImageText8, 
 
253
    RACImageText16, RACImageGlyphBlt, RACPolyGlyphBlt, RACPushPixels,
 
254
#ifdef NEED_LINEHELPER
 
255
    NULL,
 
256
#endif
 
257
    {NULL}              /* devPrivate */
 
258
};
 
259
 
 
260
miPointerSpriteFuncRec RACSpriteFuncs = {
 
261
    RACSpriteRealizeCursor, RACSpriteUnrealizeCursor, RACSpriteSetCursor,
 
262
    RACSpriteMoveCursor
 
263
};
 
264
 
 
265
int RACScreenIndex = -1;
 
266
int RACGCIndex = -1;
 
267
static unsigned long RACGeneration = 0;
 
268
 
 
269
 
 
270
Bool 
 
271
xf86RACInit(ScreenPtr pScreen, unsigned int flag)
 
272
{
 
273
    ScrnInfoPtr pScrn;
 
274
    RACScreenPtr pScreenPriv;
 
275
    miPointerScreenPtr PointPriv;
 
276
#ifdef RENDER
 
277
    PictureScreenPtr    ps = GetPictureScreenIfSet(pScreen);
 
278
#endif
 
279
 
 
280
    pScrn = xf86Screens[pScreen->myNum];
 
281
    PointPriv = (miPointerScreenPtr)pScreen->devPrivates[miPointerScreenIndex].ptr;
 
282
 
 
283
    DPRINT_S("RACInit",pScreen->myNum);
 
284
    if (RACGeneration != serverGeneration) {
 
285
        if (    ((RACScreenIndex = AllocateScreenPrivateIndex()) < 0) ||
 
286
                ((RACGCIndex = AllocateGCPrivateIndex()) < 0))
 
287
            return FALSE;
 
288
 
 
289
        RACGeneration = serverGeneration;
 
290
    }
 
291
 
 
292
    if (!AllocateGCPrivate(pScreen, RACGCIndex, sizeof(RACGCRec)))
 
293
        return FALSE;
 
294
 
 
295
    if (!(pScreenPriv = xalloc(sizeof(RACScreenRec))))
 
296
        return FALSE;
 
297
 
 
298
    pScreen->devPrivates[RACScreenIndex].ptr = (pointer)pScreenPriv;
 
299
    
 
300
    WRAP_SCREEN(CloseScreen, RACCloseScreen);
 
301
    WRAP_SCREEN(SaveScreen, RACSaveScreen);
 
302
    WRAP_SCREEN_COND(CreateGC, RACCreateGC, RAC_FB);
 
303
    WRAP_SCREEN_COND(GetImage, RACGetImage, RAC_FB);
 
304
    WRAP_SCREEN_COND(GetSpans, RACGetSpans, RAC_FB);
 
305
    WRAP_SCREEN_COND(SourceValidate, RACSourceValidate, RAC_FB);
 
306
    WRAP_SCREEN_COND(PaintWindowBackground, RACPaintWindowBackground, RAC_FB);
 
307
    WRAP_SCREEN_COND(PaintWindowBorder, RACPaintWindowBorder, RAC_FB);
 
308
    WRAP_SCREEN_COND(CopyWindow, RACCopyWindow, RAC_FB);
 
309
    WRAP_SCREEN_COND(ClearToBackground, RACClearToBackground, RAC_FB);
 
310
    WRAP_SCREEN_COND(CreatePixmap, RACCreatePixmap, RAC_FB);
 
311
    WRAP_SCREEN_COND(BackingStoreFuncs.RestoreAreas, RACRestoreAreas, RAC_FB);
 
312
    WRAP_SCREEN_COND(BackingStoreFuncs.SaveAreas, RACSaveAreas, RAC_FB);
 
313
    WRAP_SCREEN_COND(StoreColors, RACStoreColors, RAC_COLORMAP);
 
314
    WRAP_SCREEN_COND(DisplayCursor, RACDisplayCursor, RAC_CURSOR);
 
315
    WRAP_SCREEN_COND(RealizeCursor, RACRealizeCursor, RAC_CURSOR);
 
316
    WRAP_SCREEN_COND(UnrealizeCursor, RACUnrealizeCursor, RAC_CURSOR);
 
317
    WRAP_SCREEN_COND(RecolorCursor, RACRecolorCursor, RAC_CURSOR);
 
318
    WRAP_SCREEN_COND(SetCursorPosition, RACSetCursorPosition, RAC_CURSOR);
 
319
#ifdef RENDER
 
320
    WRAP_PICT_COND(Composite,RACComposite,RAC_FB);
 
321
    WRAP_PICT_COND(Glyphs,RACGlyphs,RAC_FB);    
 
322
    WRAP_PICT_COND(CompositeRects,RACCompositeRects,RAC_FB);    
 
323
#endif
 
324
    WRAP_SCREEN_INFO_COND(AdjustFrame, RACAdjustFrame, RAC_VIEWPORT);
 
325
    WRAP_SCREEN_INFO(SwitchMode, RACSwitchMode);
 
326
    WRAP_SCREEN_INFO(EnterVT, RACEnterVT);
 
327
    WRAP_SCREEN_INFO(LeaveVT, RACLeaveVT);
 
328
    WRAP_SCREEN_INFO(FreeScreen, RACFreeScreen);
 
329
    WRAP_SPRITE_COND(RAC_CURSOR);
 
330
 
 
331
    return TRUE;
 
332
}
 
333
 
 
334
/* Screen funcs */
 
335
static Bool
 
336
RACCloseScreen (int i, ScreenPtr pScreen)
 
337
{
 
338
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
 
339
    RACScreenPtr pScreenPriv = 
 
340
        (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr;
 
341
    miPointerScreenPtr PointPriv
 
342
        = (miPointerScreenPtr)pScreen->devPrivates[miPointerScreenIndex].ptr;
 
343
#ifdef RENDER
 
344
    PictureScreenPtr    ps = GetPictureScreenIfSet(pScreen);
 
345
#endif
 
346
 
 
347
    DPRINT_S("RACCloseScreen",pScreen->myNum);
 
348
    UNWRAP_SCREEN(CreateGC);
 
349
    UNWRAP_SCREEN(CloseScreen);
 
350
    UNWRAP_SCREEN(GetImage);
 
351
    UNWRAP_SCREEN(GetSpans);
 
352
    UNWRAP_SCREEN(SourceValidate);
 
353
    UNWRAP_SCREEN(PaintWindowBackground);
 
354
    UNWRAP_SCREEN(PaintWindowBorder);
 
355
    UNWRAP_SCREEN(CopyWindow);
 
356
    UNWRAP_SCREEN(ClearToBackground);
 
357
    UNWRAP_SCREEN(BackingStoreFuncs.RestoreAreas);
 
358
    UNWRAP_SCREEN(BackingStoreFuncs.SaveAreas);
 
359
    UNWRAP_SCREEN(SaveScreen);
 
360
    UNWRAP_SCREEN(StoreColors);
 
361
    UNWRAP_SCREEN(DisplayCursor);
 
362
    UNWRAP_SCREEN(RealizeCursor);
 
363
    UNWRAP_SCREEN(UnrealizeCursor);
 
364
    UNWRAP_SCREEN(RecolorCursor);
 
365
    UNWRAP_SCREEN(SetCursorPosition);
 
366
#ifdef RENDER
 
367
    UNWRAP_PICT(Composite);
 
368
    UNWRAP_PICT(Glyphs);    
 
369
    UNWRAP_PICT(CompositeRects);    
 
370
#endif
 
371
    UNWRAP_SCREEN_INFO(AdjustFrame);
 
372
    UNWRAP_SCREEN_INFO(SwitchMode);
 
373
    UNWRAP_SCREEN_INFO(EnterVT);
 
374
    UNWRAP_SCREEN_INFO(LeaveVT);
 
375
    UNWRAP_SCREEN_INFO(FreeScreen);
 
376
    UNWRAP_SPRITE;
 
377
        
 
378
    xfree ((pointer) pScreenPriv);
 
379
 
 
380
    if (xf86Screens[pScreen->myNum]->vtSema) {
 
381
        xf86EnterServerState(SETUP);
 
382
        ENABLE;
 
383
    }
 
384
    return (*pScreen->CloseScreen) (i, pScreen);
 
385
}
 
386
 
 
387
static void
 
388
RACGetImage (
 
389
    DrawablePtr pDrawable,
 
390
    int sx, int sy, int w, int h,
 
391
    unsigned int    format,
 
392
    unsigned long   planemask,
 
393
    char            *pdstLine 
 
394
    )
 
395
{
 
396
    ScreenPtr pScreen = pDrawable->pScreen;
 
397
    DPRINT_S("RACGetImage",pScreen->myNum);
 
398
    SCREEN_PROLOG(GetImage);
 
399
    if (xf86Screens[pScreen->myNum]->vtSema) {
 
400
        ENABLE;
 
401
    }
 
402
    (*pScreen->GetImage) (pDrawable, sx, sy, w, h,
 
403
                          format, planemask, pdstLine);
 
404
    SCREEN_EPILOG (GetImage, RACGetImage);
 
405
}
 
406
 
 
407
static void
 
408
RACGetSpans (
 
409
    DrawablePtr pDrawable,
 
410
    int         wMax,
 
411
    DDXPointPtr ppt,
 
412
    int         *pwidth,
 
413
    int         nspans,
 
414
    char        *pdstStart
 
415
    )
 
416
{
 
417
    ScreenPtr       pScreen = pDrawable->pScreen;
 
418
 
 
419
    DPRINT_S("RACGetSpans",pScreen->myNum);
 
420
    SCREEN_PROLOG (GetSpans);
 
421
    ENABLE;
 
422
    (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
 
423
    SCREEN_EPILOG (GetSpans, RACGetSpans);
 
424
}
 
425
 
 
426
static void
 
427
RACSourceValidate (
 
428
    DrawablePtr pDrawable,
 
429
    int x, int y, int width, int height )
 
430
{
 
431
    ScreenPtr   pScreen = pDrawable->pScreen;
 
432
    DPRINT_S("RACSourceValidate",pScreen->myNum);
 
433
    SCREEN_PROLOG (SourceValidate);
 
434
    ENABLE;
 
435
    if (pScreen->SourceValidate)
 
436
        (*pScreen->SourceValidate) (pDrawable, x, y, width, height);
 
437
    SCREEN_EPILOG (SourceValidate, RACSourceValidate);
 
438
}
 
439
 
 
440
static void
 
441
RACPaintWindowBackground(
 
442
  WindowPtr pWin,
 
443
  RegionPtr prgn,
 
444
  int what 
 
445
  )
 
446
{
 
447
    ScreenPtr pScreen = pWin->drawable.pScreen;
 
448
 
 
449
    DPRINT_S("RACPaintWindowBackground",pScreen->myNum);
 
450
    SCREEN_PROLOG (PaintWindowBackground);
 
451
    ENABLE;
 
452
    (*pScreen->PaintWindowBackground) (pWin, prgn, what);
 
453
    SCREEN_EPILOG (PaintWindowBackground, RACPaintWindowBackground);
 
454
}
 
455
 
 
456
static void
 
457
RACPaintWindowBorder(
 
458
  WindowPtr pWin,
 
459
  RegionPtr prgn,
 
460
  int what 
 
461
)
 
462
{
 
463
    ScreenPtr pScreen = pWin->drawable.pScreen;
 
464
 
 
465
    DPRINT_S("RACPaintWindowBorder",pScreen->myNum);
 
466
    SCREEN_PROLOG (PaintWindowBorder);
 
467
    ENABLE;
 
468
    (*pScreen->PaintWindowBorder) (pWin, prgn, what);
 
469
    SCREEN_EPILOG (PaintWindowBorder, RACPaintWindowBorder);
 
470
}
 
471
 
 
472
static void
 
473
RACCopyWindow(
 
474
    WindowPtr pWin,
 
475
    DDXPointRec ptOldOrg,
 
476
    RegionPtr prgnSrc )
 
477
{
 
478
    ScreenPtr pScreen = pWin->drawable.pScreen;
 
479
 
 
480
    DPRINT_S("RACCopyWindow",pScreen->myNum);
 
481
    SCREEN_PROLOG (CopyWindow);
 
482
    ENABLE;
 
483
    (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
 
484
    SCREEN_EPILOG (CopyWindow, RACCopyWindow);
 
485
}
 
486
 
 
487
static void
 
488
RACClearToBackground (
 
489
    WindowPtr pWin,
 
490
    int x, int y,
 
491
    int w, int h,
 
492
    Bool generateExposures )
 
493
{
 
494
    ScreenPtr pScreen = pWin->drawable.pScreen;
 
495
 
 
496
    DPRINT_S("RACClearToBackground",pScreen->myNum);
 
497
    SCREEN_PROLOG ( ClearToBackground);
 
498
    ENABLE;
 
499
    (*pScreen->ClearToBackground) (pWin, x, y, w, h, generateExposures);
 
500
    SCREEN_EPILOG (ClearToBackground, RACClearToBackground);
 
501
}
 
502
 
 
503
static void
 
504
RACSaveAreas (
 
505
    PixmapPtr pPixmap,
 
506
    RegionPtr prgnSave,
 
507
    int       xorg,
 
508
    int       yorg,
 
509
    WindowPtr pWin
 
510
    )
 
511
{
 
512
    ScreenPtr pScreen = pPixmap->drawable.pScreen;
 
513
    DPRINT_S("RACSaveAreas",pScreen->myNum);
 
514
    SCREEN_PROLOG (BackingStoreFuncs.SaveAreas);
 
515
    ENABLE;
 
516
    (*pScreen->BackingStoreFuncs.SaveAreas) (
 
517
        pPixmap, prgnSave, xorg, yorg, pWin);
 
518
 
 
519
    SCREEN_EPILOG (BackingStoreFuncs.SaveAreas, RACSaveAreas);
 
520
}
 
521
 
 
522
static void
 
523
RACRestoreAreas (    
 
524
    PixmapPtr pPixmap,
 
525
    RegionPtr prgnRestore,
 
526
    int       xorg,
 
527
    int       yorg,
 
528
    WindowPtr pWin 
 
529
    )
 
530
{
 
531
    ScreenPtr pScreen = pPixmap->drawable.pScreen;
 
532
 
 
533
    DPRINT_S("RACRestoreAreas",pScreen->myNum);
 
534
    SCREEN_PROLOG (BackingStoreFuncs.RestoreAreas);
 
535
    ENABLE;
 
536
    (*pScreen->BackingStoreFuncs.RestoreAreas) (
 
537
        pPixmap, prgnRestore, xorg, yorg, pWin);
 
538
 
 
539
    SCREEN_EPILOG ( BackingStoreFuncs.RestoreAreas, RACRestoreAreas);
 
540
}
 
541
 
 
542
static PixmapPtr 
 
543
RACCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
 
544
{
 
545
    PixmapPtr pPix;
 
546
 
 
547
    DPRINT_S("RACCreatePixmap",pScreen->myNum);
 
548
    SCREEN_PROLOG ( CreatePixmap);
 
549
    ENABLE;
 
550
    pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth);
 
551
    SCREEN_EPILOG (CreatePixmap, RACCreatePixmap);
 
552
 
 
553
    return pPix;
 
554
}
 
555
 
 
556
static Bool 
 
557
RACSaveScreen(ScreenPtr pScreen, Bool unblank)
 
558
{
 
559
    Bool val;
 
560
 
 
561
    DPRINT_S("RACSaveScreen",pScreen->myNum);
 
562
    SCREEN_PROLOG (SaveScreen);
 
563
    ENABLE;
 
564
    val = (*pScreen->SaveScreen) (pScreen, unblank);
 
565
    SCREEN_EPILOG (SaveScreen, RACSaveScreen);
 
566
 
 
567
    return val;
 
568
}
 
569
 
 
570
static void
 
571
RACStoreColors (
 
572
    ColormapPtr        pmap,
 
573
    int                ndef,
 
574
    xColorItem         *pdefs)
 
575
{
 
576
    ScreenPtr pScreen = pmap->pScreen;
 
577
 
 
578
    DPRINT_S("RACStoreColors",pScreen->myNum);
 
579
    SCREEN_PROLOG (StoreColors);
 
580
    ENABLE;
 
581
    (*pScreen->StoreColors) (pmap,ndef,pdefs);
 
582
 
 
583
    SCREEN_EPILOG ( StoreColors, RACStoreColors);
 
584
}
 
585
 
 
586
static void
 
587
RACRecolorCursor (    
 
588
    ScreenPtr pScreen,
 
589
    CursorPtr pCurs,
 
590
    Bool displayed
 
591
    )
 
592
{
 
593
    DPRINT_S("RACRecolorCursor",pScreen->myNum);
 
594
    SCREEN_PROLOG (RecolorCursor);
 
595
    ENABLE;
 
596
    (*pScreen->RecolorCursor) (pScreen,pCurs,displayed);
 
597
    
 
598
    SCREEN_EPILOG ( RecolorCursor, RACRecolorCursor);
 
599
}
 
600
 
 
601
static Bool
 
602
RACRealizeCursor (    
 
603
    ScreenPtr   pScreen,
 
604
    CursorPtr   pCursor
 
605
    )
 
606
{
 
607
    Bool val;
 
608
 
 
609
    DPRINT_S("RACRealizeCursor",pScreen->myNum);
 
610
    SCREEN_PROLOG (RealizeCursor);
 
611
    ENABLE;
 
612
    val = (*pScreen->RealizeCursor) (pScreen,pCursor);
 
613
    
 
614
    SCREEN_EPILOG ( RealizeCursor, RACRealizeCursor);
 
615
    return val;
 
616
}
 
617
 
 
618
static Bool
 
619
RACUnrealizeCursor (    
 
620
    ScreenPtr   pScreen,
 
621
    CursorPtr   pCursor
 
622
    )
 
623
{
 
624
    Bool val;
 
625
 
 
626
    DPRINT_S("RACUnrealizeCursor",pScreen->myNum);
 
627
    SCREEN_PROLOG (UnrealizeCursor);
 
628
    ENABLE;
 
629
    val = (*pScreen->UnrealizeCursor) (pScreen,pCursor);
 
630
    
 
631
    SCREEN_EPILOG ( UnrealizeCursor, RACUnrealizeCursor);
 
632
    return val;
 
633
}
 
634
 
 
635
static Bool
 
636
RACDisplayCursor (    
 
637
    ScreenPtr   pScreen,
 
638
    CursorPtr   pCursor
 
639
    )
 
640
{
 
641
    Bool val;
 
642
 
 
643
    DPRINT_S("RACDisplayCursor",pScreen->myNum);
 
644
    SCREEN_PROLOG (DisplayCursor);
 
645
    ENABLE;
 
646
    val = (*pScreen->DisplayCursor) (pScreen,pCursor);
 
647
    
 
648
    SCREEN_EPILOG ( DisplayCursor, RACDisplayCursor);
 
649
    return val;
 
650
}
 
651
 
 
652
static Bool
 
653
RACSetCursorPosition (    
 
654
    ScreenPtr   pScreen,
 
655
    int x, int y,
 
656
    Bool generateEvent)
 
657
{
 
658
    Bool val;
 
659
 
 
660
    DPRINT_S("RACSetCursorPosition",pScreen->myNum);
 
661
    SCREEN_PROLOG (SetCursorPosition);
 
662
    ENABLE;
 
663
    val = (*pScreen->SetCursorPosition) (pScreen,x,y,generateEvent);
 
664
    
 
665
    SCREEN_EPILOG ( SetCursorPosition, RACSetCursorPosition);
 
666
    return val;
 
667
}
 
668
 
 
669
static void
 
670
RACAdjustFrame(int index, int x, int y, int flags)
 
671
{
 
672
    ScreenPtr pScreen = screenInfo.screens[index];
 
673
    RACScreenPtr pScreenPriv =
 
674
        (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr;
 
675
 
 
676
    DPRINT_S("RACAdjustFrame",index);
 
677
    xf86EnableAccess(xf86Screens[index]);
 
678
 
 
679
    (*pScreenPriv->AdjustFrame)(index, x, y, flags);
 
680
}
 
681
 
 
682
static Bool
 
683
RACSwitchMode(int index, DisplayModePtr mode, int flags)
 
684
{
 
685
    ScreenPtr pScreen = screenInfo.screens[index];
 
686
    RACScreenPtr pScreenPriv =
 
687
        (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr;
 
688
 
 
689
    DPRINT_S("RACSwitchMode",index);
 
690
    xf86EnableAccess(xf86Screens[index]);
 
691
 
 
692
    return (*pScreenPriv->SwitchMode)(index, mode, flags);
 
693
}
 
694
 
 
695
static Bool
 
696
RACEnterVT(int index, int flags)
 
697
{
 
698
    ScreenPtr pScreen = screenInfo.screens[index];
 
699
    RACScreenPtr pScreenPriv =
 
700
        (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr;
 
701
 
 
702
    DPRINT_S("RACEnterVT",index);
 
703
    xf86EnableAccess(xf86Screens[index]);
 
704
 
 
705
    return (*pScreenPriv->EnterVT)(index, flags);
 
706
}
 
707
 
 
708
static void
 
709
RACLeaveVT(int index, int flags)
 
710
{
 
711
    ScreenPtr pScreen = screenInfo.screens[index];
 
712
    RACScreenPtr pScreenPriv =
 
713
        (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr;
 
714
 
 
715
    DPRINT_S("RACLeaveVT",index);
 
716
    xf86EnableAccess(xf86Screens[index]);
 
717
 
 
718
    (*pScreenPriv->LeaveVT)(index, flags);
 
719
}
 
720
 
 
721
static void
 
722
RACFreeScreen(int index, int flags)
 
723
{
 
724
    ScreenPtr pScreen = screenInfo.screens[index];
 
725
    RACScreenPtr pScreenPriv =
 
726
        (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr;
 
727
 
 
728
    DPRINT_S("RACFreeScreen",index);
 
729
    xf86EnableAccess(xf86Screens[index]);
 
730
 
 
731
    (*pScreenPriv->FreeScreen)(index, flags);
 
732
}
 
733
 
 
734
static Bool
 
735
RACCreateGC(GCPtr pGC)
 
736
{
 
737
    ScreenPtr    pScreen = pGC->pScreen;
 
738
    RACGCPtr     pGCPriv = (RACGCPtr) (pGC)->devPrivates[RACGCIndex].ptr;
 
739
    Bool         ret;
 
740
 
 
741
    DPRINT_S("RACCreateGC",pScreen->myNum);
 
742
    SCREEN_PROLOG(CreateGC);
 
743
 
 
744
    ret = (*pScreen->CreateGC)(pGC);
 
745
        
 
746
    GC_WRAP(pGC);
 
747
    SCREEN_EPILOG(CreateGC,RACCreateGC);
 
748
 
 
749
    return ret;
 
750
}
 
751
 
 
752
/* GC funcs */
 
753
static void
 
754
RACValidateGC(
 
755
   GCPtr         pGC,
 
756
   unsigned long changes,
 
757
   DrawablePtr   pDraw )
 
758
{
 
759
    GC_UNWRAP(pGC);
 
760
    DPRINT("RACValidateGC");
 
761
    (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
 
762
    GC_WRAP(pGC);
 
763
}
 
764
 
 
765
 
 
766
static void
 
767
RACDestroyGC(GCPtr pGC)
 
768
{
 
769
    GC_UNWRAP (pGC);
 
770
    DPRINT("RACDestroyGC");
 
771
    (*pGC->funcs->DestroyGC)(pGC);
 
772
    GC_WRAP (pGC);
 
773
}
 
774
 
 
775
static void
 
776
RACChangeGC (
 
777
    GCPtr           pGC,
 
778
    unsigned long   mask)
 
779
{
 
780
    GC_UNWRAP (pGC);
 
781
    DPRINT("RACChangeGC");
 
782
    (*pGC->funcs->ChangeGC) (pGC, mask);
 
783
    GC_WRAP (pGC);
 
784
}
 
785
 
 
786
static void
 
787
RACCopyGC (
 
788
    GCPtr           pGCSrc, 
 
789
    unsigned long   mask,
 
790
    GCPtr           pGCDst)
 
791
{
 
792
    GC_UNWRAP (pGCDst);
 
793
    DPRINT("RACCopyGC");
 
794
    (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
 
795
    GC_WRAP (pGCDst);
 
796
}
 
797
 
 
798
static void
 
799
RACChangeClip (
 
800
    GCPtr   pGC,
 
801
    int         type,
 
802
    pointer     pvalue,
 
803
    int         nrects )
 
804
{
 
805
    GC_UNWRAP (pGC);
 
806
    DPRINT("RACChangeClip");
 
807
    (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
 
808
    GC_WRAP (pGC);
 
809
}
 
810
 
 
811
static void
 
812
RACCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
 
813
{
 
814
    GC_UNWRAP (pgcDst);
 
815
    DPRINT("RACCopyClip");
 
816
    (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
 
817
    GC_WRAP (pgcDst);
 
818
}
 
819
 
 
820
static void
 
821
RACDestroyClip(GCPtr pGC)
 
822
{
 
823
    GC_UNWRAP (pGC);
 
824
    DPRINT("RACDestroyClip");
 
825
    (* pGC->funcs->DestroyClip)(pGC);
 
826
    GC_WRAP (pGC);
 
827
}
 
828
 
 
829
/* GC Ops */
 
830
static void
 
831
RACFillSpans(
 
832
    DrawablePtr pDraw,
 
833
    GC          *pGC,
 
834
    int         nInit,  
 
835
    DDXPointPtr pptInit,        
 
836
    int *pwidthInit,            
 
837
    int fSorted )
 
838
{
 
839
    GC_UNWRAP(pGC);
 
840
    DPRINT("RACFillSpans");
 
841
    ENABLE_GC;
 
842
    (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
 
843
    GC_WRAP(pGC);
 
844
}
 
845
 
 
846
static void
 
847
RACSetSpans(
 
848
    DrawablePtr         pDraw,
 
849
    GCPtr               pGC,
 
850
    char                *pcharsrc,
 
851
    register DDXPointPtr ppt,
 
852
    int                 *pwidth,
 
853
    int                 nspans,
 
854
    int                 fSorted )
 
855
{
 
856
    GC_UNWRAP(pGC);
 
857
    DPRINT("RACSetSpans");
 
858
    ENABLE_GC;
 
859
    (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
 
860
    GC_WRAP(pGC);
 
861
}
 
862
 
 
863
static void
 
864
RACPutImage(
 
865
    DrawablePtr pDraw,
 
866
    GCPtr       pGC,
 
867
    int         depth, 
 
868
    int x, int y, int w, int h,
 
869
    int         leftPad,
 
870
    int         format,
 
871
    char        *pImage )
 
872
{
 
873
    GC_UNWRAP(pGC);
 
874
    DPRINT("RACPutImage");
 
875
    ENABLE_GC;
 
876
    (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h, 
 
877
                          leftPad, format, pImage);
 
878
    GC_WRAP(pGC);
 
879
}
 
880
 
 
881
static RegionPtr
 
882
RACCopyArea(
 
883
    DrawablePtr pSrc,
 
884
    DrawablePtr pDst,
 
885
    GC *pGC,
 
886
    int srcx, int srcy,
 
887
    int width, int height,
 
888
    int dstx, int dsty )
 
889
{
 
890
    RegionPtr ret;
 
891
 
 
892
    GC_UNWRAP(pGC);
 
893
    DPRINT("RACCopyArea");
 
894
    ENABLE_GC;
 
895
    ret = (*pGC->ops->CopyArea)(pSrc, pDst,
 
896
                                pGC, srcx, srcy, width, height, dstx, dsty);
 
897
    GC_WRAP(pGC);
 
898
    return ret;
 
899
}
 
900
 
 
901
static RegionPtr
 
902
RACCopyPlane(
 
903
    DrawablePtr pSrc,
 
904
    DrawablePtr pDst,
 
905
    GCPtr pGC,
 
906
    int srcx, int srcy,
 
907
    int width, int height,
 
908
    int dstx, int dsty,
 
909
    unsigned long bitPlane )
 
910
{
 
911
    RegionPtr ret;
 
912
 
 
913
    GC_UNWRAP(pGC);
 
914
    DPRINT("RACCopyPlane");
 
915
    ENABLE_GC;
 
916
    ret = (*pGC->ops->CopyPlane)(pSrc, pDst, pGC, srcx, srcy,
 
917
                                 width, height, dstx, dsty, bitPlane);
 
918
    GC_WRAP(pGC);
 
919
    return ret;
 
920
}
 
921
 
 
922
static void
 
923
RACPolyPoint(
 
924
    DrawablePtr pDraw,
 
925
    GCPtr pGC,
 
926
    int mode,
 
927
    int npt,
 
928
    xPoint *pptInit )
 
929
{
 
930
    GC_UNWRAP(pGC);
 
931
    DPRINT("RACPolyPoint");
 
932
    ENABLE_GC;
 
933
    (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
 
934
    GC_WRAP(pGC);
 
935
}
 
936
 
 
937
 
 
938
static void
 
939
RACPolylines(
 
940
    DrawablePtr pDraw,
 
941
    GCPtr       pGC,
 
942
    int         mode,           
 
943
    int         npt,            
 
944
    DDXPointPtr pptInit )
 
945
{
 
946
    GC_UNWRAP(pGC);
 
947
    DPRINT("RACPolylines");
 
948
    ENABLE_GC;
 
949
    (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
 
950
    GC_WRAP(pGC);
 
951
}
 
952
 
 
953
static void 
 
954
RACPolySegment(
 
955
    DrawablePtr pDraw,
 
956
    GCPtr       pGC,
 
957
    int         nseg,
 
958
    xSegment    *pSeg )
 
959
{
 
960
    GC_UNWRAP(pGC);
 
961
    DPRINT("RACPolySegment");
 
962
    ENABLE_GC;
 
963
    (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
 
964
    GC_WRAP(pGC);
 
965
}
 
966
 
 
967
static void
 
968
RACPolyRectangle(
 
969
    DrawablePtr  pDraw,
 
970
    GCPtr        pGC,
 
971
    int          nRectsInit,
 
972
    xRectangle  *pRectsInit )
 
973
{
 
974
    GC_UNWRAP(pGC);
 
975
    DPRINT("RACPolyRectangle");
 
976
    ENABLE_GC;
 
977
    (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
 
978
    GC_WRAP(pGC);
 
979
}
 
980
 
 
981
static void
 
982
RACPolyArc(
 
983
    DrawablePtr pDraw,
 
984
    GCPtr       pGC,
 
985
    int         narcs,
 
986
    xArc        *parcs )
 
987
{
 
988
    GC_UNWRAP(pGC);
 
989
    DPRINT("RACPolyArc");
 
990
    ENABLE_GC;
 
991
    (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
 
992
    GC_WRAP(pGC);
 
993
}
 
994
 
 
995
static void
 
996
RACFillPolygon(
 
997
    DrawablePtr pDraw,
 
998
    GCPtr       pGC,
 
999
    int         shape,
 
1000
    int         mode,
 
1001
    int         count,
 
1002
    DDXPointPtr ptsIn )
 
1003
{
 
1004
    GC_UNWRAP(pGC);
 
1005
    DPRINT("RACFillPolygon");
 
1006
    ENABLE_GC;
 
1007
    (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
 
1008
    GC_WRAP(pGC);
 
1009
}
 
1010
 
 
1011
 
 
1012
static void 
 
1013
RACPolyFillRect(
 
1014
    DrawablePtr pDraw,
 
1015
    GCPtr       pGC,
 
1016
    int         nrectFill, 
 
1017
    xRectangle  *prectInit )  
 
1018
{
 
1019
    GC_UNWRAP(pGC);
 
1020
    DPRINT("RACPolyFillRect");
 
1021
    ENABLE_GC;
 
1022
    (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
 
1023
    GC_WRAP(pGC);
 
1024
}
 
1025
 
 
1026
 
 
1027
static void
 
1028
RACPolyFillArc(
 
1029
    DrawablePtr pDraw,
 
1030
    GCPtr       pGC,
 
1031
    int         narcs,
 
1032
    xArc        *parcs )
 
1033
{
 
1034
    GC_UNWRAP(pGC);
 
1035
    DPRINT("RACPolyFillArc");
 
1036
    ENABLE_GC;
 
1037
    (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
 
1038
    GC_WRAP(pGC);
 
1039
}
 
1040
 
 
1041
static int
 
1042
RACPolyText8(
 
1043
    DrawablePtr pDraw,
 
1044
    GCPtr       pGC,
 
1045
    int         x, 
 
1046
    int         y,
 
1047
    int         count,
 
1048
    char        *chars )
 
1049
{
 
1050
    int ret;
 
1051
 
 
1052
    GC_UNWRAP(pGC);
 
1053
    DPRINT("RACPolyText8");
 
1054
    ENABLE_GC;
 
1055
    ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
 
1056
    GC_WRAP(pGC);
 
1057
    return ret;
 
1058
}
 
1059
 
 
1060
static int
 
1061
RACPolyText16(
 
1062
    DrawablePtr pDraw,
 
1063
    GCPtr       pGC,
 
1064
    int         x,
 
1065
    int         y,
 
1066
    int         count,
 
1067
    unsigned short *chars )
 
1068
{
 
1069
    int ret;
 
1070
 
 
1071
    GC_UNWRAP(pGC);
 
1072
    DPRINT("RACPolyText16");
 
1073
    ENABLE_GC;
 
1074
    ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
 
1075
    GC_WRAP(pGC);
 
1076
    return ret;
 
1077
}
 
1078
 
 
1079
static void
 
1080
RACImageText8(
 
1081
    DrawablePtr pDraw,
 
1082
    GCPtr       pGC,
 
1083
    int         x, 
 
1084
    int         y,
 
1085
    int         count,
 
1086
    char        *chars )
 
1087
{
 
1088
    GC_UNWRAP(pGC);
 
1089
    DPRINT("RACImageText8");
 
1090
    ENABLE_GC;
 
1091
    (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
 
1092
    GC_WRAP(pGC);
 
1093
}
 
1094
 
 
1095
static void
 
1096
RACImageText16(
 
1097
    DrawablePtr pDraw,
 
1098
    GCPtr       pGC,
 
1099
    int         x,
 
1100
    int         y,
 
1101
    int         count,
 
1102
    unsigned short *chars )
 
1103
{
 
1104
    GC_UNWRAP(pGC);
 
1105
    DPRINT("RACImageText16");
 
1106
    ENABLE_GC;
 
1107
    (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
 
1108
    GC_WRAP(pGC);
 
1109
}
 
1110
 
 
1111
 
 
1112
static void
 
1113
RACImageGlyphBlt(
 
1114
    DrawablePtr pDraw,
 
1115
    GCPtr pGC,
 
1116
    int xInit, int yInit,
 
1117
    unsigned int nglyph,
 
1118
    CharInfoPtr *ppci,
 
1119
    pointer pglyphBase )
 
1120
{
 
1121
    GC_UNWRAP(pGC);
 
1122
    DPRINT("RACImageGlyphBlt");
 
1123
    ENABLE_GC;
 
1124
    (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit,
 
1125
                               nglyph, ppci, pglyphBase);
 
1126
    GC_WRAP(pGC);
 
1127
}
 
1128
 
 
1129
static void
 
1130
RACPolyGlyphBlt(
 
1131
    DrawablePtr pDraw,
 
1132
    GCPtr pGC,
 
1133
    int xInit, int yInit,
 
1134
    unsigned int nglyph,
 
1135
    CharInfoPtr *ppci,
 
1136
    pointer pglyphBase )
 
1137
{
 
1138
    GC_UNWRAP(pGC);
 
1139
    DPRINT("RACPolyGlyphBlt");
 
1140
    ENABLE_GC;
 
1141
    (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit,
 
1142
                              nglyph, ppci, pglyphBase);
 
1143
    GC_WRAP(pGC);
 
1144
}
 
1145
 
 
1146
static void
 
1147
RACPushPixels(
 
1148
    GCPtr       pGC,
 
1149
    PixmapPtr   pBitMap,
 
1150
    DrawablePtr pDraw,
 
1151
    int dx, int dy, int xOrg, int yOrg )
 
1152
{
 
1153
    GC_UNWRAP(pGC);
 
1154
    DPRINT("RACPushPixels");
 
1155
    ENABLE_GC;
 
1156
    (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
 
1157
    GC_WRAP(pGC);
 
1158
}
 
1159
 
 
1160
 
 
1161
/* miSpriteFuncs */
 
1162
static Bool
 
1163
RACSpriteRealizeCursor(ScreenPtr pScreen, CursorPtr pCur)
 
1164
{
 
1165
    Bool val;
 
1166
    SPRITE_PROLOG;
 
1167
    DPRINT_S("RACSpriteRealizeCursor",pScreen->myNum);
 
1168
    ENABLE;
 
1169
    val = PointPriv->spriteFuncs->RealizeCursor(pScreen, pCur);
 
1170
    SPRITE_EPILOG;
 
1171
    return val;
 
1172
}
 
1173
 
 
1174
static Bool
 
1175
RACSpriteUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCur)
 
1176
{
 
1177
    Bool val;
 
1178
    SPRITE_PROLOG;
 
1179
    DPRINT_S("RACSpriteUnrealizeCursor",pScreen->myNum);
 
1180
    ENABLE;
 
1181
    val = PointPriv->spriteFuncs->UnrealizeCursor(pScreen, pCur);
 
1182
    SPRITE_EPILOG;
 
1183
    return val;
 
1184
}
 
1185
 
 
1186
static void
 
1187
RACSpriteSetCursor(ScreenPtr pScreen, CursorPtr pCur, int x, int y)
 
1188
{
 
1189
    SPRITE_PROLOG;
 
1190
    DPRINT_S("RACSpriteSetCursor",pScreen->myNum);
 
1191
    ENABLE;
 
1192
    PointPriv->spriteFuncs->SetCursor(pScreen, pCur, x, y);
 
1193
    SPRITE_EPILOG;
 
1194
}
 
1195
 
 
1196
static void
 
1197
RACSpriteMoveCursor(ScreenPtr pScreen, int x, int y)
 
1198
{
 
1199
    SPRITE_PROLOG;
 
1200
    DPRINT_S("RACSpriteMoveCursor",pScreen->myNum);
 
1201
    ENABLE;
 
1202
    PointPriv->spriteFuncs->MoveCursor(pScreen, x, y);
 
1203
    SPRITE_EPILOG;
 
1204
}
 
1205
 
 
1206
#ifdef RENDER
 
1207
static void
 
1208
RACComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
 
1209
             PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask,
 
1210
             INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width,
 
1211
             CARD16 height)
 
1212
{
 
1213
    ScreenPtr           pScreen = pDst->pDrawable->pScreen;
 
1214
    PictureScreenPtr    ps = GetPictureScreen(pScreen);
 
1215
 
 
1216
    PICTURE_PROLOGUE(Composite);
 
1217
 
 
1218
    ENABLE;
 
1219
    (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst,
 
1220
                      yDst, width, height);
 
1221
    
 
1222
    PICTURE_EPILOGUE(Composite, RACComposite);
 
1223
}
 
1224
 
 
1225
static void
 
1226
RACGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
 
1227
          PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist,
 
1228
          GlyphListPtr list, GlyphPtr *glyphs)
 
1229
{
 
1230
    ScreenPtr           pScreen = pDst->pDrawable->pScreen;
 
1231
    PictureScreenPtr    ps = GetPictureScreen(pScreen);
 
1232
 
 
1233
    PICTURE_PROLOGUE(Glyphs);
 
1234
 
 
1235
    ENABLE;
 
1236
    (*ps->Glyphs)(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
 
1237
    
 
1238
    PICTURE_EPILOGUE (Glyphs, RACGlyphs);
 
1239
}
 
1240
 
 
1241
static void
 
1242
RACCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect,
 
1243
                  xRectangle *rects)
 
1244
{
 
1245
    ScreenPtr           pScreen = pDst->pDrawable->pScreen;
 
1246
    PictureScreenPtr    ps = GetPictureScreen(pScreen);
 
1247
 
 
1248
    PICTURE_PROLOGUE(CompositeRects);
 
1249
 
 
1250
    ENABLE;
 
1251
    (*ps->CompositeRects)(op, pDst, color, nRect, rects);
 
1252
    
 
1253
    PICTURE_EPILOGUE (CompositeRects, RACCompositeRects);
 
1254
}
 
1255
#endif
 
1256