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
|
/*
Copyright 2005-2013 Jay Sorg
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
GC related calls
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* this should be before all X11 .h files */
#include <xorg-server.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include <mipointer.h>
#include <fb.h>
#include <micmap.h>
#include <mi.h>
#include "rdp.h"
#include "rdpFillSpans.h"
#include "rdpSetSpans.h"
#include "rdpPutImage.h"
#include "rdpCopyArea.h"
#include "rdpCopyPlane.h"
#include "rdpPolyPoint.h"
#include "rdpPolylines.h"
#include "rdpPolySegment.h"
#include "rdpPolyRectangle.h"
#include "rdpPolyArc.h"
#include "rdpFillPolygon.h"
#include "rdpPolyFillRect.h"
#include "rdpPolyFillArc.h"
#include "rdpPolyText8.h"
#include "rdpPolyText16.h"
#include "rdpImageText8.h"
#include "rdpImageText16.h"
#include "rdpImageGlyphBlt.h"
#include "rdpPolyGlyphBlt.h"
#include "rdpPushPixels.h"
#include "rdpDraw.h"
/******************************************************************************/
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
#define GC_FUNC_VARS rdpPtr dev; rdpGCPtr priv;
/******************************************************************************/
#define GC_FUNC_PROLOGUE(_pGC) \
do { \
dev = rdpGetDevFromScreen((_pGC)->pScreen); \
priv = (rdpGCPtr)rdpGetGCPrivate(_pGC, dev->privateKeyRecGC); \
(_pGC)->funcs = priv->funcs; \
if (priv->ops != 0) \
{ \
(_pGC)->ops = priv->ops; \
} \
} while (0)
/******************************************************************************/
#define GC_FUNC_EPILOGUE(_pGC) \
do { \
priv->funcs = (_pGC)->funcs; \
(_pGC)->funcs = &g_rdpGCFuncs; \
if (priv->ops != 0) \
{ \
priv->ops = (_pGC)->ops; \
(_pGC)->ops = &g_rdpGCOps; \
} \
} while (0)
static void
rdpValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr d);
static void
rdpChangeGC(GCPtr pGC, unsigned long mask);
static void
rdpCopyGC(GCPtr src, unsigned long mask, GCPtr dst);
static void
rdpDestroyGC(GCPtr pGC);
static void
rdpChangeClip(GCPtr pGC, int type, pointer pValue, int nrects);
static void
rdpDestroyClip(GCPtr pGC);
static void
rdpCopyClip(GCPtr dst, GCPtr src);
GCFuncs g_rdpGCFuncs =
{
rdpValidateGC, rdpChangeGC, rdpCopyGC, rdpDestroyGC, rdpChangeClip,
rdpDestroyClip, rdpCopyClip
};
GCOps g_rdpGCOps =
{
rdpFillSpans, rdpSetSpans, rdpPutImage, rdpCopyArea, rdpCopyPlane,
rdpPolyPoint, rdpPolylines, rdpPolySegment, rdpPolyRectangle,
rdpPolyArc, rdpFillPolygon, rdpPolyFillRect, rdpPolyFillArc,
rdpPolyText8, rdpPolyText16, rdpImageText8, rdpImageText16,
rdpImageGlyphBlt, rdpPolyGlyphBlt, rdpPushPixels
};
/******************************************************************************/
static void
rdpValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr d)
{
GC_FUNC_VARS;
LLOGLN(10, ("rdpValidateGC:"));
GC_FUNC_PROLOGUE(pGC);
pGC->funcs->ValidateGC(pGC, changes, d);
priv->ops = pGC->ops;
GC_FUNC_EPILOGUE(pGC);
}
/******************************************************************************/
static void
rdpChangeGC(GCPtr pGC, unsigned long mask)
{
GC_FUNC_VARS;
LLOGLN(10, ("rdpChangeGC:"));
GC_FUNC_PROLOGUE(pGC);
pGC->funcs->ChangeGC(pGC, mask);
GC_FUNC_EPILOGUE(pGC);
}
/******************************************************************************/
static void
rdpCopyGC(GCPtr src, unsigned long mask, GCPtr dst)
{
GC_FUNC_VARS;
LLOGLN(10, ("rdpCopyGC:"));
GC_FUNC_PROLOGUE(dst);
dst->funcs->CopyGC(src, mask, dst);
GC_FUNC_EPILOGUE(dst);
}
/******************************************************************************/
static void
rdpDestroyGC(GCPtr pGC)
{
GC_FUNC_VARS;
LLOGLN(10, ("rdpDestroyGC:"));
GC_FUNC_PROLOGUE(pGC);
pGC->funcs->DestroyGC(pGC);
GC_FUNC_EPILOGUE(pGC);
}
/******************************************************************************/
static void
rdpChangeClip(GCPtr pGC, int type, pointer pValue, int nrects)
{
GC_FUNC_VARS;
LLOGLN(10, ("rdpChangeClip:"));
GC_FUNC_PROLOGUE(pGC);
pGC->funcs->ChangeClip(pGC, type, pValue, nrects);
GC_FUNC_EPILOGUE(pGC);
}
/******************************************************************************/
static void
rdpDestroyClip(GCPtr pGC)
{
GC_FUNC_VARS;
LLOGLN(10, ("rdpDestroyClip:"));
GC_FUNC_PROLOGUE(pGC);
pGC->funcs->DestroyClip(pGC);
GC_FUNC_EPILOGUE(pGC);
}
/******************************************************************************/
static void
rdpCopyClip(GCPtr dst, GCPtr src)
{
GC_FUNC_VARS;
LLOGLN(10, ("rdpCopyClip:"));
GC_FUNC_PROLOGUE(dst);
dst->funcs->CopyClip(dst, src);
GC_FUNC_EPILOGUE(dst);
}
/*****************************************************************************/
Bool
rdpCreateGC(GCPtr pGC)
{
Bool rv;
rdpPtr dev;
ScreenPtr pScreen;
rdpGCPtr priv;
LLOGLN(10, ("rdpCreateGC:"));
pScreen = pGC->pScreen;
dev = rdpGetDevFromScreen(pScreen);
priv = (rdpGCPtr)rdpGetGCPrivate(pGC, dev->privateKeyRecGC);
pScreen->CreateGC = dev->CreateGC;
rv = pScreen->CreateGC(pGC);
if (rv)
{
priv->funcs = pGC->funcs;
priv->ops = 0;
pGC->funcs = &g_rdpGCFuncs;
}
pScreen->CreateGC = rdpCreateGC;
return rv;
}
|