summaryrefslogtreecommitdiff
path: root/hw/xfree86/xaa/xaaFallback.c
blob: da7a38ea9afec14c9f4e852d810aedc922a4b0db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaFallback.c,v 1.4 1999/03/14 11:18:09 dawes Exp $ */

#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif

#include "misc.h"
#include "xf86.h"
#include "xf86_OSproc.h"

#include <X11/X.h>
#include "scrnintstr.h"
#include "xf86str.h"
#include "xaa.h"
#include "xaalocal.h"
#include "gcstruct.h"
#include "pixmapstr.h"
#include "xaawrap.h"



static void
XAAFillSpansFallback(
    DrawablePtr pDraw,
    GC		*pGC,
    int		nInit,	
    DDXPointPtr pptInit,	
    int *pwidthInit,		
    int fSorted )
{
    XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
    SYNC_CHECK(pGC);
    (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
    XAA_GC_OP_EPILOGUE(pGC);
}

static void
XAASetSpansFallback(
    DrawablePtr		pDraw,
    GCPtr		pGC,
    char		*pcharsrc,
    register DDXPointPtr ppt,
    int			*pwidth,
    int			nspans,
    int			fSorted )
{
    XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
    SYNC_CHECK(pGC);
    (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
    XAA_GC_OP_EPILOGUE(pGC);
}

static void
XAAPutImageFallback(
    DrawablePtr pDraw,
    GCPtr	pGC,
    int		depth, 
    int x, int y, int w, int h,
    int		leftPad,
    int		format,
    char 	*pImage )
{
    XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
    SYNC_CHECK(pGC);
    (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h, 
		leftPad, format, pImage);
    XAA_GC_OP_EPILOGUE(pGC);
}

static RegionPtr
XAACopyAreaFallback(
    DrawablePtr pSrc,
    DrawablePtr pDst,
    GC *pGC,
    int srcx, int srcy,
    int width, int height,
    int dstx, int dsty )
{
    RegionPtr ret;

    XAA_GC_OP_PROLOGUE(pGC);
    if((pSrc->type == DRAWABLE_WINDOW) || (pDst->type == DRAWABLE_WINDOW) ||
	IS_OFFSCREEN_PIXMAP(pSrc) || IS_OFFSCREEN_PIXMAP(pDst)) {
	SYNC_CHECK(pGC);
    }
    ret = (*pGC->ops->CopyArea)(pSrc, pDst,
            pGC, srcx, srcy, width, height, dstx, dsty);
    XAA_GC_OP_EPILOGUE(pGC);
    return ret;
}

static RegionPtr
XAACopyPlaneFallback(
    DrawablePtr	pSrc,
    DrawablePtr	pDst,
    GCPtr pGC,
    int	srcx, int srcy,
    int	width, int height,
    int	dstx, int dsty,
    unsigned long bitPlane )
{
    RegionPtr ret;

    XAA_GC_OP_PROLOGUE(pGC);
    if((pSrc->type == DRAWABLE_WINDOW) || (pDst->type == DRAWABLE_WINDOW) ||
	IS_OFFSCREEN_PIXMAP(pSrc) || IS_OFFSCREEN_PIXMAP(pDst)) {
	SYNC_CHECK(pGC);
    }
    ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
	       pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
    XAA_GC_OP_EPILOGUE(pGC);
    return ret;
}

static void
XAAPolyPointFallback(
    DrawablePtr pDraw,
    GCPtr pGC,
    int mode,
    int npt,
    xPoint *pptInit )
{
    XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
    SYNC_CHECK(pGC);
    (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
    XAA_GC_OP_EPILOGUE(pGC);
}


static void
XAAPolylinesFallback(
    DrawablePtr pDraw,
    GCPtr	pGC,
    int		mode,		
    int		npt,		
    DDXPointPtr pptInit )
{
    XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
    SYNC_CHECK(pGC);
    (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
    XAA_GC_OP_EPILOGUE(pGC);
}

static void 
XAAPolySegmentFallback(
    DrawablePtr	pDraw,
    GCPtr	pGC,
    int		nseg,
    xSegment	*pSeg )
{
    XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
    SYNC_CHECK(pGC);
    (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
    XAA_GC_OP_EPILOGUE(pGC);
}

static void
XAAPolyRectangleFallback(
    DrawablePtr  pDraw,
    GCPtr        pGC,
    int	         nRectsInit,
    xRectangle  *pRectsInit )
{
    XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
    SYNC_CHECK(pGC);
    (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
    XAA_GC_OP_EPILOGUE(pGC);
}

static void
XAAPolyArcFallback(
    DrawablePtr	pDraw,
    GCPtr	pGC,
    int		narcs,
    xArc	*parcs )
{
    XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
    SYNC_CHECK(pGC);
    (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
    XAA_GC_OP_EPILOGUE(pGC);
}

static void
XAAFillPolygonFallback(
    DrawablePtr	pDraw,
    GCPtr	pGC,
    int		shape,
    int		mode,
    int		count,
    DDXPointPtr	ptsIn )
{
    XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
    SYNC_CHECK(pGC);
    (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
    XAA_GC_OP_EPILOGUE(pGC);
}


static void 
XAAPolyFillRectFallback(
    DrawablePtr	pDraw,
    GCPtr	pGC,
    int		nrectFill, 
    xRectangle	*prectInit )  
{
    XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
    SYNC_CHECK(pGC);
    (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
    XAA_GC_OP_EPILOGUE(pGC);
}


static void
XAAPolyFillArcFallback(
    DrawablePtr	pDraw,
    GCPtr	pGC,
    int		narcs,
    xArc	*parcs )
{
    XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
    SYNC_CHECK(pGC);
    (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
    XAA_GC_OP_EPILOGUE(pGC);
}

static int
XAAPolyText8Fallback(
    DrawablePtr pDraw,
    GCPtr	pGC,
    int		x, 
    int 	y,
    int 	count,
    char	*chars )
{
    int ret;

    XAA_GC_OP_PROLOGUE(pGC);
    SYNC_CHECK(pGC);
    ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
    XAA_GC_OP_EPILOGUE(pGC);
    return ret;
}

static int
XAAPolyText16Fallback(
    DrawablePtr pDraw,
    GCPtr	pGC,
    int		x,
    int		y,
    int 	count,
    unsigned short *chars )
{
    int ret;

    XAA_GC_OP_PROLOGUE(pGC);
    SYNC_CHECK(pGC);
    ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
    XAA_GC_OP_EPILOGUE(pGC);
    return ret;
}

static void
XAAImageText8Fallback(
    DrawablePtr pDraw,
    GCPtr	pGC,
    int		x, 
    int		y,
    int 	count,
    char	*chars )
{
    XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
    SYNC_CHECK(pGC);
    (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
    XAA_GC_OP_EPILOGUE(pGC);
}

static void
XAAImageText16Fallback(
    DrawablePtr pDraw,
    GCPtr	pGC,
    int		x,
    int		y,
    int 	count,
    unsigned short *chars )
{
    XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
    SYNC_CHECK(pGC);
    (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
    XAA_GC_OP_EPILOGUE(pGC);
}


static void
XAAImageGlyphBltFallback(
    DrawablePtr pDraw,
    GCPtr pGC,
    int xInit, int yInit,
    unsigned int nglyph,
    CharInfoPtr *ppci,
    pointer pglyphBase )
{
    XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
    SYNC_CHECK(pGC);
    (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
    XAA_GC_OP_EPILOGUE(pGC);
}

static void
XAAPolyGlyphBltFallback(
    DrawablePtr pDraw,
    GCPtr pGC,
    int xInit, int yInit,
    unsigned int nglyph,
    CharInfoPtr *ppci,
    pointer pglyphBase )
{
    XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
    SYNC_CHECK(pGC);
    (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
    XAA_GC_OP_EPILOGUE(pGC);
}

static void
XAAPushPixelsFallback(
    GCPtr	pGC,
    PixmapPtr	pBitMap,
    DrawablePtr pDraw,
    int	dx, int dy, int xOrg, int yOrg )
{
    XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
    SYNC_CHECK(pGC);
    (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
    XAA_GC_OP_EPILOGUE(pGC);
}

GCOps XAAFallbackOps = {
    XAAFillSpansFallback, XAASetSpansFallback, 
    XAAPutImageFallback, XAACopyAreaFallback, 
    XAACopyPlaneFallback, XAAPolyPointFallback, 
    XAAPolylinesFallback, XAAPolySegmentFallback, 
    XAAPolyRectangleFallback, XAAPolyArcFallback, 
    XAAFillPolygonFallback, XAAPolyFillRectFallback, 
    XAAPolyFillArcFallback, XAAPolyText8Fallback, 
    XAAPolyText16Fallback, XAAImageText8Fallback, 
    XAAImageText16Fallback, XAAImageGlyphBltFallback, 
    XAAPolyGlyphBltFallback, XAAPushPixelsFallback,
#ifdef NEED_LINEHELPER
    NULL,
#endif
    {NULL}		/* devPrivate */
};

GCOps *XAAGetFallbackOps(void)
{
    return &XAAFallbackOps;
}