Bug Summary

File:render/render.c
Location:line 1021, column 5
Description:Value stored to 'err' is never read

Annotated Source Code

1/*
2 *
3 * Copyright © 2000 SuSE, Inc.
4 *
5 * Permission to use, copy, modify, distribute, and sell this software and its
6 * documentation for any purpose is hereby granted without fee, provided that
7 * the above copyright notice appear in all copies and that both that
8 * copyright notice and this permission notice appear in supporting
9 * documentation, and that the name of SuSE not be used in advertising or
10 * publicity pertaining to distribution of the software without specific,
11 * written prior permission. SuSE makes no representations about the
12 * suitability of this software for any purpose. It is provided "as is"
13 * without express or implied warranty.
14 *
15 * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
17 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
19 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
20 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 *
22 * Author: Keith Packard, SuSE, Inc.
23 */
24
25#ifdef HAVE_DIX_CONFIG_H1
26#include <dix-config.h>
27#endif
28
29#include <X11/X.h>
30#include <X11/Xproto.h>
31#include "misc.h"
32#include "os.h"
33#include "dixstruct.h"
34#include "resource.h"
35#include "scrnintstr.h"
36#include "windowstr.h"
37#include "pixmapstr.h"
38#include "colormapst.h"
39#include "extnsionst.h"
40#include "extinit.h"
41#include "servermd.h"
42#include <X11/extensions/render.h>
43#include <X11/extensions/renderproto.h>
44#include "picturestr.h"
45#include "glyphstr.h"
46#include <X11/Xfuncproto.h>
47#include "cursorstr.h"
48#include "xace.h"
49#include "protocol-versions.h"
50
51#ifdef PANORAMIX1
52#include "panoramiX.h"
53#include "panoramiXsrv.h"
54#endif
55
56#include <stdint.h>
57
58static int ProcRenderQueryVersion(ClientPtr pClient);
59static int ProcRenderQueryPictFormats(ClientPtr pClient);
60static int ProcRenderQueryPictIndexValues(ClientPtr pClient);
61static int ProcRenderQueryDithers(ClientPtr pClient);
62static int ProcRenderCreatePicture(ClientPtr pClient);
63static int ProcRenderChangePicture(ClientPtr pClient);
64static int ProcRenderSetPictureClipRectangles(ClientPtr pClient);
65static int ProcRenderFreePicture(ClientPtr pClient);
66static int ProcRenderComposite(ClientPtr pClient);
67static int ProcRenderScale(ClientPtr pClient);
68static int ProcRenderTrapezoids(ClientPtr pClient);
69static int ProcRenderTriangles(ClientPtr pClient);
70static int ProcRenderTriStrip(ClientPtr pClient);
71static int ProcRenderTriFan(ClientPtr pClient);
72static int ProcRenderColorTrapezoids(ClientPtr pClient);
73static int ProcRenderColorTriangles(ClientPtr pClient);
74static int ProcRenderTransform(ClientPtr pClient);
75static int ProcRenderCreateGlyphSet(ClientPtr pClient);
76static int ProcRenderReferenceGlyphSet(ClientPtr pClient);
77static int ProcRenderFreeGlyphSet(ClientPtr pClient);
78static int ProcRenderAddGlyphs(ClientPtr pClient);
79static int ProcRenderAddGlyphsFromPicture(ClientPtr pClient);
80static int ProcRenderFreeGlyphs(ClientPtr pClient);
81static int ProcRenderCompositeGlyphs(ClientPtr pClient);
82static int ProcRenderFillRectangles(ClientPtr pClient);
83static int ProcRenderCreateCursor(ClientPtr pClient);
84static int ProcRenderSetPictureTransform(ClientPtr pClient);
85static int ProcRenderQueryFilters(ClientPtr pClient);
86static int ProcRenderSetPictureFilter(ClientPtr pClient);
87static int ProcRenderCreateAnimCursor(ClientPtr pClient);
88static int ProcRenderAddTraps(ClientPtr pClient);
89static int ProcRenderCreateSolidFill(ClientPtr pClient);
90static int ProcRenderCreateLinearGradient(ClientPtr pClient);
91static int ProcRenderCreateRadialGradient(ClientPtr pClient);
92static int ProcRenderCreateConicalGradient(ClientPtr pClient);
93
94static int ProcRenderDispatch(ClientPtr pClient);
95
96static int SProcRenderQueryVersion(ClientPtr pClient);
97static int SProcRenderQueryPictFormats(ClientPtr pClient);
98static int SProcRenderQueryPictIndexValues(ClientPtr pClient);
99static int SProcRenderQueryDithers(ClientPtr pClient);
100static int SProcRenderCreatePicture(ClientPtr pClient);
101static int SProcRenderChangePicture(ClientPtr pClient);
102static int SProcRenderSetPictureClipRectangles(ClientPtr pClient);
103static int SProcRenderFreePicture(ClientPtr pClient);
104static int SProcRenderComposite(ClientPtr pClient);
105static int SProcRenderScale(ClientPtr pClient);
106static int SProcRenderTrapezoids(ClientPtr pClient);
107static int SProcRenderTriangles(ClientPtr pClient);
108static int SProcRenderTriStrip(ClientPtr pClient);
109static int SProcRenderTriFan(ClientPtr pClient);
110static int SProcRenderColorTrapezoids(ClientPtr pClient);
111static int SProcRenderColorTriangles(ClientPtr pClient);
112static int SProcRenderTransform(ClientPtr pClient);
113static int SProcRenderCreateGlyphSet(ClientPtr pClient);
114static int SProcRenderReferenceGlyphSet(ClientPtr pClient);
115static int SProcRenderFreeGlyphSet(ClientPtr pClient);
116static int SProcRenderAddGlyphs(ClientPtr pClient);
117static int SProcRenderAddGlyphsFromPicture(ClientPtr pClient);
118static int SProcRenderFreeGlyphs(ClientPtr pClient);
119static int SProcRenderCompositeGlyphs(ClientPtr pClient);
120static int SProcRenderFillRectangles(ClientPtr pClient);
121static int SProcRenderCreateCursor(ClientPtr pClient);
122static int SProcRenderSetPictureTransform(ClientPtr pClient);
123static int SProcRenderQueryFilters(ClientPtr pClient);
124static int SProcRenderSetPictureFilter(ClientPtr pClient);
125static int SProcRenderCreateAnimCursor(ClientPtr pClient);
126static int SProcRenderAddTraps(ClientPtr pClient);
127static int SProcRenderCreateSolidFill(ClientPtr pClient);
128static int SProcRenderCreateLinearGradient(ClientPtr pClient);
129static int SProcRenderCreateRadialGradient(ClientPtr pClient);
130static int SProcRenderCreateConicalGradient(ClientPtr pClient);
131
132static int SProcRenderDispatch(ClientPtr pClient);
133
134int (*ProcRenderVector[RenderNumberRequests(36 +1)]) (ClientPtr) = {
135ProcRenderQueryVersion,
136 ProcRenderQueryPictFormats,
137 ProcRenderQueryPictIndexValues,
138 ProcRenderQueryDithers,
139 ProcRenderCreatePicture,
140 ProcRenderChangePicture,
141 ProcRenderSetPictureClipRectangles,
142 ProcRenderFreePicture,
143 ProcRenderComposite,
144 ProcRenderScale,
145 ProcRenderTrapezoids,
146 ProcRenderTriangles,
147 ProcRenderTriStrip,
148 ProcRenderTriFan,
149 ProcRenderColorTrapezoids,
150 ProcRenderColorTriangles,
151 ProcRenderTransform,
152 ProcRenderCreateGlyphSet,
153 ProcRenderReferenceGlyphSet,
154 ProcRenderFreeGlyphSet,
155 ProcRenderAddGlyphs,
156 ProcRenderAddGlyphsFromPicture,
157 ProcRenderFreeGlyphs,
158 ProcRenderCompositeGlyphs,
159 ProcRenderCompositeGlyphs,
160 ProcRenderCompositeGlyphs,
161 ProcRenderFillRectangles,
162 ProcRenderCreateCursor,
163 ProcRenderSetPictureTransform,
164 ProcRenderQueryFilters,
165 ProcRenderSetPictureFilter,
166 ProcRenderCreateAnimCursor,
167 ProcRenderAddTraps,
168 ProcRenderCreateSolidFill,
169 ProcRenderCreateLinearGradient,
170 ProcRenderCreateRadialGradient, ProcRenderCreateConicalGradient};
171
172int (*SProcRenderVector[RenderNumberRequests(36 +1)]) (ClientPtr) = {
173SProcRenderQueryVersion,
174 SProcRenderQueryPictFormats,
175 SProcRenderQueryPictIndexValues,
176 SProcRenderQueryDithers,
177 SProcRenderCreatePicture,
178 SProcRenderChangePicture,
179 SProcRenderSetPictureClipRectangles,
180 SProcRenderFreePicture,
181 SProcRenderComposite,
182 SProcRenderScale,
183 SProcRenderTrapezoids,
184 SProcRenderTriangles,
185 SProcRenderTriStrip,
186 SProcRenderTriFan,
187 SProcRenderColorTrapezoids,
188 SProcRenderColorTriangles,
189 SProcRenderTransform,
190 SProcRenderCreateGlyphSet,
191 SProcRenderReferenceGlyphSet,
192 SProcRenderFreeGlyphSet,
193 SProcRenderAddGlyphs,
194 SProcRenderAddGlyphsFromPicture,
195 SProcRenderFreeGlyphs,
196 SProcRenderCompositeGlyphs,
197 SProcRenderCompositeGlyphs,
198 SProcRenderCompositeGlyphs,
199 SProcRenderFillRectangles,
200 SProcRenderCreateCursor,
201 SProcRenderSetPictureTransform,
202 SProcRenderQueryFilters,
203 SProcRenderSetPictureFilter,
204 SProcRenderCreateAnimCursor,
205 SProcRenderAddTraps,
206 SProcRenderCreateSolidFill,
207 SProcRenderCreateLinearGradient,
208 SProcRenderCreateRadialGradient, SProcRenderCreateConicalGradient};
209
210int RenderErrBase;
211static DevPrivateKeyRec RenderClientPrivateKeyRec;
212
213#define RenderClientPrivateKey(&RenderClientPrivateKeyRec ) (&RenderClientPrivateKeyRec )
214
215typedef struct _RenderClient {
216 int major_version;
217 int minor_version;
218} RenderClientRec, *RenderClientPtr;
219
220#define GetRenderClient(pClient)((RenderClientPtr)dixLookupPrivate(&(pClient)->devPrivates
, (&RenderClientPrivateKeyRec )))
((RenderClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RenderClientPrivateKey(&RenderClientPrivateKeyRec )))
221
222#ifdef PANORAMIX1
223RESTYPE XRT_PICTURE;
224#endif
225
226void
227RenderExtensionInit(void)
228{
229 ExtensionEntry *extEntry;
230
231 if (!PictureType)
232 return;
233 if (!PictureFinishInit())
234 return;
235 if (!dixRegisterPrivateKey
236 (&RenderClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(RenderClientRec)))
237 return;
238
239 extEntry = AddExtension(RENDER_NAME"RENDER", 0, RenderNumberErrors(4 +1),
240 ProcRenderDispatch, SProcRenderDispatch,
241 NULL((void*)0), StandardMinorOpcode);
242 if (!extEntry)
243 return;
244 RenderErrBase = extEntry->errorBase;
245#ifdef PANORAMIX1
246 if (XRT_PICTURE)
247 SetResourceTypeErrorValue(XRT_PICTURE, RenderErrBase + BadPicture1);
248#endif
249 SetResourceTypeErrorValue(PictureType, RenderErrBase + BadPicture1);
250 SetResourceTypeErrorValue(PictFormatType, RenderErrBase + BadPictFormat0);
251 SetResourceTypeErrorValue(GlyphSetType, RenderErrBase + BadGlyphSet3);
252}
253
254static int
255ProcRenderQueryVersion(ClientPtr client)
256{
257 RenderClientPtr pRenderClient = GetRenderClient(client)((RenderClientPtr)dixLookupPrivate(&(client)->devPrivates
, (&RenderClientPrivateKeyRec )))
;
258 xRenderQueryVersionReply rep = {
259 .type = X_Reply1,
260 .sequenceNumber = client->sequence,
261 .length = 0
262 };
263
264 REQUEST(xRenderQueryVersionReq)xRenderQueryVersionReq *stuff = (xRenderQueryVersionReq *)client
->requestBuffer
;
265
266 REQUEST_SIZE_MATCH(xRenderQueryVersionReq)if ((sizeof(xRenderQueryVersionReq) >> 2) != client->
req_len) return(16)
;
267
268 pRenderClient->major_version = stuff->majorVersion;
269 pRenderClient->minor_version = stuff->minorVersion;
270
271 if ((stuff->majorVersion * 1000 + stuff->minorVersion) <
272 (SERVER_RENDER_MAJOR_VERSION0 * 1000 + SERVER_RENDER_MINOR_VERSION11)) {
273 rep.majorVersion = stuff->majorVersion;
274 rep.minorVersion = stuff->minorVersion;
275 }
276 else {
277 rep.majorVersion = SERVER_RENDER_MAJOR_VERSION0;
278 rep.minorVersion = SERVER_RENDER_MINOR_VERSION11;
279 }
280
281 if (client->swapped) {
282 swaps(&rep.sequenceNumber)do { if (sizeof(*(&rep.sequenceNumber)) != 2) wrong_size(
); if (__builtin_constant_p((uintptr_t)(&rep.sequenceNumber
) & 1) && ((uintptr_t)(&rep.sequenceNumber) &
1) == 0) *(&rep.sequenceNumber) = lswaps(*(&rep.sequenceNumber
)); else swap_uint16((uint16_t *)(&rep.sequenceNumber)); }
while (0)
;
283 swapl(&rep.length)do { if (sizeof(*(&rep.length)) != 4) wrong_size(); if (__builtin_constant_p
((uintptr_t)(&rep.length) & 3) && ((uintptr_t
)(&rep.length) & 3) == 0) *(&rep.length) = lswapl
(*(&rep.length)); else swap_uint32((uint32_t *)(&rep.
length)); } while (0)
;
284 swapl(&rep.majorVersion)do { if (sizeof(*(&rep.majorVersion)) != 4) wrong_size();
if (__builtin_constant_p((uintptr_t)(&rep.majorVersion) &
3) && ((uintptr_t)(&rep.majorVersion) & 3) ==
0) *(&rep.majorVersion) = lswapl(*(&rep.majorVersion
)); else swap_uint32((uint32_t *)(&rep.majorVersion)); } while
(0)
;
285 swapl(&rep.minorVersion)do { if (sizeof(*(&rep.minorVersion)) != 4) wrong_size();
if (__builtin_constant_p((uintptr_t)(&rep.minorVersion) &
3) && ((uintptr_t)(&rep.minorVersion) & 3) ==
0) *(&rep.minorVersion) = lswapl(*(&rep.minorVersion
)); else swap_uint32((uint32_t *)(&rep.minorVersion)); } while
(0)
;
286 }
287 WriteToClient(client, sizeof(xRenderQueryVersionReply), &rep);
288 return Success0;
289}
290
291static VisualPtr
292findVisual(ScreenPtr pScreen, VisualID vid)
293{
294 VisualPtr pVisual;
295 int v;
296
297 for (v = 0; v < pScreen->numVisuals; v++) {
298 pVisual = pScreen->visuals + v;
299 if (pVisual->vid == vid)
300 return pVisual;
301 }
302 return 0;
303}
304
305static int
306ProcRenderQueryPictFormats(ClientPtr client)
307{
308 RenderClientPtr pRenderClient = GetRenderClient(client)((RenderClientPtr)dixLookupPrivate(&(client)->devPrivates
, (&RenderClientPrivateKeyRec )))
;
309 xRenderQueryPictFormatsReply *reply;
310 xPictScreen *pictScreen;
311 xPictDepth *pictDepth;
312 xPictVisual *pictVisual;
313 xPictFormInfo *pictForm;
314 CARD32 *pictSubpixel;
315 ScreenPtr pScreen;
316 VisualPtr pVisual;
317 DepthPtr pDepth;
318 int v, d;
319 PictureScreenPtr ps;
320 PictFormatPtr pFormat;
321 int nformat;
322 int ndepth;
323 int nvisual;
324 int rlength;
325 int s;
326 int numScreens;
327 int numSubpixel;
328
329/* REQUEST(xRenderQueryPictFormatsReq); */
330
331 REQUEST_SIZE_MATCH(xRenderQueryPictFormatsReq)if ((sizeof(xRenderQueryPictFormatsReq) >> 2) != client
->req_len) return(16)
;
332
333#ifdef PANORAMIX1
334 if (noPanoramiXExtension)
335 numScreens = screenInfo.numScreens;
336 else
337 numScreens = ((xConnSetup *) ConnectionInfo)->numRoots;
338#else
339 numScreens = screenInfo.numScreens;
340#endif
341 ndepth = nformat = nvisual = 0;
342 for (s = 0; s < numScreens; s++) {
343 pScreen = screenInfo.screens[s];
344 for (d = 0; d < pScreen->numDepths; d++) {
345 pDepth = pScreen->allowedDepths + d;
346 ++ndepth;
347
348 for (v = 0; v < pDepth->numVids; v++) {
349 pVisual = findVisual(pScreen, pDepth->vids[v]);
350 if (pVisual &&
351 PictureMatchVisual(pScreen, pDepth->depth, pVisual))
352 ++nvisual;
353 }
354 }
355 ps = GetPictureScreenIfSet(pScreen)(dixPrivateKeyRegistered((&PictureScreenPrivateKeyRec)) ?
((PictureScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates
, (&PictureScreenPrivateKeyRec))) : ((void*)0))
;
356 if (ps)
357 nformat += ps->nformats;
358 }
359 if (pRenderClient->major_version == 0 && pRenderClient->minor_version < 6)
360 numSubpixel = 0;
361 else
362 numSubpixel = numScreens;
363
364 rlength = (sizeof(xRenderQueryPictFormatsReply) +
365 nformat * sizeof(xPictFormInfo) +
366 numScreens * sizeof(xPictScreen) +
367 ndepth * sizeof(xPictDepth) +
368 nvisual * sizeof(xPictVisual) + numSubpixel * sizeof(CARD32));
369 reply = (xRenderQueryPictFormatsReply *) calloc(1, rlength);
370 if (!reply)
371 return BadAlloc11;
372 reply->type = X_Reply1;
373 reply->sequenceNumber = client->sequence;
374 reply->length = bytes_to_int32(rlength - sizeof(xGenericReply));
375 reply->numFormats = nformat;
376 reply->numScreens = numScreens;
377 reply->numDepths = ndepth;
378 reply->numVisuals = nvisual;
379 reply->numSubpixel = numSubpixel;
380
381 pictForm = (xPictFormInfo *) (reply + 1);
382
383 for (s = 0; s < numScreens; s++) {
384 pScreen = screenInfo.screens[s];
385 ps = GetPictureScreenIfSet(pScreen)(dixPrivateKeyRegistered((&PictureScreenPrivateKeyRec)) ?
((PictureScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates
, (&PictureScreenPrivateKeyRec))) : ((void*)0))
;
386 if (ps) {
387 for (nformat = 0, pFormat = ps->formats;
388 nformat < ps->nformats; nformat++, pFormat++) {
389 pictForm->id = pFormat->id;
390 pictForm->type = pFormat->type;
391 pictForm->depth = pFormat->depth;
392 pictForm->direct.red = pFormat->direct.red;
393 pictForm->direct.redMask = pFormat->direct.redMask;
394 pictForm->direct.green = pFormat->direct.green;
395 pictForm->direct.greenMask = pFormat->direct.greenMask;
396 pictForm->direct.blue = pFormat->direct.blue;
397 pictForm->direct.blueMask = pFormat->direct.blueMask;
398 pictForm->direct.alpha = pFormat->direct.alpha;
399 pictForm->direct.alphaMask = pFormat->direct.alphaMask;
400 if (pFormat->type == PictTypeIndexed0 &&
401 pFormat->index.pColormap)
402 pictForm->colormap = pFormat->index.pColormap->mid;
403 else
404 pictForm->colormap = None0L;
405 if (client->swapped) {
406 swapl(&pictForm->id)do { if (sizeof(*(&pictForm->id)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&pictForm->id) &
3) && ((uintptr_t)(&pictForm->id) & 3) ==
0) *(&pictForm->id) = lswapl(*(&pictForm->id))
; else swap_uint32((uint32_t *)(&pictForm->id)); } while
(0)
;
407 swaps(&pictForm->direct.red)do { if (sizeof(*(&pictForm->direct.red)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&pictForm->direct
.red) & 1) && ((uintptr_t)(&pictForm->direct
.red) & 1) == 0) *(&pictForm->direct.red) = lswaps
(*(&pictForm->direct.red)); else swap_uint16((uint16_t
*)(&pictForm->direct.red)); } while (0)
;
408 swaps(&pictForm->direct.redMask)do { if (sizeof(*(&pictForm->direct.redMask)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&pictForm->direct
.redMask) & 1) && ((uintptr_t)(&pictForm->
direct.redMask) & 1) == 0) *(&pictForm->direct.redMask
) = lswaps(*(&pictForm->direct.redMask)); else swap_uint16
((uint16_t *)(&pictForm->direct.redMask)); } while (0)
;
409 swaps(&pictForm->direct.green)do { if (sizeof(*(&pictForm->direct.green)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&pictForm->direct
.green) & 1) && ((uintptr_t)(&pictForm->direct
.green) & 1) == 0) *(&pictForm->direct.green) = lswaps
(*(&pictForm->direct.green)); else swap_uint16((uint16_t
*)(&pictForm->direct.green)); } while (0)
;
410 swaps(&pictForm->direct.greenMask)do { if (sizeof(*(&pictForm->direct.greenMask)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&pictForm->direct
.greenMask) & 1) && ((uintptr_t)(&pictForm->
direct.greenMask) & 1) == 0) *(&pictForm->direct.greenMask
) = lswaps(*(&pictForm->direct.greenMask)); else swap_uint16
((uint16_t *)(&pictForm->direct.greenMask)); } while (
0)
;
411 swaps(&pictForm->direct.blue)do { if (sizeof(*(&pictForm->direct.blue)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&pictForm->direct
.blue) & 1) && ((uintptr_t)(&pictForm->direct
.blue) & 1) == 0) *(&pictForm->direct.blue) = lswaps
(*(&pictForm->direct.blue)); else swap_uint16((uint16_t
*)(&pictForm->direct.blue)); } while (0)
;
412 swaps(&pictForm->direct.blueMask)do { if (sizeof(*(&pictForm->direct.blueMask)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&pictForm->direct
.blueMask) & 1) && ((uintptr_t)(&pictForm->
direct.blueMask) & 1) == 0) *(&pictForm->direct.blueMask
) = lswaps(*(&pictForm->direct.blueMask)); else swap_uint16
((uint16_t *)(&pictForm->direct.blueMask)); } while (0
)
;
413 swaps(&pictForm->direct.alpha)do { if (sizeof(*(&pictForm->direct.alpha)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&pictForm->direct
.alpha) & 1) && ((uintptr_t)(&pictForm->direct
.alpha) & 1) == 0) *(&pictForm->direct.alpha) = lswaps
(*(&pictForm->direct.alpha)); else swap_uint16((uint16_t
*)(&pictForm->direct.alpha)); } while (0)
;
414 swaps(&pictForm->direct.alphaMask)do { if (sizeof(*(&pictForm->direct.alphaMask)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&pictForm->direct
.alphaMask) & 1) && ((uintptr_t)(&pictForm->
direct.alphaMask) & 1) == 0) *(&pictForm->direct.alphaMask
) = lswaps(*(&pictForm->direct.alphaMask)); else swap_uint16
((uint16_t *)(&pictForm->direct.alphaMask)); } while (
0)
;
415 swapl(&pictForm->colormap)do { if (sizeof(*(&pictForm->colormap)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&pictForm->colormap
) & 3) && ((uintptr_t)(&pictForm->colormap
) & 3) == 0) *(&pictForm->colormap) = lswapl(*(&
pictForm->colormap)); else swap_uint32((uint32_t *)(&pictForm
->colormap)); } while (0)
;
416 }
417 pictForm++;
418 }
419 }
420 }
421
422 pictScreen = (xPictScreen *) pictForm;
423 for (s = 0; s < numScreens; s++) {
424 pScreen = screenInfo.screens[s];
425 pictDepth = (xPictDepth *) (pictScreen + 1);
426 ndepth = 0;
427 for (d = 0; d < pScreen->numDepths; d++) {
428 pictVisual = (xPictVisual *) (pictDepth + 1);
429 pDepth = pScreen->allowedDepths + d;
430
431 nvisual = 0;
432 for (v = 0; v < pDepth->numVids; v++) {
433 pVisual = findVisual(pScreen, pDepth->vids[v]);
434 if (pVisual && (pFormat = PictureMatchVisual(pScreen,
435 pDepth->depth,
436 pVisual))) {
437 pictVisual->visual = pVisual->vid;
438 pictVisual->format = pFormat->id;
439 if (client->swapped) {
440 swapl(&pictVisual->visual)do { if (sizeof(*(&pictVisual->visual)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&pictVisual->
visual) & 3) && ((uintptr_t)(&pictVisual->
visual) & 3) == 0) *(&pictVisual->visual) = lswapl
(*(&pictVisual->visual)); else swap_uint32((uint32_t *
)(&pictVisual->visual)); } while (0)
;
441 swapl(&pictVisual->format)do { if (sizeof(*(&pictVisual->format)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&pictVisual->
format) & 3) && ((uintptr_t)(&pictVisual->
format) & 3) == 0) *(&pictVisual->format) = lswapl
(*(&pictVisual->format)); else swap_uint32((uint32_t *
)(&pictVisual->format)); } while (0)
;
442 }
443 pictVisual++;
444 nvisual++;
445 }
446 }
447 pictDepth->depth = pDepth->depth;
448 pictDepth->nPictVisuals = nvisual;
449 if (client->swapped) {
450 swaps(&pictDepth->nPictVisuals)do { if (sizeof(*(&pictDepth->nPictVisuals)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&pictDepth->nPictVisuals
) & 1) && ((uintptr_t)(&pictDepth->nPictVisuals
) & 1) == 0) *(&pictDepth->nPictVisuals) = lswaps(
*(&pictDepth->nPictVisuals)); else swap_uint16((uint16_t
*)(&pictDepth->nPictVisuals)); } while (0)
;
451 }
452 ndepth++;
453 pictDepth = (xPictDepth *) pictVisual;
454 }
455 pictScreen->nDepth = ndepth;
456 ps = GetPictureScreenIfSet(pScreen)(dixPrivateKeyRegistered((&PictureScreenPrivateKeyRec)) ?
((PictureScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates
, (&PictureScreenPrivateKeyRec))) : ((void*)0))
;
457 if (ps)
458 pictScreen->fallback = ps->fallback->id;
459 else
460 pictScreen->fallback = 0;
461 if (client->swapped) {
462 swapl(&pictScreen->nDepth)do { if (sizeof(*(&pictScreen->nDepth)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&pictScreen->
nDepth) & 3) && ((uintptr_t)(&pictScreen->
nDepth) & 3) == 0) *(&pictScreen->nDepth) = lswapl
(*(&pictScreen->nDepth)); else swap_uint32((uint32_t *
)(&pictScreen->nDepth)); } while (0)
;
463 swapl(&pictScreen->fallback)do { if (sizeof(*(&pictScreen->fallback)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&pictScreen->
fallback) & 3) && ((uintptr_t)(&pictScreen->
fallback) & 3) == 0) *(&pictScreen->fallback) = lswapl
(*(&pictScreen->fallback)); else swap_uint32((uint32_t
*)(&pictScreen->fallback)); } while (0)
;
464 }
465 pictScreen = (xPictScreen *) pictDepth;
466 }
467 pictSubpixel = (CARD32 *) pictScreen;
468
469 for (s = 0; s < numSubpixel; s++) {
470 pScreen = screenInfo.screens[s];
471 ps = GetPictureScreenIfSet(pScreen)(dixPrivateKeyRegistered((&PictureScreenPrivateKeyRec)) ?
((PictureScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates
, (&PictureScreenPrivateKeyRec))) : ((void*)0))
;
472 if (ps)
473 *pictSubpixel = ps->subpixel;
474 else
475 *pictSubpixel = SubPixelUnknown0;
476 if (client->swapped) {
477 swapl(pictSubpixel)do { if (sizeof(*(pictSubpixel)) != 4) wrong_size(); if (__builtin_constant_p
((uintptr_t)(pictSubpixel) & 3) && ((uintptr_t)(pictSubpixel
) & 3) == 0) *(pictSubpixel) = lswapl(*(pictSubpixel)); else
swap_uint32((uint32_t *)(pictSubpixel)); } while (0)
;
478 }
479 ++pictSubpixel;
480 }
481
482 if (client->swapped) {
483 swaps(&reply->sequenceNumber)do { if (sizeof(*(&reply->sequenceNumber)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&reply->sequenceNumber
) & 1) && ((uintptr_t)(&reply->sequenceNumber
) & 1) == 0) *(&reply->sequenceNumber) = lswaps(*(
&reply->sequenceNumber)); else swap_uint16((uint16_t *
)(&reply->sequenceNumber)); } while (0)
;
484 swapl(&reply->length)do { if (sizeof(*(&reply->length)) != 4) wrong_size();
if (__builtin_constant_p((uintptr_t)(&reply->length) &
3) && ((uintptr_t)(&reply->length) & 3) ==
0) *(&reply->length) = lswapl(*(&reply->length
)); else swap_uint32((uint32_t *)(&reply->length)); } while
(0)
;
485 swapl(&reply->numFormats)do { if (sizeof(*(&reply->numFormats)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&reply->numFormats
) & 3) && ((uintptr_t)(&reply->numFormats)
& 3) == 0) *(&reply->numFormats) = lswapl(*(&
reply->numFormats)); else swap_uint32((uint32_t *)(&reply
->numFormats)); } while (0)
;
486 swapl(&reply->numScreens)do { if (sizeof(*(&reply->numScreens)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&reply->numScreens
) & 3) && ((uintptr_t)(&reply->numScreens)
& 3) == 0) *(&reply->numScreens) = lswapl(*(&
reply->numScreens)); else swap_uint32((uint32_t *)(&reply
->numScreens)); } while (0)
;
487 swapl(&reply->numDepths)do { if (sizeof(*(&reply->numDepths)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&reply->numDepths
) & 3) && ((uintptr_t)(&reply->numDepths) &
3) == 0) *(&reply->numDepths) = lswapl(*(&reply->
numDepths)); else swap_uint32((uint32_t *)(&reply->numDepths
)); } while (0)
;
488 swapl(&reply->numVisuals)do { if (sizeof(*(&reply->numVisuals)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&reply->numVisuals
) & 3) && ((uintptr_t)(&reply->numVisuals)
& 3) == 0) *(&reply->numVisuals) = lswapl(*(&
reply->numVisuals)); else swap_uint32((uint32_t *)(&reply
->numVisuals)); } while (0)
;
489 swapl(&reply->numSubpixel)do { if (sizeof(*(&reply->numSubpixel)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&reply->numSubpixel
) & 3) && ((uintptr_t)(&reply->numSubpixel
) & 3) == 0) *(&reply->numSubpixel) = lswapl(*(&
reply->numSubpixel)); else swap_uint32((uint32_t *)(&reply
->numSubpixel)); } while (0)
;
490 }
491 WriteToClient(client, rlength, reply);
492 free(reply);
493 return Success0;
494}
495
496static int
497ProcRenderQueryPictIndexValues(ClientPtr client)
498{
499 PictFormatPtr pFormat;
500 int rc, num;
501 int rlength;
502 int i;
503
504 REQUEST(xRenderQueryPictIndexValuesReq)xRenderQueryPictIndexValuesReq *stuff = (xRenderQueryPictIndexValuesReq
*)client->requestBuffer
;
505 xRenderQueryPictIndexValuesReply *reply;
506 xIndexValue *values;
507
508 REQUEST_AT_LEAST_SIZE(xRenderQueryPictIndexValuesReq)if ((sizeof(xRenderQueryPictIndexValuesReq) >> 2) > client
->req_len ) return(16)
;
509
510 rc = dixLookupResourceByType((void **) &pFormat, stuff->format,
511 PictFormatType, client, DixReadAccess(1<<0));
512 if (rc != Success0)
513 return rc;
514
515 if (pFormat->type != PictTypeIndexed0) {
516 client->errorValue = stuff->format;
517 return BadMatch8;
518 }
519 num = pFormat->index.nvalues;
520 rlength = (sizeof(xRenderQueryPictIndexValuesReply) +
521 num * sizeof(xIndexValue));
522 reply = (xRenderQueryPictIndexValuesReply *) calloc(1, rlength);
523 if (!reply)
524 return BadAlloc11;
525
526 reply->type = X_Reply1;
527 reply->sequenceNumber = client->sequence;
528 reply->length = bytes_to_int32(rlength - sizeof(xGenericReply));
529 reply->numIndexValues = num;
530
531 values = (xIndexValue *) (reply + 1);
532
533 memcpy(reply + 1, pFormat->index.pValues, num * sizeof(xIndexValue))__builtin___memcpy_chk (reply + 1, pFormat->index.pValues,
num * sizeof(xIndexValue), __builtin_object_size (reply + 1,
0))
;
534
535 if (client->swapped) {
536 for (i = 0; i < num; i++) {
537 swapl(&values[i].pixel)do { if (sizeof(*(&values[i].pixel)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&values[i].pixel) &
3) && ((uintptr_t)(&values[i].pixel) & 3) ==
0) *(&values[i].pixel) = lswapl(*(&values[i].pixel))
; else swap_uint32((uint32_t *)(&values[i].pixel)); } while
(0)
;
538 swaps(&values[i].red)do { if (sizeof(*(&values[i].red)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&values[i].red) & 1
) && ((uintptr_t)(&values[i].red) & 1) == 0) *
(&values[i].red) = lswaps(*(&values[i].red)); else swap_uint16
((uint16_t *)(&values[i].red)); } while (0)
;
539 swaps(&values[i].green)do { if (sizeof(*(&values[i].green)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&values[i].green) &
1) && ((uintptr_t)(&values[i].green) & 1) ==
0) *(&values[i].green) = lswaps(*(&values[i].green))
; else swap_uint16((uint16_t *)(&values[i].green)); } while
(0)
;
540 swaps(&values[i].blue)do { if (sizeof(*(&values[i].blue)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&values[i].blue) &
1) && ((uintptr_t)(&values[i].blue) & 1) == 0
) *(&values[i].blue) = lswaps(*(&values[i].blue)); else
swap_uint16((uint16_t *)(&values[i].blue)); } while (0)
;
541 swaps(&values[i].alpha)do { if (sizeof(*(&values[i].alpha)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&values[i].alpha) &
1) && ((uintptr_t)(&values[i].alpha) & 1) ==
0) *(&values[i].alpha) = lswaps(*(&values[i].alpha))
; else swap_uint16((uint16_t *)(&values[i].alpha)); } while
(0)
;
542 }
543 swaps(&reply->sequenceNumber)do { if (sizeof(*(&reply->sequenceNumber)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&reply->sequenceNumber
) & 1) && ((uintptr_t)(&reply->sequenceNumber
) & 1) == 0) *(&reply->sequenceNumber) = lswaps(*(
&reply->sequenceNumber)); else swap_uint16((uint16_t *
)(&reply->sequenceNumber)); } while (0)
;
544 swapl(&reply->length)do { if (sizeof(*(&reply->length)) != 4) wrong_size();
if (__builtin_constant_p((uintptr_t)(&reply->length) &
3) && ((uintptr_t)(&reply->length) & 3) ==
0) *(&reply->length) = lswapl(*(&reply->length
)); else swap_uint32((uint32_t *)(&reply->length)); } while
(0)
;
545 swapl(&reply->numIndexValues)do { if (sizeof(*(&reply->numIndexValues)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&reply->numIndexValues
) & 3) && ((uintptr_t)(&reply->numIndexValues
) & 3) == 0) *(&reply->numIndexValues) = lswapl(*(
&reply->numIndexValues)); else swap_uint32((uint32_t *
)(&reply->numIndexValues)); } while (0)
;
546 }
547
548 WriteToClient(client, rlength, reply);
549 free(reply);
550 return Success0;
551}
552
553static int
554ProcRenderQueryDithers(ClientPtr client)
555{
556 return BadImplementation17;
557}
558
559static int
560ProcRenderCreatePicture(ClientPtr client)
561{
562 PicturePtr pPicture;
563 DrawablePtr pDrawable;
564 PictFormatPtr pFormat;
565 int len, error, rc;
566
567 REQUEST(xRenderCreatePictureReq)xRenderCreatePictureReq *stuff = (xRenderCreatePictureReq *)client
->requestBuffer
;
568
569 REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq)if ((sizeof(xRenderCreatePictureReq) >> 2) > client->
req_len ) return(16)
;
570
571 LEGAL_NEW_RESOURCE(stuff->pid, client)if (!LegalNewID(stuff->pid,client)) { client->errorValue
= stuff->pid; return 14; }
;
572 rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
573 DixReadAccess(1<<0) | DixAddAccess(1<<12));
574 if (rc != Success0)
575 return rc;
576
577 rc = dixLookupResourceByType((void **) &pFormat, stuff->format,
578 PictFormatType, client, DixReadAccess(1<<0));
579 if (rc != Success0)
580 return rc;
581
582 if (pFormat->depth != pDrawable->depth)
583 return BadMatch8;
584 len = client->req_len - bytes_to_int32(sizeof(xRenderCreatePictureReq));
585 if (Ones(stuff->mask) != len)
586 return BadLength16;
587
588 pPicture = CreatePicture(stuff->pid,
589 pDrawable,
590 pFormat,
591 stuff->mask, (XID *) (stuff + 1), client, &error);
592 if (!pPicture)
593 return error;
594 if (!AddResourceDarwin_X_AddResource(stuff->pid, PictureType, (void *) pPicture))
595 return BadAlloc11;
596 return Success0;
597}
598
599static int
600ProcRenderChangePicture(ClientPtr client)
601{
602 PicturePtr pPicture;
603
604 REQUEST(xRenderChangePictureReq)xRenderChangePictureReq *stuff = (xRenderChangePictureReq *)client
->requestBuffer
;
605 int len;
606
607 REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq)if ((sizeof(xRenderChangePictureReq) >> 2) > client->
req_len ) return(16)
;
608 VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess){ int tmprc = dixLookupResourceByType((void *)&(pPicture)
, stuff->picture, PictureType, client, (1<<5)); if (
tmprc != 0) return tmprc;}
;
609
610 len = client->req_len - bytes_to_int32(sizeof(xRenderChangePictureReq));
611 if (Ones(stuff->mask) != len)
612 return BadLength16;
613
614 return ChangePicture(pPicture, stuff->mask, (XID *) (stuff + 1),
615 (DevUnion *) 0, client);
616}
617
618static int
619ProcRenderSetPictureClipRectangles(ClientPtr client)
620{
621 REQUEST(xRenderSetPictureClipRectanglesReq)xRenderSetPictureClipRectanglesReq *stuff = (xRenderSetPictureClipRectanglesReq
*)client->requestBuffer
;
622 PicturePtr pPicture;
623 int nr;
624
625 REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq)if ((sizeof(xRenderSetPictureClipRectanglesReq) >> 2) >
client->req_len ) return(16)
;
626 VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess){ int tmprc = dixLookupResourceByType((void *)&(pPicture)
, stuff->picture, PictureType, client, (1<<5)); if (
tmprc != 0) return tmprc;}
;
627 if (!pPicture->pDrawable)
628 return RenderErrBase + BadPicture1;
629
630 nr = (client->req_len << 2) - sizeof(xRenderSetPictureClipRectanglesReq);
631 if (nr & 4)
632 return BadLength16;
633 nr >>= 3;
634 return SetPictureClipRects(pPicture,
635 stuff->xOrigin, stuff->yOrigin,
636 nr, (xRectangle *) &stuff[1]);
637}
638
639static int
640ProcRenderFreePicture(ClientPtr client)
641{
642 PicturePtr pPicture;
643
644 REQUEST(xRenderFreePictureReq)xRenderFreePictureReq *stuff = (xRenderFreePictureReq *)client
->requestBuffer
;
645
646 REQUEST_SIZE_MATCH(xRenderFreePictureReq)if ((sizeof(xRenderFreePictureReq) >> 2) != client->
req_len) return(16)
;
647
648 VERIFY_PICTURE(pPicture, stuff->picture, client, DixDestroyAccess){ int tmprc = dixLookupResourceByType((void *)&(pPicture)
, stuff->picture, PictureType, client, (1<<2)); if (
tmprc != 0) return tmprc;}
;
649 FreeResource(stuff->picture, RT_NONE((RESTYPE)0));
650 return Success0;
651}
652
653static Bool
654PictOpValid(CARD8 op)
655{
656 if ( /*PictOpMinimum <= op && */ op <= PictOpMaximum13)
657 return TRUE1;
658 if (PictOpDisjointMinimum0x10 <= op && op <= PictOpDisjointMaximum0x1b)
659 return TRUE1;
660 if (PictOpConjointMinimum0x20 <= op && op <= PictOpConjointMaximum0x2b)
661 return TRUE1;
662 if (PictOpBlendMinimum0x30 <= op && op <= PictOpBlendMaximum0x3e)
663 return TRUE1;
664 return FALSE0;
665}
666
667static int
668ProcRenderComposite(ClientPtr client)
669{
670 PicturePtr pSrc, pMask, pDst;
671
672 REQUEST(xRenderCompositeReq)xRenderCompositeReq *stuff = (xRenderCompositeReq *)client->
requestBuffer
;
673
674 REQUEST_SIZE_MATCH(xRenderCompositeReq)if ((sizeof(xRenderCompositeReq) >> 2) != client->req_len
) return(16)
;
675 if (!PictOpValid(stuff->op)) {
676 client->errorValue = stuff->op;
677 return BadValue2;
678 }
679 VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess){ int tmprc = dixLookupResourceByType((void *)&(pDst), stuff
->dst, PictureType, client, (1<<1)); if (tmprc != 0)
return tmprc;}
;
680 if (!pDst->pDrawable)
681 return BadDrawable9;
682 VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess){ int tmprc = dixLookupResourceByType((void *)&(pSrc), stuff
->src, PictureType, client, (1<<0)); if (tmprc != 0)
return tmprc;}
;
683 VERIFY_ALPHA(pMask, stuff->mask, client, DixReadAccess){ if (stuff->mask == 0L) pMask = 0; else { { int tmprc = dixLookupResourceByType
((void *)&(pMask), stuff->mask, PictureType, client, (
1<<0)); if (tmprc != 0) return tmprc;}; } }
;
684 if ((pSrc->pDrawable &&
685 pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) || (pMask &&
686 pMask->
687 pDrawable &&
688 pDst->
689 pDrawable->
690 pScreen !=
691 pMask->
692 pDrawable->
693 pScreen))
694 return BadMatch8;
695 CompositePicture(stuff->op,
696 pSrc,
697 pMask,
698 pDst,
699 stuff->xSrc,
700 stuff->ySrc,
701 stuff->xMask,
702 stuff->yMask,
703 stuff->xDst, stuff->yDst, stuff->width, stuff->height);
704 return Success0;
705}
706
707static int
708ProcRenderScale(ClientPtr client)
709{
710 return BadImplementation17;
711}
712
713static int
714ProcRenderTrapezoids(ClientPtr client)
715{
716 int rc, ntraps;
717 PicturePtr pSrc, pDst;
718 PictFormatPtr pFormat;
719
720 REQUEST(xRenderTrapezoidsReq)xRenderTrapezoidsReq *stuff = (xRenderTrapezoidsReq *)client->
requestBuffer
;
721
722 REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq)if ((sizeof(xRenderTrapezoidsReq) >> 2) > client->
req_len ) return(16)
;
723 if (!PictOpValid(stuff->op)) {
724 client->errorValue = stuff->op;
725 return BadValue2;
726 }
727 VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess){ int tmprc = dixLookupResourceByType((void *)&(pSrc), stuff
->src, PictureType, client, (1<<0)); if (tmprc != 0)
return tmprc;}
;
728 VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess){ int tmprc = dixLookupResourceByType((void *)&(pDst), stuff
->dst, PictureType, client, (1<<1)); if (tmprc != 0)
return tmprc;}
;
729 if (!pDst->pDrawable)
730 return BadDrawable9;
731 if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
732 return BadMatch8;
733 if (stuff->maskFormat) {
734 rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat,
735 PictFormatType, client, DixReadAccess(1<<0));
736 if (rc != Success0)
737 return rc;
738 }
739 else
740 pFormat = 0;
741 ntraps = (client->req_len << 2) - sizeof(xRenderTrapezoidsReq);
742 if (ntraps % sizeof(xTrapezoid))
743 return BadLength16;
744 ntraps /= sizeof(xTrapezoid);
745 if (ntraps)
746 CompositeTrapezoids(stuff->op, pSrc, pDst, pFormat,
747 stuff->xSrc, stuff->ySrc,
748 ntraps, (xTrapezoid *) &stuff[1]);
749 return Success0;
750}
751
752static int
753ProcRenderTriangles(ClientPtr client)
754{
755 int rc, ntris;
756 PicturePtr pSrc, pDst;
757 PictFormatPtr pFormat;
758
759 REQUEST(xRenderTrianglesReq)xRenderTrianglesReq *stuff = (xRenderTrianglesReq *)client->
requestBuffer
;
760
761 REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq)if ((sizeof(xRenderTrianglesReq) >> 2) > client->
req_len ) return(16)
;
762 if (!PictOpValid(stuff->op)) {
763 client->errorValue = stuff->op;
764 return BadValue2;
765 }
766 VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess){ int tmprc = dixLookupResourceByType((void *)&(pSrc), stuff
->src, PictureType, client, (1<<0)); if (tmprc != 0)
return tmprc;}
;
767 VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess){ int tmprc = dixLookupResourceByType((void *)&(pDst), stuff
->dst, PictureType, client, (1<<1)); if (tmprc != 0)
return tmprc;}
;
768 if (!pDst->pDrawable)
769 return BadDrawable9;
770 if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
771 return BadMatch8;
772 if (stuff->maskFormat) {
773 rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat,
774 PictFormatType, client, DixReadAccess(1<<0));
775 if (rc != Success0)
776 return rc;
777 }
778 else
779 pFormat = 0;
780 ntris = (client->req_len << 2) - sizeof(xRenderTrianglesReq);
781 if (ntris % sizeof(xTriangle))
782 return BadLength16;
783 ntris /= sizeof(xTriangle);
784 if (ntris)
785 CompositeTriangles(stuff->op, pSrc, pDst, pFormat,
786 stuff->xSrc, stuff->ySrc,
787 ntris, (xTriangle *) &stuff[1]);
788 return Success0;
789}
790
791static int
792ProcRenderTriStrip(ClientPtr client)
793{
794 int rc, npoints;
795 PicturePtr pSrc, pDst;
796 PictFormatPtr pFormat;
797
798 REQUEST(xRenderTrianglesReq)xRenderTrianglesReq *stuff = (xRenderTrianglesReq *)client->
requestBuffer
;
799
800 REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq)if ((sizeof(xRenderTrianglesReq) >> 2) > client->
req_len ) return(16)
;
801 if (!PictOpValid(stuff->op)) {
802 client->errorValue = stuff->op;
803 return BadValue2;
804 }
805 VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess){ int tmprc = dixLookupResourceByType((void *)&(pSrc), stuff
->src, PictureType, client, (1<<0)); if (tmprc != 0)
return tmprc;}
;
806 VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess){ int tmprc = dixLookupResourceByType((void *)&(pDst), stuff
->dst, PictureType, client, (1<<1)); if (tmprc != 0)
return tmprc;}
;
807 if (!pDst->pDrawable)
808 return BadDrawable9;
809 if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
810 return BadMatch8;
811 if (stuff->maskFormat) {
812 rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat,
813 PictFormatType, client, DixReadAccess(1<<0));
814 if (rc != Success0)
815 return rc;
816 }
817 else
818 pFormat = 0;
819 npoints = ((client->req_len << 2) - sizeof(xRenderTriStripReq));
820 if (npoints & 4)
821 return BadLength16;
822 npoints >>= 3;
823 if (npoints >= 3)
824 CompositeTriStrip(stuff->op, pSrc, pDst, pFormat,
825 stuff->xSrc, stuff->ySrc,
826 npoints, (xPointFixed *) &stuff[1]);
827 return Success0;
828}
829
830static int
831ProcRenderTriFan(ClientPtr client)
832{
833 int rc, npoints;
834 PicturePtr pSrc, pDst;
835 PictFormatPtr pFormat;
836
837 REQUEST(xRenderTrianglesReq)xRenderTrianglesReq *stuff = (xRenderTrianglesReq *)client->
requestBuffer
;
838
839 REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq)if ((sizeof(xRenderTrianglesReq) >> 2) > client->
req_len ) return(16)
;
840 if (!PictOpValid(stuff->op)) {
841 client->errorValue = stuff->op;
842 return BadValue2;
843 }
844 VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess){ int tmprc = dixLookupResourceByType((void *)&(pSrc), stuff
->src, PictureType, client, (1<<0)); if (tmprc != 0)
return tmprc;}
;
845 VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess){ int tmprc = dixLookupResourceByType((void *)&(pDst), stuff
->dst, PictureType, client, (1<<1)); if (tmprc != 0)
return tmprc;}
;
846 if (!pDst->pDrawable)
847 return BadDrawable9;
848 if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
849 return BadMatch8;
850 if (stuff->maskFormat) {
851 rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat,
852 PictFormatType, client, DixReadAccess(1<<0));
853 if (rc != Success0)
854 return rc;
855 }
856 else
857 pFormat = 0;
858 npoints = ((client->req_len << 2) - sizeof(xRenderTriStripReq));
859 if (npoints & 4)
860 return BadLength16;
861 npoints >>= 3;
862 if (npoints >= 3)
863 CompositeTriFan(stuff->op, pSrc, pDst, pFormat,
864 stuff->xSrc, stuff->ySrc,
865 npoints, (xPointFixed *) &stuff[1]);
866 return Success0;
867}
868
869static int
870ProcRenderColorTrapezoids(ClientPtr client)
871{
872 return BadImplementation17;
873}
874
875static int
876ProcRenderColorTriangles(ClientPtr client)
877{
878 return BadImplementation17;
879}
880
881static int
882ProcRenderTransform(ClientPtr client)
883{
884 return BadImplementation17;
885}
886
887static int
888ProcRenderCreateGlyphSet(ClientPtr client)
889{
890 GlyphSetPtr glyphSet;
891 PictFormatPtr format;
892 int rc, f;
893
894 REQUEST(xRenderCreateGlyphSetReq)xRenderCreateGlyphSetReq *stuff = (xRenderCreateGlyphSetReq *
)client->requestBuffer
;
895
896 REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq)if ((sizeof(xRenderCreateGlyphSetReq) >> 2) != client->
req_len) return(16)
;
897
898 LEGAL_NEW_RESOURCE(stuff->gsid, client)if (!LegalNewID(stuff->gsid,client)) { client->errorValue
= stuff->gsid; return 14; }
;
899 rc = dixLookupResourceByType((void **) &format, stuff->format,
900 PictFormatType, client, DixReadAccess(1<<0));
901 if (rc != Success0)
902 return rc;
903
904 switch (format->depth) {
905 case 1:
906 f = GlyphFormat10;
907 break;
908 case 4:
909 f = GlyphFormat41;
910 break;
911 case 8:
912 f = GlyphFormat82;
913 break;
914 case 16:
915 f = GlyphFormat163;
916 break;
917 case 32:
918 f = GlyphFormat324;
919 break;
920 default:
921 return BadMatch8;
922 }
923 if (format->type != PictTypeDirect1)
924 return BadMatch8;
925 glyphSet = AllocateGlyphSet(f, format);
926 if (!glyphSet)
927 return BadAlloc11;
928 /* security creation/labeling check */
929 rc = XaceHook(XACE_RESOURCE_ACCESS2, client, stuff->gsid, GlyphSetType,
930 glyphSet, RT_NONE((RESTYPE)0), NULL((void*)0), DixCreateAccess(1<<3));
931 if (rc != Success0)
932 return rc;
933 if (!AddResourceDarwin_X_AddResource(stuff->gsid, GlyphSetType, (void *) glyphSet))
934 return BadAlloc11;
935 return Success0;
936}
937
938static int
939ProcRenderReferenceGlyphSet(ClientPtr client)
940{
941 GlyphSetPtr glyphSet;
942 int rc;
943
944 REQUEST(xRenderReferenceGlyphSetReq)xRenderReferenceGlyphSetReq *stuff = (xRenderReferenceGlyphSetReq
*)client->requestBuffer
;
945
946 REQUEST_SIZE_MATCH(xRenderReferenceGlyphSetReq)if ((sizeof(xRenderReferenceGlyphSetReq) >> 2) != client
->req_len) return(16)
;
947
948 LEGAL_NEW_RESOURCE(stuff->gsid, client)if (!LegalNewID(stuff->gsid,client)) { client->errorValue
= stuff->gsid; return 14; }
;
949
950 rc = dixLookupResourceByType((void **) &glyphSet, stuff->existing,
951 GlyphSetType, client, DixGetAttrAccess(1<<4));
952 if (rc != Success0) {
953 client->errorValue = stuff->existing;
954 return rc;
955 }
956 glyphSet->refcnt++;
957 if (!AddResourceDarwin_X_AddResource(stuff->gsid, GlyphSetType, (void *) glyphSet))
958 return BadAlloc11;
959 return Success0;
960}
961
962#define NLOCALDELTA64 64
963#define NLOCALGLYPH256 256
964
965static int
966ProcRenderFreeGlyphSet(ClientPtr client)
967{
968 GlyphSetPtr glyphSet;
969 int rc;
970
971 REQUEST(xRenderFreeGlyphSetReq)xRenderFreeGlyphSetReq *stuff = (xRenderFreeGlyphSetReq *)client
->requestBuffer
;
972
973 REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq)if ((sizeof(xRenderFreeGlyphSetReq) >> 2) != client->
req_len) return(16)
;
974 rc = dixLookupResourceByType((void **) &glyphSet, stuff->glyphset,
975 GlyphSetType, client, DixDestroyAccess(1<<2));
976 if (rc != Success0) {
977 client->errorValue = stuff->glyphset;
978 return rc;
979 }
980 FreeResource(stuff->glyphset, RT_NONE((RESTYPE)0));
981 return Success0;
982}
983
984typedef struct _GlyphNew {
985 Glyph id;
986 GlyphPtr glyph;
987 Bool found;
988 unsigned char sha1[20];
989} GlyphNewRec, *GlyphNewPtr;
990
991#define NeedsComponent(f)((((f) >> 12) & 0x0f) != 0 && (((f) ) &
0xfff) != 0)
(PICT_FORMAT_A(f)(((f) >> 12) & 0x0f) != 0 && PICT_FORMAT_RGB(f)(((f) ) & 0xfff) != 0)
992
993static int
994ProcRenderAddGlyphs(ClientPtr client)
995{
996 GlyphSetPtr glyphSet;
997
998 REQUEST(xRenderAddGlyphsReq)xRenderAddGlyphsReq *stuff = (xRenderAddGlyphsReq *)client->
requestBuffer
;
999 GlyphNewRec glyphsLocal[NLOCALGLYPH256];
1000 GlyphNewPtr glyphsBase, glyphs, glyph_new;
1001 int remain, nglyphs;
1002 CARD32 *gids;
1003 xGlyphInfo *gi;
1004 CARD8 *bits;
1005 unsigned int size;
1006 int err;
1007 int i, screen;
1008 PicturePtr pSrc = NULL((void*)0), pDst = NULL((void*)0);
1009 PixmapPtr pSrcPix = NULL((void*)0), pDstPix = NULL((void*)0);
1010 CARD32 component_alpha;
1011
1012 REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq)if ((sizeof(xRenderAddGlyphsReq) >> 2) > client->
req_len ) return(16)
;
1013 err =
1014 dixLookupResourceByType((void **) &glyphSet, stuff->glyphset,
1015 GlyphSetType, client, DixAddAccess(1<<12));
1016 if (err != Success0) {
1017 client->errorValue = stuff->glyphset;
1018 return err;
1019 }
1020
1021 err = BadAlloc11;
Value stored to 'err' is never read
1022 nglyphs = stuff->nglyphs;
1023 if (nglyphs > UINT32_MAX4294967295U / sizeof(GlyphNewRec))
1024 return BadAlloc11;
1025
1026 component_alpha = NeedsComponent(glyphSet->format->format)((((glyphSet->format->format) >> 12) & 0x0f) !=
0 && (((glyphSet->format->format) ) & 0xfff
) != 0)
;
1027
1028 if (nglyphs <= NLOCALGLYPH256) {
1029 memset(glyphsLocal, 0, sizeof(glyphsLocal))__builtin___memset_chk (glyphsLocal, 0, sizeof(glyphsLocal), __builtin_object_size
(glyphsLocal, 0))
;
1030 glyphsBase = glyphsLocal;
1031 }
1032 else {
1033 glyphsBase = (GlyphNewPtr) calloc(nglyphs, sizeof(GlyphNewRec));
1034 if (!glyphsBase)
1035 return BadAlloc11;
1036 }
1037
1038 remain = (client->req_len << 2) - sizeof(xRenderAddGlyphsReq);
1039
1040 glyphs = glyphsBase;
1041
1042 gids = (CARD32 *) (stuff + 1);
1043 gi = (xGlyphInfo *) (gids + nglyphs);
1044 bits = (CARD8 *) (gi + nglyphs);
1045 remain -= (sizeof(CARD32) + sizeof(xGlyphInfo)) * nglyphs;
1046
1047 /* protect against bad nglyphs */
1048 if (gi < ((xGlyphInfo *) stuff) ||
1049 gi > ((xGlyphInfo *) ((CARD32 *) stuff + client->req_len)) ||
1050 bits < ((CARD8 *) stuff) ||
1051 bits > ((CARD8 *) ((CARD32 *) stuff + client->req_len))) {
1052 err = BadLength16;
1053 goto bail;
1054 }
1055
1056 for (i = 0; i < nglyphs; i++) {
1057 size_t padded_width;
1058
1059 glyph_new = &glyphs[i];
1060
1061 padded_width = PixmapBytePad(gi[i].width, glyphSet->format->depth)((PixmapWidthPaddingInfo[glyphSet->format->depth].notPower2
? (((int)(gi[i].width) * PixmapWidthPaddingInfo[glyphSet->
format->depth].bytesPerPixel + PixmapWidthPaddingInfo[glyphSet
->format->depth].bytesPerPixel) >> PixmapWidthPaddingInfo
[glyphSet->format->depth].padBytesLog2) : ((int)((gi[i]
.width) + PixmapWidthPaddingInfo[glyphSet->format->depth
].padRoundUp) >> PixmapWidthPaddingInfo[glyphSet->format
->depth].padPixelsLog2)) << PixmapWidthPaddingInfo[glyphSet
->format->depth].padBytesLog2)
;
1062
1063 if (gi[i].height &&
1064 padded_width > (UINT32_MAX4294967295U - sizeof(GlyphRec)) / gi[i].height)
1065 break;
1066
1067 size = gi[i].height * padded_width;
1068 if (remain < size)
1069 break;
1070
1071 err = HashGlyph(&gi[i], bits, size, glyph_new->sha1);
1072 if (err)
1073 goto bail;
1074
1075 glyph_new->glyph = FindGlyphByHash(glyph_new->sha1, glyphSet->fdepth);
1076
1077 if (glyph_new->glyph && glyph_new->glyph != DeletedGlyph((GlyphPtr) 1)) {
1078 glyph_new->found = TRUE1;
1079 }
1080 else {
1081 GlyphPtr glyph;
1082
1083 glyph_new->found = FALSE0;
1084 glyph_new->glyph = glyph = AllocateGlyph(&gi[i], glyphSet->fdepth);
1085 if (!glyph) {
1086 err = BadAlloc11;
1087 goto bail;
1088 }
1089
1090 for (screen = 0; screen < screenInfo.numScreens; screen++) {
1091 int width = gi[i].width;
1092 int height = gi[i].height;
1093 int depth = glyphSet->format->depth;
1094 ScreenPtr pScreen;
1095 int error;
1096
1097 /* Skip work if it's invisibly small anyway */
1098 if (!width || !height)
1099 break;
1100
1101 pScreen = screenInfo.screens[screen];
1102 pSrcPix = GetScratchPixmapHeader(pScreen,
1103 width, height,
1104 depth, depth, -1, bits);
1105 if (!pSrcPix) {
1106 err = BadAlloc11;
1107 goto bail;
1108 }
1109
1110 pSrc = CreatePicture(0, &pSrcPix->drawable,
1111 glyphSet->format, 0, NULL((void*)0),
1112 serverClient, &error);
1113 if (!pSrc) {
1114 err = BadAlloc11;
1115 goto bail;
1116 }
1117
1118 pDstPix = (pScreen->CreatePixmap) (pScreen,
1119 width, height, depth,
1120 CREATE_PIXMAP_USAGE_GLYPH_PICTURE3);
1121
1122 if (!pDstPix) {
1123 err = BadAlloc11;
1124 goto bail;
1125 }
1126
1127 pDst = CreatePicture(0, &pDstPix->drawable,
1128 glyphSet->format,
1129 CPComponentAlpha(1 << 12), &component_alpha,
1130 serverClient, &error);
1131 SetGlyphPicture(glyph, pScreen, pDst);
1132
1133 /* The picture takes a reference to the pixmap, so we
1134 drop ours. */
1135 (pScreen->DestroyPixmap) (pDstPix);
1136 pDstPix = NULL((void*)0);
1137
1138 if (!pDst) {
1139 err = BadAlloc11;
1140 goto bail;
1141 }
1142
1143 CompositePicture(PictOpSrc1,
1144 pSrc,
1145 None0L, pDst, 0, 0, 0, 0, 0, 0, width, height);
1146
1147 FreePicture((void *) pSrc, 0);
1148 pSrc = NULL((void*)0);
1149 FreeScratchPixmapHeader(pSrcPix);
1150 pSrcPix = NULL((void*)0);
1151 }
1152
1153 memcpy(glyph_new->glyph->sha1, glyph_new->sha1, 20)__builtin___memcpy_chk (glyph_new->glyph->sha1, glyph_new
->sha1, 20, __builtin_object_size (glyph_new->glyph->
sha1, 0))
;
1154 }
1155
1156 glyph_new->id = gids[i];
1157
1158 if (size & 3)
1159 size += 4 - (size & 3);
1160 bits += size;
1161 remain -= size;
1162 }
1163 if (remain || i < nglyphs) {
1164 err = BadLength16;
1165 goto bail;
1166 }
1167 if (!ResizeGlyphSet(glyphSet, nglyphs)) {
1168 err = BadAlloc11;
1169 goto bail;
1170 }
1171 for (i = 0; i < nglyphs; i++)
1172 AddGlyph(glyphSet, glyphs[i].glyph, glyphs[i].id);
1173
1174 if (glyphsBase != glyphsLocal)
1175 free(glyphsBase);
1176 return Success0;
1177 bail:
1178 if (pSrc)
1179 FreePicture((void *) pSrc, 0);
1180 if (pSrcPix)
1181 FreeScratchPixmapHeader(pSrcPix);
1182 for (i = 0; i < nglyphs; i++)
1183 if (glyphs[i].glyph && !glyphs[i].found)
1184 free(glyphs[i].glyph);
1185 if (glyphsBase != glyphsLocal)
1186 free(glyphsBase);
1187 return err;
1188}
1189
1190static int
1191ProcRenderAddGlyphsFromPicture(ClientPtr client)
1192{
1193 return BadImplementation17;
1194}
1195
1196static int
1197ProcRenderFreeGlyphs(ClientPtr client)
1198{
1199 REQUEST(xRenderFreeGlyphsReq)xRenderFreeGlyphsReq *stuff = (xRenderFreeGlyphsReq *)client->
requestBuffer
;
1200 GlyphSetPtr glyphSet;
1201 int rc, nglyph;
1202 CARD32 *gids;
1203 CARD32 glyph;
1204
1205 REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq)if ((sizeof(xRenderFreeGlyphsReq) >> 2) > client->
req_len ) return(16)
;
1206 rc = dixLookupResourceByType((void **) &glyphSet, stuff->glyphset,
1207 GlyphSetType, client, DixRemoveAccess(1<<13));
1208 if (rc != Success0) {
1209 client->errorValue = stuff->glyphset;
1210 return rc;
1211 }
1212 nglyph =
1213 bytes_to_int32((client->req_len << 2) - sizeof(xRenderFreeGlyphsReq));
1214 gids = (CARD32 *) (stuff + 1);
1215 while (nglyph-- > 0) {
1216 glyph = *gids++;
1217 if (!DeleteGlyph(glyphSet, glyph)) {
1218 client->errorValue = glyph;
1219 return RenderErrBase + BadGlyph4;
1220 }
1221 }
1222 return Success0;
1223}
1224
1225static int
1226ProcRenderCompositeGlyphs(ClientPtr client)
1227{
1228 GlyphSetPtr glyphSet;
1229 GlyphSet gs;
1230 PicturePtr pSrc, pDst;
1231 PictFormatPtr pFormat;
1232 GlyphListRec listsLocal[NLOCALDELTA64];
1233 GlyphListPtr lists, listsBase;
1234 GlyphPtr glyphsLocal[NLOCALGLYPH256];
1235 Glyph glyph;
1236 GlyphPtr *glyphs, *glyphsBase;
1237 xGlyphElt *elt;
1238 CARD8 *buffer, *end;
1239 int nglyph;
1240 int nlist;
1241 int space;
1242 int size;
1243 int rc, n;
1244
1245 REQUEST(xRenderCompositeGlyphsReq)xRenderCompositeGlyphsReq *stuff = (xRenderCompositeGlyphsReq
*)client->requestBuffer
;
1246
1247 REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq)if ((sizeof(xRenderCompositeGlyphsReq) >> 2) > client
->req_len ) return(16)
;
1248
1249 switch (stuff->renderReqType) {
1250 default:
1251 size = 1;
1252 break;
1253 case X_RenderCompositeGlyphs1624:
1254 size = 2;
1255 break;
1256 case X_RenderCompositeGlyphs3225:
1257 size = 4;
1258 break;
1259 }
1260
1261 if (!PictOpValid(stuff->op)) {
1262 client->errorValue = stuff->op;
1263 return BadValue2;
1264 }
1265 VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess){ int tmprc = dixLookupResourceByType((void *)&(pSrc), stuff
->src, PictureType, client, (1<<0)); if (tmprc != 0)
return tmprc;}
;
1266 VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess){ int tmprc = dixLookupResourceByType((void *)&(pDst), stuff
->dst, PictureType, client, (1<<1)); if (tmprc != 0)
return tmprc;}
;
1267 if (!pDst->pDrawable)
1268 return BadDrawable9;
1269 if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
1270 return BadMatch8;
1271 if (stuff->maskFormat) {
1272 rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat,
1273 PictFormatType, client, DixReadAccess(1<<0));
1274 if (rc != Success0)
1275 return rc;
1276 }
1277 else
1278 pFormat = 0;
1279
1280 rc = dixLookupResourceByType((void **) &glyphSet, stuff->glyphset,
1281 GlyphSetType, client, DixUseAccess(1<<24));
1282 if (rc != Success0)
1283 return rc;
1284
1285 buffer = (CARD8 *) (stuff + 1);
1286 end = (CARD8 *) stuff + (client->req_len << 2);
1287 nglyph = 0;
1288 nlist = 0;
1289 while (buffer + sizeof(xGlyphElt) < end) {
1290 elt = (xGlyphElt *) buffer;
1291 buffer += sizeof(xGlyphElt);
1292
1293 if (elt->len == 0xff) {
1294 buffer += 4;
1295 }
1296 else {
1297 nlist++;
1298 nglyph += elt->len;
1299 space = size * elt->len;
1300 if (space & 3)
1301 space += 4 - (space & 3);
1302 buffer += space;
1303 }
1304 }
1305 if (nglyph <= NLOCALGLYPH256)
1306 glyphsBase = glyphsLocal;
1307 else {
1308 glyphsBase = xallocarray(nglyph, sizeof(GlyphPtr))xreallocarray(((void*)0), (nglyph), (sizeof(GlyphPtr)));
1309 if (!glyphsBase)
1310 return BadAlloc11;
1311 }
1312 if (nlist <= NLOCALDELTA64)
1313 listsBase = listsLocal;
1314 else {
1315 listsBase = xallocarray(nlist, sizeof(GlyphListRec))xreallocarray(((void*)0), (nlist), (sizeof(GlyphListRec)));
1316 if (!listsBase) {
1317 rc = BadAlloc11;
1318 goto bail;
1319 }
1320 }
1321 buffer = (CARD8 *) (stuff + 1);
1322 glyphs = glyphsBase;
1323 lists = listsBase;
1324 while (buffer + sizeof(xGlyphElt) < end) {
1325 elt = (xGlyphElt *) buffer;
1326 buffer += sizeof(xGlyphElt);
1327
1328 if (elt->len == 0xff) {
1329 if (buffer + sizeof(GlyphSet) < end) {
1330 memcpy(&gs, buffer, sizeof(GlyphSet))__builtin___memcpy_chk (&gs, buffer, sizeof(GlyphSet), __builtin_object_size
(&gs, 0))
;
1331 rc = dixLookupResourceByType((void **) &glyphSet, gs,
1332 GlyphSetType, client,
1333 DixUseAccess(1<<24));
1334 if (rc != Success0)
1335 goto bail;
1336 }
1337 buffer += 4;
1338 }
1339 else {
1340 lists->xOff = elt->deltax;
1341 lists->yOff = elt->deltay;
1342 lists->format = glyphSet->format;
1343 lists->len = 0;
1344 n = elt->len;
1345 while (n--) {
1346 if (buffer + size <= end) {
1347 switch (size) {
1348 case 1:
1349 glyph = *((CARD8 *) buffer);
1350 break;
1351 case 2:
1352 glyph = *((CARD16 *) buffer);
1353 break;
1354 case 4:
1355 default:
1356 glyph = *((CARD32 *) buffer);
1357 break;
1358 }
1359 if ((*glyphs = FindGlyph(glyphSet, glyph))) {
1360 lists->len++;
1361 glyphs++;
1362 }
1363 }
1364 buffer += size;
1365 }
1366 space = size * elt->len;
1367 if (space & 3)
1368 buffer += 4 - (space & 3);
1369 lists++;
1370 }
1371 }
1372 if (buffer > end) {
1373 rc = BadLength16;
1374 goto bail;
1375 }
1376
1377 CompositeGlyphs(stuff->op,
1378 pSrc,
1379 pDst,
1380 pFormat,
1381 stuff->xSrc, stuff->ySrc, nlist, listsBase, glyphsBase);
1382 rc = Success0;
1383
1384 bail:
1385 if (glyphsBase != glyphsLocal)
1386 free(glyphsBase);
1387 if (listsBase != listsLocal)
1388 free(listsBase);
1389 return rc;
1390}
1391
1392static int
1393ProcRenderFillRectangles(ClientPtr client)
1394{
1395 PicturePtr pDst;
1396 int things;
1397
1398 REQUEST(xRenderFillRectanglesReq)xRenderFillRectanglesReq *stuff = (xRenderFillRectanglesReq *
)client->requestBuffer
;
1399
1400 REQUEST_AT_LEAST_SIZE(xRenderFillRectanglesReq)if ((sizeof(xRenderFillRectanglesReq) >> 2) > client
->req_len ) return(16)
;
1401 if (!PictOpValid(stuff->op)) {
1402 client->errorValue = stuff->op;
1403 return BadValue2;
1404 }
1405 VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess){ int tmprc = dixLookupResourceByType((void *)&(pDst), stuff
->dst, PictureType, client, (1<<1)); if (tmprc != 0)
return tmprc;}
;
1406 if (!pDst->pDrawable)
1407 return BadDrawable9;
1408
1409 things = (client->req_len << 2) - sizeof(xRenderFillRectanglesReq);
1410 if (things & 4)
1411 return BadLength16;
1412 things >>= 3;
1413
1414 CompositeRects(stuff->op,
1415 pDst, &stuff->color, things, (xRectangle *) &stuff[1]);
1416
1417 return Success0;
1418}
1419
1420static void
1421RenderSetBit(unsigned char *line, int x, int bit)
1422{
1423 unsigned char mask;
1424
1425 if (screenInfo.bitmapBitOrder == LSBFirst0)
1426 mask = (1 << (x & 7));
1427 else
1428 mask = (0x80 >> (x & 7));
1429 /* XXX assumes byte order is host byte order */
1430 line += (x >> 3);
1431 if (bit)
1432 *line |= mask;
1433 else
1434 *line &= ~mask;
1435}
1436
1437#define DITHER_DIM2 2
1438
1439static CARD32 orderedDither[DITHER_DIM2][DITHER_DIM2] = {
1440 {1, 3,},
1441 {4, 2,},
1442};
1443
1444#define DITHER_SIZE((sizeof orderedDither / sizeof orderedDither[0][0]) + 1) ((sizeof orderedDither / sizeof orderedDither[0][0]) + 1)
1445
1446static int
1447ProcRenderCreateCursor(ClientPtr client)
1448{
1449 REQUEST(xRenderCreateCursorReq)xRenderCreateCursorReq *stuff = (xRenderCreateCursorReq *)client
->requestBuffer
;
1450 PicturePtr pSrc;
1451 ScreenPtr pScreen;
1452 unsigned short width, height;
1453 CARD32 *argbbits, *argb;
1454 unsigned char *srcbits, *srcline;
1455 unsigned char *mskbits, *mskline;
1456 int stride;
1457 int x, y;
1458 int nbytes_mono;
1459 CursorMetricRec cm;
1460 CursorPtr pCursor;
1461 CARD32 twocolor[3];
1462 int rc, ncolor;
1463
1464 REQUEST_SIZE_MATCH(xRenderCreateCursorReq)if ((sizeof(xRenderCreateCursorReq) >> 2) != client->
req_len) return(16)
;
1465 LEGAL_NEW_RESOURCE(stuff->cid, client)if (!LegalNewID(stuff->cid,client)) { client->errorValue
= stuff->cid; return 14; }
;
1466
1467 VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess){ int tmprc = dixLookupResourceByType((void *)&(pSrc), stuff
->src, PictureType, client, (1<<0)); if (tmprc != 0)
return tmprc;}
;
1468 if (!pSrc->pDrawable)
1469 return BadDrawable9;
1470 pScreen = pSrc->pDrawable->pScreen;
1471 width = pSrc->pDrawable->width;
1472 height = pSrc->pDrawable->height;
1473 if (height && width > UINT32_MAX4294967295U / (height * sizeof(CARD32)))
1474 return BadAlloc11;
1475 if (stuff->x > width || stuff->y > height)
1476 return BadMatch8;
1477 argbbits = malloc(width * height * sizeof(CARD32));
1478 if (!argbbits)
1479 return BadAlloc11;
1480
1481 stride = BitmapBytePad(width)(((int)((width) + 32 - 1) >> 5) << 2);
1482 nbytes_mono = stride * height;
1483 srcbits = calloc(1, nbytes_mono);
1484 if (!srcbits) {
1485 free(argbbits);
1486 return BadAlloc11;
1487 }
1488 mskbits = calloc(1, nbytes_mono);
1489 if (!mskbits) {
1490 free(argbbits);
1491 free(srcbits);
1492 return BadAlloc11;
1493 }
1494
1495 if (pSrc->format == PICT_a8r8g8b8) {
1496 (*pScreen->GetImage) (pSrc->pDrawable,
1497 0, 0, width, height, ZPixmap2,
1498 0xffffffff, (void *) argbbits);
1499 }
1500 else {
1501 PixmapPtr pPixmap;
1502 PicturePtr pPicture;
1503 PictFormatPtr pFormat;
1504 int error;
1505
1506 pFormat = PictureMatchFormat(pScreen, 32, PICT_a8r8g8b8);
1507 if (!pFormat) {
1508 free(argbbits);
1509 free(srcbits);
1510 free(mskbits);
1511 return BadImplementation17;
1512 }
1513 pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32,
1514 CREATE_PIXMAP_USAGE_SCRATCH1);
1515 if (!pPixmap) {
1516 free(argbbits);
1517 free(srcbits);
1518 free(mskbits);
1519 return BadAlloc11;
1520 }
1521 pPicture = CreatePicture(0, &pPixmap->drawable, pFormat, 0, 0,
1522 client, &error);
1523 if (!pPicture) {
1524 free(argbbits);
1525 free(srcbits);
1526 free(mskbits);
1527 return error;
1528 }
1529 (*pScreen->DestroyPixmap) (pPixmap);
1530 CompositePicture(PictOpSrc1,
1531 pSrc, 0, pPicture, 0, 0, 0, 0, 0, 0, width, height);
1532 (*pScreen->GetImage) (pPicture->pDrawable,
1533 0, 0, width, height, ZPixmap2,
1534 0xffffffff, (void *) argbbits);
1535 FreePicture(pPicture, 0);
1536 }
1537 /*
1538 * Check whether the cursor can be directly supported by
1539 * the core cursor code
1540 */
1541 ncolor = 0;
1542 argb = argbbits;
1543 for (y = 0; ncolor <= 2 && y < height; y++) {
1544 for (x = 0; ncolor <= 2 && x < width; x++) {
1545 CARD32 p = *argb++;
1546 CARD32 a = (p >> 24);
1547
1548 if (a == 0) /* transparent */
1549 continue;
1550 if (a == 0xff) { /* opaque */
1551 int n;
1552
1553 for (n = 0; n < ncolor; n++)
1554 if (p == twocolor[n])
1555 break;
1556 if (n == ncolor)
1557 twocolor[ncolor++] = p;
1558 }
1559 else
1560 ncolor = 3;
1561 }
1562 }
1563
1564 /*
1565 * Convert argb image to two plane cursor
1566 */
1567 srcline = srcbits;
1568 mskline = mskbits;
1569 argb = argbbits;
1570 for (y = 0; y < height; y++) {
1571 for (x = 0; x < width; x++) {
1572 CARD32 p = *argb++;
1573
1574 if (ncolor <= 2) {
1575 CARD32 a = ((p >> 24));
1576
1577 RenderSetBit(mskline, x, a != 0);
1578 RenderSetBit(srcline, x, a != 0 && p == twocolor[0]);
1579 }
1580 else {
1581 CARD32 a = ((p >> 24) * DITHER_SIZE((sizeof orderedDither / sizeof orderedDither[0][0]) + 1) + 127) / 255;
1582 CARD32 i = ((CvtR8G8B8toY15(p)(((((p) >> 16) & 0xff) * 153 + (((p) >> 8) &
0xff) * 301 + (((p) ) & 0xff) * 58) >> 2)
>> 7) * DITHER_SIZE((sizeof orderedDither / sizeof orderedDither[0][0]) + 1) + 127) / 255;
1583 CARD32 d =
1584 orderedDither[y & (DITHER_DIM2 - 1)][x & (DITHER_DIM2 - 1)];
1585 /* Set mask from dithered alpha value */
1586 RenderSetBit(mskline, x, a > d);
1587 /* Set src from dithered intensity value */
1588 RenderSetBit(srcline, x, a > d && i <= d);
1589 }
1590 }
1591 srcline += stride;
1592 mskline += stride;
1593 }
1594 /*
1595 * Dither to white and black if the cursor has more than two colors
1596 */
1597 if (ncolor > 2) {
1598 twocolor[0] = 0xff000000;
1599 twocolor[1] = 0xffffffff;
1600 }
1601 else {
1602 free(argbbits);
1603 argbbits = 0;
1604 }
1605
1606#define GetByte(p,s)(((p) >> (s)) & 0xff) (((p) >> (s)) & 0xff)
1607#define GetColor(p,s)((((p) >> (s)) & 0xff) | ((((p) >> (s)) &
0xff) << 8))
(GetByte(p,s)(((p) >> (s)) & 0xff) | (GetByte(p,s)(((p) >> (s)) & 0xff) << 8))
1608
1609 cm.width = width;
1610 cm.height = height;
1611 cm.xhot = stuff->x;
1612 cm.yhot = stuff->y;
1613 rc = AllocARGBCursor(srcbits, mskbits, argbbits, &cm,
1614 GetColor(twocolor[0], 16)((((twocolor[0]) >> (16)) & 0xff) | ((((twocolor[0]
) >> (16)) & 0xff) << 8))
,
1615 GetColor(twocolor[0], 8)((((twocolor[0]) >> (8)) & 0xff) | ((((twocolor[0])
>> (8)) & 0xff) << 8))
,
1616 GetColor(twocolor[0], 0)((((twocolor[0]) >> (0)) & 0xff) | ((((twocolor[0])
>> (0)) & 0xff) << 8))
,
1617 GetColor(twocolor[1], 16)((((twocolor[1]) >> (16)) & 0xff) | ((((twocolor[1]
) >> (16)) & 0xff) << 8))
,
1618 GetColor(twocolor[1], 8)((((twocolor[1]) >> (8)) & 0xff) | ((((twocolor[1])
>> (8)) & 0xff) << 8))
,
1619 GetColor(twocolor[1], 0)((((twocolor[1]) >> (0)) & 0xff) | ((((twocolor[1])
>> (0)) & 0xff) << 8))
,
1620 &pCursor, client, stuff->cid);
1621 if (rc != Success0)
1622 goto bail;
1623 if (!AddResourceDarwin_X_AddResource(stuff->cid, RT_CURSOR((RESTYPE)5), (void *) pCursor)) {
1624 rc = BadAlloc11;
1625 goto bail;
1626 }
1627
1628 return Success0;
1629 bail:
1630 free(srcbits);
1631 free(mskbits);
1632 return rc;
1633}
1634
1635static int
1636ProcRenderSetPictureTransform(ClientPtr client)
1637{
1638 REQUEST(xRenderSetPictureTransformReq)xRenderSetPictureTransformReq *stuff = (xRenderSetPictureTransformReq
*)client->requestBuffer
;
1639 PicturePtr pPicture;
1640
1641 REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq)if ((sizeof(xRenderSetPictureTransformReq) >> 2) != client
->req_len) return(16)
;
1642 VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess){ int tmprc = dixLookupResourceByType((void *)&(pPicture)
, stuff->picture, PictureType, client, (1<<5)); if (
tmprc != 0) return tmprc;}
;
1643 return SetPictureTransform(pPicture, (PictTransform *) &stuff->transform);
1644}
1645
1646static int
1647ProcRenderQueryFilters(ClientPtr client)
1648{
1649 REQUEST(xRenderQueryFiltersReq)xRenderQueryFiltersReq *stuff = (xRenderQueryFiltersReq *)client
->requestBuffer
;
1650 DrawablePtr pDrawable;
1651 xRenderQueryFiltersReply *reply;
1652 int nbytesName;
1653 int nnames;
1654 ScreenPtr pScreen;
1655 PictureScreenPtr ps;
1656 int i, j, len, total_bytes, rc;
1657 INT16 *aliases;
1658 char *names;
1659
1660 REQUEST_SIZE_MATCH(xRenderQueryFiltersReq)if ((sizeof(xRenderQueryFiltersReq) >> 2) != client->
req_len) return(16)
;
1661 rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
1662 DixGetAttrAccess(1<<4));
1663 if (rc != Success0)
1664 return rc;
1665
1666 pScreen = pDrawable->pScreen;
1667 nbytesName = 0;
1668 nnames = 0;
1669 ps = GetPictureScreenIfSet(pScreen)(dixPrivateKeyRegistered((&PictureScreenPrivateKeyRec)) ?
((PictureScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates
, (&PictureScreenPrivateKeyRec))) : ((void*)0))
;
1670 if (ps) {
1671 for (i = 0; i < ps->nfilters; i++)
1672 nbytesName += 1 + strlen(ps->filters[i].name);
1673 for (i = 0; i < ps->nfilterAliases; i++)
1674 nbytesName += 1 + strlen(ps->filterAliases[i].alias);
1675 nnames = ps->nfilters + ps->nfilterAliases;
1676 }
1677 len = ((nnames + 1) >> 1) + bytes_to_int32(nbytesName);
1678 total_bytes = sizeof(xRenderQueryFiltersReply) + (len << 2);
1679 reply = (xRenderQueryFiltersReply *) calloc(1, total_bytes);
1680 if (!reply)
1681 return BadAlloc11;
1682 aliases = (INT16 *) (reply + 1);
1683 names = (char *) (aliases + ((nnames + 1) & ~1));
1684
1685 reply->type = X_Reply1;
1686 reply->sequenceNumber = client->sequence;
1687 reply->length = len;
1688 reply->numAliases = nnames;
1689 reply->numFilters = nnames;
1690 if (ps) {
1691
1692 /* fill in alias values */
1693 for (i = 0; i < ps->nfilters; i++)
1694 aliases[i] = FilterAliasNone-1;
1695 for (i = 0; i < ps->nfilterAliases; i++) {
1696 for (j = 0; j < ps->nfilters; j++)
1697 if (ps->filterAliases[i].filter_id == ps->filters[j].id)
1698 break;
1699 if (j == ps->nfilters) {
1700 for (j = 0; j < ps->nfilterAliases; j++)
1701 if (ps->filterAliases[i].filter_id ==
1702 ps->filterAliases[j].alias_id) {
1703 break;
1704 }
1705 if (j == ps->nfilterAliases)
1706 j = FilterAliasNone-1;
1707 else
1708 j = j + ps->nfilters;
1709 }
1710 aliases[i + ps->nfilters] = j;
1711 }
1712
1713 /* fill in filter names */
1714 for (i = 0; i < ps->nfilters; i++) {
1715 j = strlen(ps->filters[i].name);
1716 *names++ = j;
1717 memcpy(names, ps->filters[i].name, j)__builtin___memcpy_chk (names, ps->filters[i].name, j, __builtin_object_size
(names, 0))
;
1718 names += j;
1719 }
1720
1721 /* fill in filter alias names */
1722 for (i = 0; i < ps->nfilterAliases; i++) {
1723 j = strlen(ps->filterAliases[i].alias);
1724 *names++ = j;
1725 memcpy(names, ps->filterAliases[i].alias, j)__builtin___memcpy_chk (names, ps->filterAliases[i].alias,
j, __builtin_object_size (names, 0))
;
1726 names += j;
1727 }
1728 }
1729
1730 if (client->swapped) {
1731 for (i = 0; i < reply->numAliases; i++) {
1732 swaps(&aliases[i])do { if (sizeof(*(&aliases[i])) != 2) wrong_size(); if (__builtin_constant_p
((uintptr_t)(&aliases[i]) & 1) && ((uintptr_t
)(&aliases[i]) & 1) == 0) *(&aliases[i]) = lswaps
(*(&aliases[i])); else swap_uint16((uint16_t *)(&aliases
[i])); } while (0)
;
1733 }
1734 swaps(&reply->sequenceNumber)do { if (sizeof(*(&reply->sequenceNumber)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&reply->sequenceNumber
) & 1) && ((uintptr_t)(&reply->sequenceNumber
) & 1) == 0) *(&reply->sequenceNumber) = lswaps(*(
&reply->sequenceNumber)); else swap_uint16((uint16_t *
)(&reply->sequenceNumber)); } while (0)
;
1735 swapl(&reply->length)do { if (sizeof(*(&reply->length)) != 4) wrong_size();
if (__builtin_constant_p((uintptr_t)(&reply->length) &
3) && ((uintptr_t)(&reply->length) & 3) ==
0) *(&reply->length) = lswapl(*(&reply->length
)); else swap_uint32((uint32_t *)(&reply->length)); } while
(0)
;
1736 swapl(&reply->numAliases)do { if (sizeof(*(&reply->numAliases)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&reply->numAliases
) & 3) && ((uintptr_t)(&reply->numAliases)
& 3) == 0) *(&reply->numAliases) = lswapl(*(&
reply->numAliases)); else swap_uint32((uint32_t *)(&reply
->numAliases)); } while (0)
;
1737 swapl(&reply->numFilters)do { if (sizeof(*(&reply->numFilters)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&reply->numFilters
) & 3) && ((uintptr_t)(&reply->numFilters)
& 3) == 0) *(&reply->numFilters) = lswapl(*(&
reply->numFilters)); else swap_uint32((uint32_t *)(&reply
->numFilters)); } while (0)
;
1738 }
1739 WriteToClient(client, total_bytes, reply);
1740 free(reply);
1741
1742 return Success0;
1743}
1744
1745static int
1746ProcRenderSetPictureFilter(ClientPtr client)
1747{
1748 REQUEST(xRenderSetPictureFilterReq)xRenderSetPictureFilterReq *stuff = (xRenderSetPictureFilterReq
*)client->requestBuffer
;
1749 PicturePtr pPicture;
1750 int result;
1751 xFixed *params;
1752 int nparams;
1753 char *name;
1754
1755 REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq)if ((sizeof(xRenderSetPictureFilterReq) >> 2) > client
->req_len ) return(16)
;
1756 VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess){ int tmprc = dixLookupResourceByType((void *)&(pPicture)
, stuff->picture, PictureType, client, (1<<5)); if (
tmprc != 0) return tmprc;}
;
1757 name = (char *) (stuff + 1);
1758 params = (xFixed *) (name + pad_to_int32(stuff->nbytes));
1759 nparams = ((xFixed *) stuff + client->req_len) - params;
1760 result = SetPictureFilter(pPicture, name, stuff->nbytes, params, nparams);
1761 return result;
1762}
1763
1764static int
1765ProcRenderCreateAnimCursor(ClientPtr client)
1766{
1767 REQUEST(xRenderCreateAnimCursorReq)xRenderCreateAnimCursorReq *stuff = (xRenderCreateAnimCursorReq
*)client->requestBuffer
;
1768 CursorPtr *cursors;
1769 CARD32 *deltas;
1770 CursorPtr pCursor;
1771 int ncursor;
1772 xAnimCursorElt *elt;
1773 int i;
1774 int ret;
1775
1776 REQUEST_AT_LEAST_SIZE(xRenderCreateAnimCursorReq)if ((sizeof(xRenderCreateAnimCursorReq) >> 2) > client
->req_len ) return(16)
;
1777 LEGAL_NEW_RESOURCE(stuff->cid, client)if (!LegalNewID(stuff->cid,client)) { client->errorValue
= stuff->cid; return 14; }
;
1778 if (client->req_len & 1)
1779 return BadLength16;
1780 ncursor =
1781 (client->req_len -
1782 (bytes_to_int32(sizeof(xRenderCreateAnimCursorReq)))) >> 1;
1783 cursors = xallocarray(ncursor, sizeof(CursorPtr) + sizeof(CARD32))xreallocarray(((void*)0), (ncursor), (sizeof(CursorPtr) + sizeof
(CARD32)))
;
1784 if (!cursors)
1785 return BadAlloc11;
1786 deltas = (CARD32 *) (cursors + ncursor);
1787 elt = (xAnimCursorElt *) (stuff + 1);
1788 for (i = 0; i < ncursor; i++) {
1789 ret = dixLookupResourceByType((void **) (cursors + i), elt->cursor,
1790 RT_CURSOR((RESTYPE)5), client, DixReadAccess(1<<0));
1791 if (ret != Success0) {
1792 free(cursors);
1793 return ret;
1794 }
1795 deltas[i] = elt->delay;
1796 elt++;
1797 }
1798 ret = AnimCursorCreate(cursors, deltas, ncursor, &pCursor, client,
1799 stuff->cid);
1800 free(cursors);
1801 if (ret != Success0)
1802 return ret;
1803
1804 if (AddResourceDarwin_X_AddResource(stuff->cid, RT_CURSOR((RESTYPE)5), (void *) pCursor))
1805 return Success0;
1806 return BadAlloc11;
1807}
1808
1809static int
1810ProcRenderAddTraps(ClientPtr client)
1811{
1812 int ntraps;
1813 PicturePtr pPicture;
1814
1815 REQUEST(xRenderAddTrapsReq)xRenderAddTrapsReq *stuff = (xRenderAddTrapsReq *)client->
requestBuffer
;
1816
1817 REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq)if ((sizeof(xRenderAddTrapsReq) >> 2) > client->req_len
) return(16)
;
1818 VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess){ int tmprc = dixLookupResourceByType((void *)&(pPicture)
, stuff->picture, PictureType, client, (1<<1)); if (
tmprc != 0) return tmprc;}
;
1819 if (!pPicture->pDrawable)
1820 return BadDrawable9;
1821 ntraps = (client->req_len << 2) - sizeof(xRenderAddTrapsReq);
1822 if (ntraps % sizeof(xTrap))
1823 return BadLength16;
1824 ntraps /= sizeof(xTrap);
1825 if (ntraps)
1826 AddTraps(pPicture,
1827 stuff->xOff, stuff->yOff, ntraps, (xTrap *) &stuff[1]);
1828 return Success0;
1829}
1830
1831static int
1832ProcRenderCreateSolidFill(ClientPtr client)
1833{
1834 PicturePtr pPicture;
1835 int error = 0;
1836
1837 REQUEST(xRenderCreateSolidFillReq)xRenderCreateSolidFillReq *stuff = (xRenderCreateSolidFillReq
*)client->requestBuffer
;
1838
1839 REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq)if ((sizeof(xRenderCreateSolidFillReq) >> 2) > client
->req_len ) return(16)
;
1840
1841 LEGAL_NEW_RESOURCE(stuff->pid, client)if (!LegalNewID(stuff->pid,client)) { client->errorValue
= stuff->pid; return 14; }
;
1842
1843 pPicture = CreateSolidPicture(stuff->pid, &stuff->color, &error);
1844 if (!pPicture)
1845 return error;
1846 /* security creation/labeling check */
1847 error = XaceHook(XACE_RESOURCE_ACCESS2, client, stuff->pid, PictureType,
1848 pPicture, RT_NONE((RESTYPE)0), NULL((void*)0), DixCreateAccess(1<<3));
1849 if (error != Success0)
1850 return error;
1851 if (!AddResourceDarwin_X_AddResource(stuff->pid, PictureType, (void *) pPicture))
1852 return BadAlloc11;
1853 return Success0;
1854}
1855
1856static int
1857ProcRenderCreateLinearGradient(ClientPtr client)
1858{
1859 PicturePtr pPicture;
1860 int len;
1861 int error = 0;
1862 xFixed *stops;
1863 xRenderColor *colors;
1864
1865 REQUEST(xRenderCreateLinearGradientReq)xRenderCreateLinearGradientReq *stuff = (xRenderCreateLinearGradientReq
*)client->requestBuffer
;
1866
1867 REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq)if ((sizeof(xRenderCreateLinearGradientReq) >> 2) > client
->req_len ) return(16)
;
1868
1869 LEGAL_NEW_RESOURCE(stuff->pid, client)if (!LegalNewID(stuff->pid,client)) { client->errorValue
= stuff->pid; return 14; }
;
1870
1871 len = (client->req_len << 2) - sizeof(xRenderCreateLinearGradientReq);
1872 if (stuff->nStops > UINT32_MAX4294967295U / (sizeof(xFixed) + sizeof(xRenderColor)))
1873 return BadLength16;
1874 if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
1875 return BadLength16;
1876
1877 stops = (xFixed *) (stuff + 1);
1878 colors = (xRenderColor *) (stops + stuff->nStops);
1879
1880 pPicture = CreateLinearGradientPicture(stuff->pid, &stuff->p1, &stuff->p2,
1881 stuff->nStops, stops, colors,
1882 &error);
1883 if (!pPicture)
1884 return error;
1885 /* security creation/labeling check */
1886 error = XaceHook(XACE_RESOURCE_ACCESS2, client, stuff->pid, PictureType,
1887 pPicture, RT_NONE((RESTYPE)0), NULL((void*)0), DixCreateAccess(1<<3));
1888 if (error != Success0)
1889 return error;
1890 if (!AddResourceDarwin_X_AddResource(stuff->pid, PictureType, (void *) pPicture))
1891 return BadAlloc11;
1892 return Success0;
1893}
1894
1895static int
1896ProcRenderCreateRadialGradient(ClientPtr client)
1897{
1898 PicturePtr pPicture;
1899 int len;
1900 int error = 0;
1901 xFixed *stops;
1902 xRenderColor *colors;
1903
1904 REQUEST(xRenderCreateRadialGradientReq)xRenderCreateRadialGradientReq *stuff = (xRenderCreateRadialGradientReq
*)client->requestBuffer
;
1905
1906 REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq)if ((sizeof(xRenderCreateRadialGradientReq) >> 2) > client
->req_len ) return(16)
;
1907
1908 LEGAL_NEW_RESOURCE(stuff->pid, client)if (!LegalNewID(stuff->pid,client)) { client->errorValue
= stuff->pid; return 14; }
;
1909
1910 len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq);
1911 if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
1912 return BadLength16;
1913
1914 stops = (xFixed *) (stuff + 1);
1915 colors = (xRenderColor *) (stops + stuff->nStops);
1916
1917 pPicture =
1918 CreateRadialGradientPicture(stuff->pid, &stuff->inner, &stuff->outer,
1919 stuff->inner_radius, stuff->outer_radius,
1920 stuff->nStops, stops, colors, &error);
1921 if (!pPicture)
1922 return error;
1923 /* security creation/labeling check */
1924 error = XaceHook(XACE_RESOURCE_ACCESS2, client, stuff->pid, PictureType,
1925 pPicture, RT_NONE((RESTYPE)0), NULL((void*)0), DixCreateAccess(1<<3));
1926 if (error != Success0)
1927 return error;
1928 if (!AddResourceDarwin_X_AddResource(stuff->pid, PictureType, (void *) pPicture))
1929 return BadAlloc11;
1930 return Success0;
1931}
1932
1933static int
1934ProcRenderCreateConicalGradient(ClientPtr client)
1935{
1936 PicturePtr pPicture;
1937 int len;
1938 int error = 0;
1939 xFixed *stops;
1940 xRenderColor *colors;
1941
1942 REQUEST(xRenderCreateConicalGradientReq)xRenderCreateConicalGradientReq *stuff = (xRenderCreateConicalGradientReq
*)client->requestBuffer
;
1943
1944 REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq)if ((sizeof(xRenderCreateConicalGradientReq) >> 2) >
client->req_len ) return(16)
;
1945
1946 LEGAL_NEW_RESOURCE(stuff->pid, client)if (!LegalNewID(stuff->pid,client)) { client->errorValue
= stuff->pid; return 14; }
;
1947
1948 len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq);
1949 if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
1950 return BadLength16;
1951
1952 stops = (xFixed *) (stuff + 1);
1953 colors = (xRenderColor *) (stops + stuff->nStops);
1954
1955 pPicture =
1956 CreateConicalGradientPicture(stuff->pid, &stuff->center, stuff->angle,
1957 stuff->nStops, stops, colors, &error);
1958 if (!pPicture)
1959 return error;
1960 /* security creation/labeling check */
1961 error = XaceHook(XACE_RESOURCE_ACCESS2, client, stuff->pid, PictureType,
1962 pPicture, RT_NONE((RESTYPE)0), NULL((void*)0), DixCreateAccess(1<<3));
1963 if (error != Success0)
1964 return error;
1965 if (!AddResourceDarwin_X_AddResource(stuff->pid, PictureType, (void *) pPicture))
1966 return BadAlloc11;
1967 return Success0;
1968}
1969
1970static int
1971ProcRenderDispatch(ClientPtr client)
1972{
1973 REQUEST(xReq)xReq *stuff = (xReq *)client->requestBuffer;
1974
1975 if (stuff->data < RenderNumberRequests(36 +1))
1976 return (*ProcRenderVector[stuff->data]) (client);
1977 else
1978 return BadRequest1;
1979}
1980
1981static int
1982SProcRenderQueryVersion(ClientPtr client)
1983{
1984 REQUEST(xRenderQueryVersionReq)xRenderQueryVersionReq *stuff = (xRenderQueryVersionReq *)client
->requestBuffer
;
1985 REQUEST_SIZE_MATCH(xRenderQueryVersionReq)if ((sizeof(xRenderQueryVersionReq) >> 2) != client->
req_len) return(16)
;
1986 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
1987 swapl(&stuff->majorVersion)do { if (sizeof(*(&stuff->majorVersion)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->majorVersion
) & 3) && ((uintptr_t)(&stuff->majorVersion
) & 3) == 0) *(&stuff->majorVersion) = lswapl(*(&
stuff->majorVersion)); else swap_uint32((uint32_t *)(&
stuff->majorVersion)); } while (0)
;
1988 swapl(&stuff->minorVersion)do { if (sizeof(*(&stuff->minorVersion)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->minorVersion
) & 3) && ((uintptr_t)(&stuff->minorVersion
) & 3) == 0) *(&stuff->minorVersion) = lswapl(*(&
stuff->minorVersion)); else swap_uint32((uint32_t *)(&
stuff->minorVersion)); } while (0)
;
1989 return (*ProcRenderVector[stuff->renderReqType]) (client);
1990}
1991
1992static int
1993SProcRenderQueryPictFormats(ClientPtr client)
1994{
1995 REQUEST(xRenderQueryPictFormatsReq)xRenderQueryPictFormatsReq *stuff = (xRenderQueryPictFormatsReq
*)client->requestBuffer
;
1996 REQUEST_SIZE_MATCH(xRenderQueryPictFormatsReq)if ((sizeof(xRenderQueryPictFormatsReq) >> 2) != client
->req_len) return(16)
;
1997 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
1998 return (*ProcRenderVector[stuff->renderReqType]) (client);
1999}
2000
2001static int
2002SProcRenderQueryPictIndexValues(ClientPtr client)
2003{
2004 REQUEST(xRenderQueryPictIndexValuesReq)xRenderQueryPictIndexValuesReq *stuff = (xRenderQueryPictIndexValuesReq
*)client->requestBuffer
;
2005 REQUEST_AT_LEAST_SIZE(xRenderQueryPictIndexValuesReq)if ((sizeof(xRenderQueryPictIndexValuesReq) >> 2) > client
->req_len ) return(16)
;
2006 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2007 swapl(&stuff->format)do { if (sizeof(*(&stuff->format)) != 4) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->format) &
3) && ((uintptr_t)(&stuff->format) & 3) ==
0) *(&stuff->format) = lswapl(*(&stuff->format
)); else swap_uint32((uint32_t *)(&stuff->format)); } while
(0)
;
2008 return (*ProcRenderVector[stuff->renderReqType]) (client);
2009}
2010
2011static int
2012SProcRenderQueryDithers(ClientPtr client)
2013{
2014 return BadImplementation17;
2015}
2016
2017static int
2018SProcRenderCreatePicture(ClientPtr client)
2019{
2020 REQUEST(xRenderCreatePictureReq)xRenderCreatePictureReq *stuff = (xRenderCreatePictureReq *)client
->requestBuffer
;
2021 REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq)if ((sizeof(xRenderCreatePictureReq) >> 2) > client->
req_len ) return(16)
;
2022 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2023 swapl(&stuff->pid)do { if (sizeof(*(&stuff->pid)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->pid) & 3
) && ((uintptr_t)(&stuff->pid) & 3) == 0) *
(&stuff->pid) = lswapl(*(&stuff->pid)); else swap_uint32
((uint32_t *)(&stuff->pid)); } while (0)
;
2024 swapl(&stuff->drawable)do { if (sizeof(*(&stuff->drawable)) != 4) wrong_size(
); if (__builtin_constant_p((uintptr_t)(&stuff->drawable
) & 3) && ((uintptr_t)(&stuff->drawable) &
3) == 0) *(&stuff->drawable) = lswapl(*(&stuff->
drawable)); else swap_uint32((uint32_t *)(&stuff->drawable
)); } while (0)
;
2025 swapl(&stuff->format)do { if (sizeof(*(&stuff->format)) != 4) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->format) &
3) && ((uintptr_t)(&stuff->format) & 3) ==
0) *(&stuff->format) = lswapl(*(&stuff->format
)); else swap_uint32((uint32_t *)(&stuff->format)); } while
(0)
;
2026 swapl(&stuff->mask)do { if (sizeof(*(&stuff->mask)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->mask) &
3) && ((uintptr_t)(&stuff->mask) & 3) == 0
) *(&stuff->mask) = lswapl(*(&stuff->mask)); else
swap_uint32((uint32_t *)(&stuff->mask)); } while (0)
;
2027 SwapRestL(stuff)SwapLongs((CARD32 *)(stuff + 1), (client->req_len - (sizeof
(*stuff) >> 2)))
;
2028 return (*ProcRenderVector[stuff->renderReqType]) (client);
2029}
2030
2031static int
2032SProcRenderChangePicture(ClientPtr client)
2033{
2034 REQUEST(xRenderChangePictureReq)xRenderChangePictureReq *stuff = (xRenderChangePictureReq *)client
->requestBuffer
;
2035 REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq)if ((sizeof(xRenderChangePictureReq) >> 2) > client->
req_len ) return(16)
;
2036 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2037 swapl(&stuff->picture)do { if (sizeof(*(&stuff->picture)) != 4) wrong_size()
; if (__builtin_constant_p((uintptr_t)(&stuff->picture
) & 3) && ((uintptr_t)(&stuff->picture) &
3) == 0) *(&stuff->picture) = lswapl(*(&stuff->
picture)); else swap_uint32((uint32_t *)(&stuff->picture
)); } while (0)
;
2038 swapl(&stuff->mask)do { if (sizeof(*(&stuff->mask)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->mask) &
3) && ((uintptr_t)(&stuff->mask) & 3) == 0
) *(&stuff->mask) = lswapl(*(&stuff->mask)); else
swap_uint32((uint32_t *)(&stuff->mask)); } while (0)
;
2039 SwapRestL(stuff)SwapLongs((CARD32 *)(stuff + 1), (client->req_len - (sizeof
(*stuff) >> 2)))
;
2040 return (*ProcRenderVector[stuff->renderReqType]) (client);
2041}
2042
2043static int
2044SProcRenderSetPictureClipRectangles(ClientPtr client)
2045{
2046 REQUEST(xRenderSetPictureClipRectanglesReq)xRenderSetPictureClipRectanglesReq *stuff = (xRenderSetPictureClipRectanglesReq
*)client->requestBuffer
;
2047 REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq)if ((sizeof(xRenderSetPictureClipRectanglesReq) >> 2) >
client->req_len ) return(16)
;
2048 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2049 swapl(&stuff->picture)do { if (sizeof(*(&stuff->picture)) != 4) wrong_size()
; if (__builtin_constant_p((uintptr_t)(&stuff->picture
) & 3) && ((uintptr_t)(&stuff->picture) &
3) == 0) *(&stuff->picture) = lswapl(*(&stuff->
picture)); else swap_uint32((uint32_t *)(&stuff->picture
)); } while (0)
;
2050 swaps(&stuff->xOrigin)do { if (sizeof(*(&stuff->xOrigin)) != 2) wrong_size()
; if (__builtin_constant_p((uintptr_t)(&stuff->xOrigin
) & 1) && ((uintptr_t)(&stuff->xOrigin) &
1) == 0) *(&stuff->xOrigin) = lswaps(*(&stuff->
xOrigin)); else swap_uint16((uint16_t *)(&stuff->xOrigin
)); } while (0)
;
2051 swaps(&stuff->yOrigin)do { if (sizeof(*(&stuff->yOrigin)) != 2) wrong_size()
; if (__builtin_constant_p((uintptr_t)(&stuff->yOrigin
) & 1) && ((uintptr_t)(&stuff->yOrigin) &
1) == 0) *(&stuff->yOrigin) = lswaps(*(&stuff->
yOrigin)); else swap_uint16((uint16_t *)(&stuff->yOrigin
)); } while (0)
;
2052 SwapRestS(stuff)SwapShorts((short *)(stuff + 1), ((client->req_len <<
1) - (sizeof(*stuff) >> 1)))
;
2053 return (*ProcRenderVector[stuff->renderReqType]) (client);
2054}
2055
2056static int
2057SProcRenderFreePicture(ClientPtr client)
2058{
2059 REQUEST(xRenderFreePictureReq)xRenderFreePictureReq *stuff = (xRenderFreePictureReq *)client
->requestBuffer
;
2060 REQUEST_SIZE_MATCH(xRenderFreePictureReq)if ((sizeof(xRenderFreePictureReq) >> 2) != client->
req_len) return(16)
;
2061 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2062 swapl(&stuff->picture)do { if (sizeof(*(&stuff->picture)) != 4) wrong_size()
; if (__builtin_constant_p((uintptr_t)(&stuff->picture
) & 3) && ((uintptr_t)(&stuff->picture) &
3) == 0) *(&stuff->picture) = lswapl(*(&stuff->
picture)); else swap_uint32((uint32_t *)(&stuff->picture
)); } while (0)
;
2063 return (*ProcRenderVector[stuff->renderReqType]) (client);
2064}
2065
2066static int
2067SProcRenderComposite(ClientPtr client)
2068{
2069 REQUEST(xRenderCompositeReq)xRenderCompositeReq *stuff = (xRenderCompositeReq *)client->
requestBuffer
;
2070 REQUEST_SIZE_MATCH(xRenderCompositeReq)if ((sizeof(xRenderCompositeReq) >> 2) != client->req_len
) return(16)
;
2071 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2072 swapl(&stuff->src)do { if (sizeof(*(&stuff->src)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->src) & 3
) && ((uintptr_t)(&stuff->src) & 3) == 0) *
(&stuff->src) = lswapl(*(&stuff->src)); else swap_uint32
((uint32_t *)(&stuff->src)); } while (0)
;
2073 swapl(&stuff->mask)do { if (sizeof(*(&stuff->mask)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->mask) &
3) && ((uintptr_t)(&stuff->mask) & 3) == 0
) *(&stuff->mask) = lswapl(*(&stuff->mask)); else
swap_uint32((uint32_t *)(&stuff->mask)); } while (0)
;
2074 swapl(&stuff->dst)do { if (sizeof(*(&stuff->dst)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->dst) & 3
) && ((uintptr_t)(&stuff->dst) & 3) == 0) *
(&stuff->dst) = lswapl(*(&stuff->dst)); else swap_uint32
((uint32_t *)(&stuff->dst)); } while (0)
;
2075 swaps(&stuff->xSrc)do { if (sizeof(*(&stuff->xSrc)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->xSrc) &
1) && ((uintptr_t)(&stuff->xSrc) & 1) == 0
) *(&stuff->xSrc) = lswaps(*(&stuff->xSrc)); else
swap_uint16((uint16_t *)(&stuff->xSrc)); } while (0)
;
2076 swaps(&stuff->ySrc)do { if (sizeof(*(&stuff->ySrc)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->ySrc) &
1) && ((uintptr_t)(&stuff->ySrc) & 1) == 0
) *(&stuff->ySrc) = lswaps(*(&stuff->ySrc)); else
swap_uint16((uint16_t *)(&stuff->ySrc)); } while (0)
;
2077 swaps(&stuff->xMask)do { if (sizeof(*(&stuff->xMask)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->xMask) &
1) && ((uintptr_t)(&stuff->xMask) & 1) ==
0) *(&stuff->xMask) = lswaps(*(&stuff->xMask))
; else swap_uint16((uint16_t *)(&stuff->xMask)); } while
(0)
;
2078 swaps(&stuff->yMask)do { if (sizeof(*(&stuff->yMask)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->yMask) &
1) && ((uintptr_t)(&stuff->yMask) & 1) ==
0) *(&stuff->yMask) = lswaps(*(&stuff->yMask))
; else swap_uint16((uint16_t *)(&stuff->yMask)); } while
(0)
;
2079 swaps(&stuff->xDst)do { if (sizeof(*(&stuff->xDst)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->xDst) &
1) && ((uintptr_t)(&stuff->xDst) & 1) == 0
) *(&stuff->xDst) = lswaps(*(&stuff->xDst)); else
swap_uint16((uint16_t *)(&stuff->xDst)); } while (0)
;
2080 swaps(&stuff->yDst)do { if (sizeof(*(&stuff->yDst)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->yDst) &
1) && ((uintptr_t)(&stuff->yDst) & 1) == 0
) *(&stuff->yDst) = lswaps(*(&stuff->yDst)); else
swap_uint16((uint16_t *)(&stuff->yDst)); } while (0)
;
2081 swaps(&stuff->width)do { if (sizeof(*(&stuff->width)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->width) &
1) && ((uintptr_t)(&stuff->width) & 1) ==
0) *(&stuff->width) = lswaps(*(&stuff->width))
; else swap_uint16((uint16_t *)(&stuff->width)); } while
(0)
;
2082 swaps(&stuff->height)do { if (sizeof(*(&stuff->height)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->height) &
1) && ((uintptr_t)(&stuff->height) & 1) ==
0) *(&stuff->height) = lswaps(*(&stuff->height
)); else swap_uint16((uint16_t *)(&stuff->height)); } while
(0)
;
2083 return (*ProcRenderVector[stuff->renderReqType]) (client);
2084}
2085
2086static int
2087SProcRenderScale(ClientPtr client)
2088{
2089 return BadImplementation17;
2090}
2091
2092static int
2093SProcRenderTrapezoids(ClientPtr client)
2094{
2095 REQUEST(xRenderTrapezoidsReq)xRenderTrapezoidsReq *stuff = (xRenderTrapezoidsReq *)client->
requestBuffer
;
2096
2097 REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq)if ((sizeof(xRenderTrapezoidsReq) >> 2) > client->
req_len ) return(16)
;
2098 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2099 swapl(&stuff->src)do { if (sizeof(*(&stuff->src)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->src) & 3
) && ((uintptr_t)(&stuff->src) & 3) == 0) *
(&stuff->src) = lswapl(*(&stuff->src)); else swap_uint32
((uint32_t *)(&stuff->src)); } while (0)
;
2100 swapl(&stuff->dst)do { if (sizeof(*(&stuff->dst)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->dst) & 3
) && ((uintptr_t)(&stuff->dst) & 3) == 0) *
(&stuff->dst) = lswapl(*(&stuff->dst)); else swap_uint32
((uint32_t *)(&stuff->dst)); } while (0)
;
2101 swapl(&stuff->maskFormat)do { if (sizeof(*(&stuff->maskFormat)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->maskFormat
) & 3) && ((uintptr_t)(&stuff->maskFormat)
& 3) == 0) *(&stuff->maskFormat) = lswapl(*(&
stuff->maskFormat)); else swap_uint32((uint32_t *)(&stuff
->maskFormat)); } while (0)
;
2102 swaps(&stuff->xSrc)do { if (sizeof(*(&stuff->xSrc)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->xSrc) &
1) && ((uintptr_t)(&stuff->xSrc) & 1) == 0
) *(&stuff->xSrc) = lswaps(*(&stuff->xSrc)); else
swap_uint16((uint16_t *)(&stuff->xSrc)); } while (0)
;
2103 swaps(&stuff->ySrc)do { if (sizeof(*(&stuff->ySrc)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->ySrc) &
1) && ((uintptr_t)(&stuff->ySrc) & 1) == 0
) *(&stuff->ySrc) = lswaps(*(&stuff->ySrc)); else
swap_uint16((uint16_t *)(&stuff->ySrc)); } while (0)
;
2104 SwapRestL(stuff)SwapLongs((CARD32 *)(stuff + 1), (client->req_len - (sizeof
(*stuff) >> 2)))
;
2105 return (*ProcRenderVector[stuff->renderReqType]) (client);
2106}
2107
2108static int
2109SProcRenderTriangles(ClientPtr client)
2110{
2111 REQUEST(xRenderTrianglesReq)xRenderTrianglesReq *stuff = (xRenderTrianglesReq *)client->
requestBuffer
;
2112
2113 REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq)if ((sizeof(xRenderTrianglesReq) >> 2) > client->
req_len ) return(16)
;
2114 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2115 swapl(&stuff->src)do { if (sizeof(*(&stuff->src)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->src) & 3
) && ((uintptr_t)(&stuff->src) & 3) == 0) *
(&stuff->src) = lswapl(*(&stuff->src)); else swap_uint32
((uint32_t *)(&stuff->src)); } while (0)
;
2116 swapl(&stuff->dst)do { if (sizeof(*(&stuff->dst)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->dst) & 3
) && ((uintptr_t)(&stuff->dst) & 3) == 0) *
(&stuff->dst) = lswapl(*(&stuff->dst)); else swap_uint32
((uint32_t *)(&stuff->dst)); } while (0)
;
2117 swapl(&stuff->maskFormat)do { if (sizeof(*(&stuff->maskFormat)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->maskFormat
) & 3) && ((uintptr_t)(&stuff->maskFormat)
& 3) == 0) *(&stuff->maskFormat) = lswapl(*(&
stuff->maskFormat)); else swap_uint32((uint32_t *)(&stuff
->maskFormat)); } while (0)
;
2118 swaps(&stuff->xSrc)do { if (sizeof(*(&stuff->xSrc)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->xSrc) &
1) && ((uintptr_t)(&stuff->xSrc) & 1) == 0
) *(&stuff->xSrc) = lswaps(*(&stuff->xSrc)); else
swap_uint16((uint16_t *)(&stuff->xSrc)); } while (0)
;
2119 swaps(&stuff->ySrc)do { if (sizeof(*(&stuff->ySrc)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->ySrc) &
1) && ((uintptr_t)(&stuff->ySrc) & 1) == 0
) *(&stuff->ySrc) = lswaps(*(&stuff->ySrc)); else
swap_uint16((uint16_t *)(&stuff->ySrc)); } while (0)
;
2120 SwapRestL(stuff)SwapLongs((CARD32 *)(stuff + 1), (client->req_len - (sizeof
(*stuff) >> 2)))
;
2121 return (*ProcRenderVector[stuff->renderReqType]) (client);
2122}
2123
2124static int
2125SProcRenderTriStrip(ClientPtr client)
2126{
2127 REQUEST(xRenderTriStripReq)xRenderTriStripReq *stuff = (xRenderTriStripReq *)client->
requestBuffer
;
2128
2129 REQUEST_AT_LEAST_SIZE(xRenderTriStripReq)if ((sizeof(xRenderTriStripReq) >> 2) > client->req_len
) return(16)
;
2130 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2131 swapl(&stuff->src)do { if (sizeof(*(&stuff->src)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->src) & 3
) && ((uintptr_t)(&stuff->src) & 3) == 0) *
(&stuff->src) = lswapl(*(&stuff->src)); else swap_uint32
((uint32_t *)(&stuff->src)); } while (0)
;
2132 swapl(&stuff->dst)do { if (sizeof(*(&stuff->dst)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->dst) & 3
) && ((uintptr_t)(&stuff->dst) & 3) == 0) *
(&stuff->dst) = lswapl(*(&stuff->dst)); else swap_uint32
((uint32_t *)(&stuff->dst)); } while (0)
;
2133 swapl(&stuff->maskFormat)do { if (sizeof(*(&stuff->maskFormat)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->maskFormat
) & 3) && ((uintptr_t)(&stuff->maskFormat)
& 3) == 0) *(&stuff->maskFormat) = lswapl(*(&
stuff->maskFormat)); else swap_uint32((uint32_t *)(&stuff
->maskFormat)); } while (0)
;
2134 swaps(&stuff->xSrc)do { if (sizeof(*(&stuff->xSrc)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->xSrc) &
1) && ((uintptr_t)(&stuff->xSrc) & 1) == 0
) *(&stuff->xSrc) = lswaps(*(&stuff->xSrc)); else
swap_uint16((uint16_t *)(&stuff->xSrc)); } while (0)
;
2135 swaps(&stuff->ySrc)do { if (sizeof(*(&stuff->ySrc)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->ySrc) &
1) && ((uintptr_t)(&stuff->ySrc) & 1) == 0
) *(&stuff->ySrc) = lswaps(*(&stuff->ySrc)); else
swap_uint16((uint16_t *)(&stuff->ySrc)); } while (0)
;
2136 SwapRestL(stuff)SwapLongs((CARD32 *)(stuff + 1), (client->req_len - (sizeof
(*stuff) >> 2)))
;
2137 return (*ProcRenderVector[stuff->renderReqType]) (client);
2138}
2139
2140static int
2141SProcRenderTriFan(ClientPtr client)
2142{
2143 REQUEST(xRenderTriFanReq)xRenderTriFanReq *stuff = (xRenderTriFanReq *)client->requestBuffer;
2144
2145 REQUEST_AT_LEAST_SIZE(xRenderTriFanReq)if ((sizeof(xRenderTriFanReq) >> 2) > client->req_len
) return(16)
;
2146 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2147 swapl(&stuff->src)do { if (sizeof(*(&stuff->src)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->src) & 3
) && ((uintptr_t)(&stuff->src) & 3) == 0) *
(&stuff->src) = lswapl(*(&stuff->src)); else swap_uint32
((uint32_t *)(&stuff->src)); } while (0)
;
2148 swapl(&stuff->dst)do { if (sizeof(*(&stuff->dst)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->dst) & 3
) && ((uintptr_t)(&stuff->dst) & 3) == 0) *
(&stuff->dst) = lswapl(*(&stuff->dst)); else swap_uint32
((uint32_t *)(&stuff->dst)); } while (0)
;
2149 swapl(&stuff->maskFormat)do { if (sizeof(*(&stuff->maskFormat)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->maskFormat
) & 3) && ((uintptr_t)(&stuff->maskFormat)
& 3) == 0) *(&stuff->maskFormat) = lswapl(*(&
stuff->maskFormat)); else swap_uint32((uint32_t *)(&stuff
->maskFormat)); } while (0)
;
2150 swaps(&stuff->xSrc)do { if (sizeof(*(&stuff->xSrc)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->xSrc) &
1) && ((uintptr_t)(&stuff->xSrc) & 1) == 0
) *(&stuff->xSrc) = lswaps(*(&stuff->xSrc)); else
swap_uint16((uint16_t *)(&stuff->xSrc)); } while (0)
;
2151 swaps(&stuff->ySrc)do { if (sizeof(*(&stuff->ySrc)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->ySrc) &
1) && ((uintptr_t)(&stuff->ySrc) & 1) == 0
) *(&stuff->ySrc) = lswaps(*(&stuff->ySrc)); else
swap_uint16((uint16_t *)(&stuff->ySrc)); } while (0)
;
2152 SwapRestL(stuff)SwapLongs((CARD32 *)(stuff + 1), (client->req_len - (sizeof
(*stuff) >> 2)))
;
2153 return (*ProcRenderVector[stuff->renderReqType]) (client);
2154}
2155
2156static int
2157SProcRenderColorTrapezoids(ClientPtr client)
2158{
2159 return BadImplementation17;
2160}
2161
2162static int
2163SProcRenderColorTriangles(ClientPtr client)
2164{
2165 return BadImplementation17;
2166}
2167
2168static int
2169SProcRenderTransform(ClientPtr client)
2170{
2171 return BadImplementation17;
2172}
2173
2174static int
2175SProcRenderCreateGlyphSet(ClientPtr client)
2176{
2177 REQUEST(xRenderCreateGlyphSetReq)xRenderCreateGlyphSetReq *stuff = (xRenderCreateGlyphSetReq *
)client->requestBuffer
;
2178 REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq)if ((sizeof(xRenderCreateGlyphSetReq) >> 2) != client->
req_len) return(16)
;
2179 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2180 swapl(&stuff->gsid)do { if (sizeof(*(&stuff->gsid)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->gsid) &
3) && ((uintptr_t)(&stuff->gsid) & 3) == 0
) *(&stuff->gsid) = lswapl(*(&stuff->gsid)); else
swap_uint32((uint32_t *)(&stuff->gsid)); } while (0)
;
2181 swapl(&stuff->format)do { if (sizeof(*(&stuff->format)) != 4) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->format) &
3) && ((uintptr_t)(&stuff->format) & 3) ==
0) *(&stuff->format) = lswapl(*(&stuff->format
)); else swap_uint32((uint32_t *)(&stuff->format)); } while
(0)
;
2182 return (*ProcRenderVector[stuff->renderReqType]) (client);
2183}
2184
2185static int
2186SProcRenderReferenceGlyphSet(ClientPtr client)
2187{
2188 REQUEST(xRenderReferenceGlyphSetReq)xRenderReferenceGlyphSetReq *stuff = (xRenderReferenceGlyphSetReq
*)client->requestBuffer
;
2189 REQUEST_SIZE_MATCH(xRenderReferenceGlyphSetReq)if ((sizeof(xRenderReferenceGlyphSetReq) >> 2) != client
->req_len) return(16)
;
2190 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2191 swapl(&stuff->gsid)do { if (sizeof(*(&stuff->gsid)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->gsid) &
3) && ((uintptr_t)(&stuff->gsid) & 3) == 0
) *(&stuff->gsid) = lswapl(*(&stuff->gsid)); else
swap_uint32((uint32_t *)(&stuff->gsid)); } while (0)
;
2192 swapl(&stuff->existing)do { if (sizeof(*(&stuff->existing)) != 4) wrong_size(
); if (__builtin_constant_p((uintptr_t)(&stuff->existing
) & 3) && ((uintptr_t)(&stuff->existing) &
3) == 0) *(&stuff->existing) = lswapl(*(&stuff->
existing)); else swap_uint32((uint32_t *)(&stuff->existing
)); } while (0)
;
2193 return (*ProcRenderVector[stuff->renderReqType]) (client);
2194}
2195
2196static int
2197SProcRenderFreeGlyphSet(ClientPtr client)
2198{
2199 REQUEST(xRenderFreeGlyphSetReq)xRenderFreeGlyphSetReq *stuff = (xRenderFreeGlyphSetReq *)client
->requestBuffer
;
2200 REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq)if ((sizeof(xRenderFreeGlyphSetReq) >> 2) != client->
req_len) return(16)
;
2201 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2202 swapl(&stuff->glyphset)do { if (sizeof(*(&stuff->glyphset)) != 4) wrong_size(
); if (__builtin_constant_p((uintptr_t)(&stuff->glyphset
) & 3) && ((uintptr_t)(&stuff->glyphset) &
3) == 0) *(&stuff->glyphset) = lswapl(*(&stuff->
glyphset)); else swap_uint32((uint32_t *)(&stuff->glyphset
)); } while (0)
;
2203 return (*ProcRenderVector[stuff->renderReqType]) (client);
2204}
2205
2206static int
2207SProcRenderAddGlyphs(ClientPtr client)
2208{
2209 register int i;
2210 CARD32 *gids;
2211 void *end;
2212 xGlyphInfo *gi;
2213
2214 REQUEST(xRenderAddGlyphsReq)xRenderAddGlyphsReq *stuff = (xRenderAddGlyphsReq *)client->
requestBuffer
;
2215 REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq)if ((sizeof(xRenderAddGlyphsReq) >> 2) > client->
req_len ) return(16)
;
2216 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2217 swapl(&stuff->glyphset)do { if (sizeof(*(&stuff->glyphset)) != 4) wrong_size(
); if (__builtin_constant_p((uintptr_t)(&stuff->glyphset
) & 3) && ((uintptr_t)(&stuff->glyphset) &
3) == 0) *(&stuff->glyphset) = lswapl(*(&stuff->
glyphset)); else swap_uint32((uint32_t *)(&stuff->glyphset
)); } while (0)
;
2218 swapl(&stuff->nglyphs)do { if (sizeof(*(&stuff->nglyphs)) != 4) wrong_size()
; if (__builtin_constant_p((uintptr_t)(&stuff->nglyphs
) & 3) && ((uintptr_t)(&stuff->nglyphs) &
3) == 0) *(&stuff->nglyphs) = lswapl(*(&stuff->
nglyphs)); else swap_uint32((uint32_t *)(&stuff->nglyphs
)); } while (0)
;
2219 if (stuff->nglyphs & 0xe0000000)
2220 return BadLength16;
2221 end = (CARD8 *) stuff + (client->req_len << 2);
2222 gids = (CARD32 *) (stuff + 1);
2223 gi = (xGlyphInfo *) (gids + stuff->nglyphs);
2224 if ((char *) end - (char *) (gids + stuff->nglyphs) < 0)
2225 return BadLength16;
2226 if ((char *) end - (char *) (gi + stuff->nglyphs) < 0)
2227 return BadLength16;
2228 for (i = 0; i < stuff->nglyphs; i++) {
2229 swapl(&gids[i])do { if (sizeof(*(&gids[i])) != 4) wrong_size(); if (__builtin_constant_p
((uintptr_t)(&gids[i]) & 3) && ((uintptr_t)(&
gids[i]) & 3) == 0) *(&gids[i]) = lswapl(*(&gids[
i])); else swap_uint32((uint32_t *)(&gids[i])); } while (
0)
;
2230 swaps(&gi[i].width)do { if (sizeof(*(&gi[i].width)) != 2) wrong_size(); if (
__builtin_constant_p((uintptr_t)(&gi[i].width) & 1) &&
((uintptr_t)(&gi[i].width) & 1) == 0) *(&gi[i].width
) = lswaps(*(&gi[i].width)); else swap_uint16((uint16_t *
)(&gi[i].width)); } while (0)
;
2231 swaps(&gi[i].height)do { if (sizeof(*(&gi[i].height)) != 2) wrong_size(); if (
__builtin_constant_p((uintptr_t)(&gi[i].height) & 1) &&
((uintptr_t)(&gi[i].height) & 1) == 0) *(&gi[i].
height) = lswaps(*(&gi[i].height)); else swap_uint16((uint16_t
*)(&gi[i].height)); } while (0)
;
2232 swaps(&gi[i].x)do { if (sizeof(*(&gi[i].x)) != 2) wrong_size(); if (__builtin_constant_p
((uintptr_t)(&gi[i].x) & 1) && ((uintptr_t)(&
gi[i].x) & 1) == 0) *(&gi[i].x) = lswaps(*(&gi[i]
.x)); else swap_uint16((uint16_t *)(&gi[i].x)); } while (
0)
;
2233 swaps(&gi[i].y)do { if (sizeof(*(&gi[i].y)) != 2) wrong_size(); if (__builtin_constant_p
((uintptr_t)(&gi[i].y) & 1) && ((uintptr_t)(&
gi[i].y) & 1) == 0) *(&gi[i].y) = lswaps(*(&gi[i]
.y)); else swap_uint16((uint16_t *)(&gi[i].y)); } while (
0)
;
2234 swaps(&gi[i].xOff)do { if (sizeof(*(&gi[i].xOff)) != 2) wrong_size(); if (__builtin_constant_p
((uintptr_t)(&gi[i].xOff) & 1) && ((uintptr_t
)(&gi[i].xOff) & 1) == 0) *(&gi[i].xOff) = lswaps
(*(&gi[i].xOff)); else swap_uint16((uint16_t *)(&gi[i
].xOff)); } while (0)
;
2235 swaps(&gi[i].yOff)do { if (sizeof(*(&gi[i].yOff)) != 2) wrong_size(); if (__builtin_constant_p
((uintptr_t)(&gi[i].yOff) & 1) && ((uintptr_t
)(&gi[i].yOff) & 1) == 0) *(&gi[i].yOff) = lswaps
(*(&gi[i].yOff)); else swap_uint16((uint16_t *)(&gi[i
].yOff)); } while (0)
;
2236 }
2237 return (*ProcRenderVector[stuff->renderReqType]) (client);
2238}
2239
2240static int
2241SProcRenderAddGlyphsFromPicture(ClientPtr client)
2242{
2243 return BadImplementation17;
2244}
2245
2246static int
2247SProcRenderFreeGlyphs(ClientPtr client)
2248{
2249 REQUEST(xRenderFreeGlyphsReq)xRenderFreeGlyphsReq *stuff = (xRenderFreeGlyphsReq *)client->
requestBuffer
;
2250 REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq)if ((sizeof(xRenderFreeGlyphsReq) >> 2) > client->
req_len ) return(16)
;
2251 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2252 swapl(&stuff->glyphset)do { if (sizeof(*(&stuff->glyphset)) != 4) wrong_size(
); if (__builtin_constant_p((uintptr_t)(&stuff->glyphset
) & 3) && ((uintptr_t)(&stuff->glyphset) &
3) == 0) *(&stuff->glyphset) = lswapl(*(&stuff->
glyphset)); else swap_uint32((uint32_t *)(&stuff->glyphset
)); } while (0)
;
2253 SwapRestL(stuff)SwapLongs((CARD32 *)(stuff + 1), (client->req_len - (sizeof
(*stuff) >> 2)))
;
2254 return (*ProcRenderVector[stuff->renderReqType]) (client);
2255}
2256
2257static int
2258SProcRenderCompositeGlyphs(ClientPtr client)
2259{
2260 xGlyphElt *elt;
2261 CARD8 *buffer;
2262 CARD8 *end;
2263 int space;
2264 int i;
2265 int size;
2266
2267 REQUEST(xRenderCompositeGlyphsReq)xRenderCompositeGlyphsReq *stuff = (xRenderCompositeGlyphsReq
*)client->requestBuffer
;
2268 REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq)if ((sizeof(xRenderCompositeGlyphsReq) >> 2) > client
->req_len ) return(16)
;
2269
2270 switch (stuff->renderReqType) {
2271 default:
2272 size = 1;
2273 break;
2274 case X_RenderCompositeGlyphs1624:
2275 size = 2;
2276 break;
2277 case X_RenderCompositeGlyphs3225:
2278 size = 4;
2279 break;
2280 }
2281
2282 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2283 swapl(&stuff->src)do { if (sizeof(*(&stuff->src)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->src) & 3
) && ((uintptr_t)(&stuff->src) & 3) == 0) *
(&stuff->src) = lswapl(*(&stuff->src)); else swap_uint32
((uint32_t *)(&stuff->src)); } while (0)
;
2284 swapl(&stuff->dst)do { if (sizeof(*(&stuff->dst)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->dst) & 3
) && ((uintptr_t)(&stuff->dst) & 3) == 0) *
(&stuff->dst) = lswapl(*(&stuff->dst)); else swap_uint32
((uint32_t *)(&stuff->dst)); } while (0)
;
2285 swapl(&stuff->maskFormat)do { if (sizeof(*(&stuff->maskFormat)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->maskFormat
) & 3) && ((uintptr_t)(&stuff->maskFormat)
& 3) == 0) *(&stuff->maskFormat) = lswapl(*(&
stuff->maskFormat)); else swap_uint32((uint32_t *)(&stuff
->maskFormat)); } while (0)
;
2286 swapl(&stuff->glyphset)do { if (sizeof(*(&stuff->glyphset)) != 4) wrong_size(
); if (__builtin_constant_p((uintptr_t)(&stuff->glyphset
) & 3) && ((uintptr_t)(&stuff->glyphset) &
3) == 0) *(&stuff->glyphset) = lswapl(*(&stuff->
glyphset)); else swap_uint32((uint32_t *)(&stuff->glyphset
)); } while (0)
;
2287 swaps(&stuff->xSrc)do { if (sizeof(*(&stuff->xSrc)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->xSrc) &
1) && ((uintptr_t)(&stuff->xSrc) & 1) == 0
) *(&stuff->xSrc) = lswaps(*(&stuff->xSrc)); else
swap_uint16((uint16_t *)(&stuff->xSrc)); } while (0)
;
2288 swaps(&stuff->ySrc)do { if (sizeof(*(&stuff->ySrc)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->ySrc) &
1) && ((uintptr_t)(&stuff->ySrc) & 1) == 0
) *(&stuff->ySrc) = lswaps(*(&stuff->ySrc)); else
swap_uint16((uint16_t *)(&stuff->ySrc)); } while (0)
;
2289 buffer = (CARD8 *) (stuff + 1);
2290 end = (CARD8 *) stuff + (client->req_len << 2);
2291 while (buffer + sizeof(xGlyphElt) < end) {
2292 elt = (xGlyphElt *) buffer;
2293 buffer += sizeof(xGlyphElt);
2294
2295 swaps(&elt->deltax)do { if (sizeof(*(&elt->deltax)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&elt->deltax) &
1) && ((uintptr_t)(&elt->deltax) & 1) == 0
) *(&elt->deltax) = lswaps(*(&elt->deltax)); else
swap_uint16((uint16_t *)(&elt->deltax)); } while (0)
;
2296 swaps(&elt->deltay)do { if (sizeof(*(&elt->deltay)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&elt->deltay) &
1) && ((uintptr_t)(&elt->deltay) & 1) == 0
) *(&elt->deltay) = lswaps(*(&elt->deltay)); else
swap_uint16((uint16_t *)(&elt->deltay)); } while (0)
;
2297
2298 i = elt->len;
2299 if (i == 0xff) {
2300 swapl((int *) buffer)do { if (sizeof(*((int *) buffer)) != 4) wrong_size(); if (__builtin_constant_p
((uintptr_t)((int *) buffer) & 3) && ((uintptr_t)
((int *) buffer) & 3) == 0) *((int *) buffer) = lswapl(*(
(int *) buffer)); else swap_uint32((uint32_t *)((int *) buffer
)); } while (0)
;
2301 buffer += 4;
2302 }
2303 else {
2304 space = size * i;
2305 switch (size) {
2306 case 1:
2307 buffer += i;
2308 break;
2309 case 2:
2310 while (i--) {
2311 swaps((short *) buffer)do { if (sizeof(*((short *) buffer)) != 2) wrong_size(); if (
__builtin_constant_p((uintptr_t)((short *) buffer) & 1) &&
((uintptr_t)((short *) buffer) & 1) == 0) *((short *) buffer
) = lswaps(*((short *) buffer)); else swap_uint16((uint16_t *
)((short *) buffer)); } while (0)
;
2312 buffer += 2;
2313 }
2314 break;
2315 case 4:
2316 while (i--) {
2317 swapl((int *) buffer)do { if (sizeof(*((int *) buffer)) != 4) wrong_size(); if (__builtin_constant_p
((uintptr_t)((int *) buffer) & 3) && ((uintptr_t)
((int *) buffer) & 3) == 0) *((int *) buffer) = lswapl(*(
(int *) buffer)); else swap_uint32((uint32_t *)((int *) buffer
)); } while (0)
;
2318 buffer += 4;
2319 }
2320 break;
2321 }
2322 if (space & 3)
2323 buffer += 4 - (space & 3);
2324 }
2325 }
2326 return (*ProcRenderVector[stuff->renderReqType]) (client);
2327}
2328
2329static int
2330SProcRenderFillRectangles(ClientPtr client)
2331{
2332 REQUEST(xRenderFillRectanglesReq)xRenderFillRectanglesReq *stuff = (xRenderFillRectanglesReq *
)client->requestBuffer
;
2333
2334 REQUEST_AT_LEAST_SIZE(xRenderFillRectanglesReq)if ((sizeof(xRenderFillRectanglesReq) >> 2) > client
->req_len ) return(16)
;
2335 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2336 swapl(&stuff->dst)do { if (sizeof(*(&stuff->dst)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->dst) & 3
) && ((uintptr_t)(&stuff->dst) & 3) == 0) *
(&stuff->dst) = lswapl(*(&stuff->dst)); else swap_uint32
((uint32_t *)(&stuff->dst)); } while (0)
;
2337 swaps(&stuff->color.red)do { if (sizeof(*(&stuff->color.red)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->color
.red) & 1) && ((uintptr_t)(&stuff->color.red
) & 1) == 0) *(&stuff->color.red) = lswaps(*(&
stuff->color.red)); else swap_uint16((uint16_t *)(&stuff
->color.red)); } while (0)
;
2338 swaps(&stuff->color.green)do { if (sizeof(*(&stuff->color.green)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->color
.green) & 1) && ((uintptr_t)(&stuff->color
.green) & 1) == 0) *(&stuff->color.green) = lswaps
(*(&stuff->color.green)); else swap_uint16((uint16_t *
)(&stuff->color.green)); } while (0)
;
2339 swaps(&stuff->color.blue)do { if (sizeof(*(&stuff->color.blue)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->color
.blue) & 1) && ((uintptr_t)(&stuff->color.
blue) & 1) == 0) *(&stuff->color.blue) = lswaps(*(
&stuff->color.blue)); else swap_uint16((uint16_t *)(&
stuff->color.blue)); } while (0)
;
2340 swaps(&stuff->color.alpha)do { if (sizeof(*(&stuff->color.alpha)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->color
.alpha) & 1) && ((uintptr_t)(&stuff->color
.alpha) & 1) == 0) *(&stuff->color.alpha) = lswaps
(*(&stuff->color.alpha)); else swap_uint16((uint16_t *
)(&stuff->color.alpha)); } while (0)
;
2341 SwapRestS(stuff)SwapShorts((short *)(stuff + 1), ((client->req_len <<
1) - (sizeof(*stuff) >> 1)))
;
2342 return (*ProcRenderVector[stuff->renderReqType]) (client);
2343}
2344
2345static int
2346SProcRenderCreateCursor(ClientPtr client)
2347{
2348 REQUEST(xRenderCreateCursorReq)xRenderCreateCursorReq *stuff = (xRenderCreateCursorReq *)client
->requestBuffer
;
2349 REQUEST_SIZE_MATCH(xRenderCreateCursorReq)if ((sizeof(xRenderCreateCursorReq) >> 2) != client->
req_len) return(16)
;
2350
2351 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2352 swapl(&stuff->cid)do { if (sizeof(*(&stuff->cid)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->cid) & 3
) && ((uintptr_t)(&stuff->cid) & 3) == 0) *
(&stuff->cid) = lswapl(*(&stuff->cid)); else swap_uint32
((uint32_t *)(&stuff->cid)); } while (0)
;
2353 swapl(&stuff->src)do { if (sizeof(*(&stuff->src)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->src) & 3
) && ((uintptr_t)(&stuff->src) & 3) == 0) *
(&stuff->src) = lswapl(*(&stuff->src)); else swap_uint32
((uint32_t *)(&stuff->src)); } while (0)
;
2354 swaps(&stuff->x)do { if (sizeof(*(&stuff->x)) != 2) wrong_size(); if (
__builtin_constant_p((uintptr_t)(&stuff->x) & 1) &&
((uintptr_t)(&stuff->x) & 1) == 0) *(&stuff->
x) = lswaps(*(&stuff->x)); else swap_uint16((uint16_t *
)(&stuff->x)); } while (0)
;
2355 swaps(&stuff->y)do { if (sizeof(*(&stuff->y)) != 2) wrong_size(); if (
__builtin_constant_p((uintptr_t)(&stuff->y) & 1) &&
((uintptr_t)(&stuff->y) & 1) == 0) *(&stuff->
y) = lswaps(*(&stuff->y)); else swap_uint16((uint16_t *
)(&stuff->y)); } while (0)
;
2356 return (*ProcRenderVector[stuff->renderReqType]) (client);
2357}
2358
2359static int
2360SProcRenderSetPictureTransform(ClientPtr client)
2361{
2362 REQUEST(xRenderSetPictureTransformReq)xRenderSetPictureTransformReq *stuff = (xRenderSetPictureTransformReq
*)client->requestBuffer
;
2363 REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq)if ((sizeof(xRenderSetPictureTransformReq) >> 2) != client
->req_len) return(16)
;
2364
2365 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2366 swapl(&stuff->picture)do { if (sizeof(*(&stuff->picture)) != 4) wrong_size()
; if (__builtin_constant_p((uintptr_t)(&stuff->picture
) & 3) && ((uintptr_t)(&stuff->picture) &
3) == 0) *(&stuff->picture) = lswapl(*(&stuff->
picture)); else swap_uint32((uint32_t *)(&stuff->picture
)); } while (0)
;
2367 swapl(&stuff->transform.matrix11)do { if (sizeof(*(&stuff->transform.matrix11)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->transform
.matrix11) & 3) && ((uintptr_t)(&stuff->transform
.matrix11) & 3) == 0) *(&stuff->transform.matrix11
) = lswapl(*(&stuff->transform.matrix11)); else swap_uint32
((uint32_t *)(&stuff->transform.matrix11)); } while (0
)
;
2368 swapl(&stuff->transform.matrix12)do { if (sizeof(*(&stuff->transform.matrix12)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->transform
.matrix12) & 3) && ((uintptr_t)(&stuff->transform
.matrix12) & 3) == 0) *(&stuff->transform.matrix12
) = lswapl(*(&stuff->transform.matrix12)); else swap_uint32
((uint32_t *)(&stuff->transform.matrix12)); } while (0
)
;
2369 swapl(&stuff->transform.matrix13)do { if (sizeof(*(&stuff->transform.matrix13)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->transform
.matrix13) & 3) && ((uintptr_t)(&stuff->transform
.matrix13) & 3) == 0) *(&stuff->transform.matrix13
) = lswapl(*(&stuff->transform.matrix13)); else swap_uint32
((uint32_t *)(&stuff->transform.matrix13)); } while (0
)
;
2370 swapl(&stuff->transform.matrix21)do { if (sizeof(*(&stuff->transform.matrix21)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->transform
.matrix21) & 3) && ((uintptr_t)(&stuff->transform
.matrix21) & 3) == 0) *(&stuff->transform.matrix21
) = lswapl(*(&stuff->transform.matrix21)); else swap_uint32
((uint32_t *)(&stuff->transform.matrix21)); } while (0
)
;
2371 swapl(&stuff->transform.matrix22)do { if (sizeof(*(&stuff->transform.matrix22)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->transform
.matrix22) & 3) && ((uintptr_t)(&stuff->transform
.matrix22) & 3) == 0) *(&stuff->transform.matrix22
) = lswapl(*(&stuff->transform.matrix22)); else swap_uint32
((uint32_t *)(&stuff->transform.matrix22)); } while (0
)
;
2372 swapl(&stuff->transform.matrix23)do { if (sizeof(*(&stuff->transform.matrix23)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->transform
.matrix23) & 3) && ((uintptr_t)(&stuff->transform
.matrix23) & 3) == 0) *(&stuff->transform.matrix23
) = lswapl(*(&stuff->transform.matrix23)); else swap_uint32
((uint32_t *)(&stuff->transform.matrix23)); } while (0
)
;
2373 swapl(&stuff->transform.matrix31)do { if (sizeof(*(&stuff->transform.matrix31)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->transform
.matrix31) & 3) && ((uintptr_t)(&stuff->transform
.matrix31) & 3) == 0) *(&stuff->transform.matrix31
) = lswapl(*(&stuff->transform.matrix31)); else swap_uint32
((uint32_t *)(&stuff->transform.matrix31)); } while (0
)
;
2374 swapl(&stuff->transform.matrix32)do { if (sizeof(*(&stuff->transform.matrix32)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->transform
.matrix32) & 3) && ((uintptr_t)(&stuff->transform
.matrix32) & 3) == 0) *(&stuff->transform.matrix32
) = lswapl(*(&stuff->transform.matrix32)); else swap_uint32
((uint32_t *)(&stuff->transform.matrix32)); } while (0
)
;
2375 swapl(&stuff->transform.matrix33)do { if (sizeof(*(&stuff->transform.matrix33)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->transform
.matrix33) & 3) && ((uintptr_t)(&stuff->transform
.matrix33) & 3) == 0) *(&stuff->transform.matrix33
) = lswapl(*(&stuff->transform.matrix33)); else swap_uint32
((uint32_t *)(&stuff->transform.matrix33)); } while (0
)
;
2376 return (*ProcRenderVector[stuff->renderReqType]) (client);
2377}
2378
2379static int
2380SProcRenderQueryFilters(ClientPtr client)
2381{
2382 REQUEST(xRenderQueryFiltersReq)xRenderQueryFiltersReq *stuff = (xRenderQueryFiltersReq *)client
->requestBuffer
;
2383 REQUEST_SIZE_MATCH(xRenderQueryFiltersReq)if ((sizeof(xRenderQueryFiltersReq) >> 2) != client->
req_len) return(16)
;
2384
2385 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2386 swapl(&stuff->drawable)do { if (sizeof(*(&stuff->drawable)) != 4) wrong_size(
); if (__builtin_constant_p((uintptr_t)(&stuff->drawable
) & 3) && ((uintptr_t)(&stuff->drawable) &
3) == 0) *(&stuff->drawable) = lswapl(*(&stuff->
drawable)); else swap_uint32((uint32_t *)(&stuff->drawable
)); } while (0)
;
2387 return (*ProcRenderVector[stuff->renderReqType]) (client);
2388}
2389
2390static int
2391SProcRenderSetPictureFilter(ClientPtr client)
2392{
2393 REQUEST(xRenderSetPictureFilterReq)xRenderSetPictureFilterReq *stuff = (xRenderSetPictureFilterReq
*)client->requestBuffer
;
2394 REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq)if ((sizeof(xRenderSetPictureFilterReq) >> 2) > client
->req_len ) return(16)
;
2395
2396 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2397 swapl(&stuff->picture)do { if (sizeof(*(&stuff->picture)) != 4) wrong_size()
; if (__builtin_constant_p((uintptr_t)(&stuff->picture
) & 3) && ((uintptr_t)(&stuff->picture) &
3) == 0) *(&stuff->picture) = lswapl(*(&stuff->
picture)); else swap_uint32((uint32_t *)(&stuff->picture
)); } while (0)
;
2398 swaps(&stuff->nbytes)do { if (sizeof(*(&stuff->nbytes)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->nbytes) &
1) && ((uintptr_t)(&stuff->nbytes) & 1) ==
0) *(&stuff->nbytes) = lswaps(*(&stuff->nbytes
)); else swap_uint16((uint16_t *)(&stuff->nbytes)); } while
(0)
;
2399 return (*ProcRenderVector[stuff->renderReqType]) (client);
2400}
2401
2402static int
2403SProcRenderCreateAnimCursor(ClientPtr client)
2404{
2405 REQUEST(xRenderCreateAnimCursorReq)xRenderCreateAnimCursorReq *stuff = (xRenderCreateAnimCursorReq
*)client->requestBuffer
;
2406 REQUEST_AT_LEAST_SIZE(xRenderCreateAnimCursorReq)if ((sizeof(xRenderCreateAnimCursorReq) >> 2) > client
->req_len ) return(16)
;
2407
2408 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2409 swapl(&stuff->cid)do { if (sizeof(*(&stuff->cid)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->cid) & 3
) && ((uintptr_t)(&stuff->cid) & 3) == 0) *
(&stuff->cid) = lswapl(*(&stuff->cid)); else swap_uint32
((uint32_t *)(&stuff->cid)); } while (0)
;
2410 SwapRestL(stuff)SwapLongs((CARD32 *)(stuff + 1), (client->req_len - (sizeof
(*stuff) >> 2)))
;
2411 return (*ProcRenderVector[stuff->renderReqType]) (client);
2412}
2413
2414static int
2415SProcRenderAddTraps(ClientPtr client)
2416{
2417 REQUEST(xRenderAddTrapsReq)xRenderAddTrapsReq *stuff = (xRenderAddTrapsReq *)client->
requestBuffer
;
2418 REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq)if ((sizeof(xRenderAddTrapsReq) >> 2) > client->req_len
) return(16)
;
2419
2420 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2421 swapl(&stuff->picture)do { if (sizeof(*(&stuff->picture)) != 4) wrong_size()
; if (__builtin_constant_p((uintptr_t)(&stuff->picture
) & 3) && ((uintptr_t)(&stuff->picture) &
3) == 0) *(&stuff->picture) = lswapl(*(&stuff->
picture)); else swap_uint32((uint32_t *)(&stuff->picture
)); } while (0)
;
2422 swaps(&stuff->xOff)do { if (sizeof(*(&stuff->xOff)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->xOff) &
1) && ((uintptr_t)(&stuff->xOff) & 1) == 0
) *(&stuff->xOff) = lswaps(*(&stuff->xOff)); else
swap_uint16((uint16_t *)(&stuff->xOff)); } while (0)
;
2423 swaps(&stuff->yOff)do { if (sizeof(*(&stuff->yOff)) != 2) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->yOff) &
1) && ((uintptr_t)(&stuff->yOff) & 1) == 0
) *(&stuff->yOff) = lswaps(*(&stuff->yOff)); else
swap_uint16((uint16_t *)(&stuff->yOff)); } while (0)
;
2424 SwapRestL(stuff)SwapLongs((CARD32 *)(stuff + 1), (client->req_len - (sizeof
(*stuff) >> 2)))
;
2425 return (*ProcRenderVector[stuff->renderReqType]) (client);
2426}
2427
2428static int
2429SProcRenderCreateSolidFill(ClientPtr client)
2430{
2431 REQUEST(xRenderCreateSolidFillReq)xRenderCreateSolidFillReq *stuff = (xRenderCreateSolidFillReq
*)client->requestBuffer
;
2432 REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq)if ((sizeof(xRenderCreateSolidFillReq) >> 2) > client
->req_len ) return(16)
;
2433
2434 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2435 swapl(&stuff->pid)do { if (sizeof(*(&stuff->pid)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->pid) & 3
) && ((uintptr_t)(&stuff->pid) & 3) == 0) *
(&stuff->pid) = lswapl(*(&stuff->pid)); else swap_uint32
((uint32_t *)(&stuff->pid)); } while (0)
;
2436 swaps(&stuff->color.alpha)do { if (sizeof(*(&stuff->color.alpha)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->color
.alpha) & 1) && ((uintptr_t)(&stuff->color
.alpha) & 1) == 0) *(&stuff->color.alpha) = lswaps
(*(&stuff->color.alpha)); else swap_uint16((uint16_t *
)(&stuff->color.alpha)); } while (0)
;
2437 swaps(&stuff->color.red)do { if (sizeof(*(&stuff->color.red)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->color
.red) & 1) && ((uintptr_t)(&stuff->color.red
) & 1) == 0) *(&stuff->color.red) = lswaps(*(&
stuff->color.red)); else swap_uint16((uint16_t *)(&stuff
->color.red)); } while (0)
;
2438 swaps(&stuff->color.green)do { if (sizeof(*(&stuff->color.green)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->color
.green) & 1) && ((uintptr_t)(&stuff->color
.green) & 1) == 0) *(&stuff->color.green) = lswaps
(*(&stuff->color.green)); else swap_uint16((uint16_t *
)(&stuff->color.green)); } while (0)
;
2439 swaps(&stuff->color.blue)do { if (sizeof(*(&stuff->color.blue)) != 2) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->color
.blue) & 1) && ((uintptr_t)(&stuff->color.
blue) & 1) == 0) *(&stuff->color.blue) = lswaps(*(
&stuff->color.blue)); else swap_uint16((uint16_t *)(&
stuff->color.blue)); } while (0)
;
2440 return (*ProcRenderVector[stuff->renderReqType]) (client);
2441}
2442
2443static void
2444swapStops(void *stuff, int num)
2445{
2446 int i;
2447 CARD32 *stops;
2448 CARD16 *colors;
2449
2450 stops = (CARD32 *) (stuff);
2451 for (i = 0; i < num; ++i) {
2452 swapl(stops)do { if (sizeof(*(stops)) != 4) wrong_size(); if (__builtin_constant_p
((uintptr_t)(stops) & 3) && ((uintptr_t)(stops) &
3) == 0) *(stops) = lswapl(*(stops)); else swap_uint32((uint32_t
*)(stops)); } while (0)
;
2453 ++stops;
2454 }
2455 colors = (CARD16 *) (stops);
2456 for (i = 0; i < 4 * num; ++i) {
2457 swaps(colors)do { if (sizeof(*(colors)) != 2) wrong_size(); if (__builtin_constant_p
((uintptr_t)(colors) & 1) && ((uintptr_t)(colors)
& 1) == 0) *(colors) = lswaps(*(colors)); else swap_uint16
((uint16_t *)(colors)); } while (0)
;
2458 ++colors;
2459 }
2460}
2461
2462static int
2463SProcRenderCreateLinearGradient(ClientPtr client)
2464{
2465 int len;
2466
2467 REQUEST(xRenderCreateLinearGradientReq)xRenderCreateLinearGradientReq *stuff = (xRenderCreateLinearGradientReq
*)client->requestBuffer
;
2468 REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq)if ((sizeof(xRenderCreateLinearGradientReq) >> 2) > client
->req_len ) return(16)
;
2469
2470 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2471 swapl(&stuff->pid)do { if (sizeof(*(&stuff->pid)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->pid) & 3
) && ((uintptr_t)(&stuff->pid) & 3) == 0) *
(&stuff->pid) = lswapl(*(&stuff->pid)); else swap_uint32
((uint32_t *)(&stuff->pid)); } while (0)
;
2472 swapl(&stuff->p1.x)do { if (sizeof(*(&stuff->p1.x)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->p1.x) &
3) && ((uintptr_t)(&stuff->p1.x) & 3) == 0
) *(&stuff->p1.x) = lswapl(*(&stuff->p1.x)); else
swap_uint32((uint32_t *)(&stuff->p1.x)); } while (0)
;
2473 swapl(&stuff->p1.y)do { if (sizeof(*(&stuff->p1.y)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->p1.y) &
3) && ((uintptr_t)(&stuff->p1.y) & 3) == 0
) *(&stuff->p1.y) = lswapl(*(&stuff->p1.y)); else
swap_uint32((uint32_t *)(&stuff->p1.y)); } while (0)
;
2474 swapl(&stuff->p2.x)do { if (sizeof(*(&stuff->p2.x)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->p2.x) &
3) && ((uintptr_t)(&stuff->p2.x) & 3) == 0
) *(&stuff->p2.x) = lswapl(*(&stuff->p2.x)); else
swap_uint32((uint32_t *)(&stuff->p2.x)); } while (0)
;
2475 swapl(&stuff->p2.y)do { if (sizeof(*(&stuff->p2.y)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->p2.y) &
3) && ((uintptr_t)(&stuff->p2.y) & 3) == 0
) *(&stuff->p2.y) = lswapl(*(&stuff->p2.y)); else
swap_uint32((uint32_t *)(&stuff->p2.y)); } while (0)
;
2476 swapl(&stuff->nStops)do { if (sizeof(*(&stuff->nStops)) != 4) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->nStops) &
3) && ((uintptr_t)(&stuff->nStops) & 3) ==
0) *(&stuff->nStops) = lswapl(*(&stuff->nStops
)); else swap_uint32((uint32_t *)(&stuff->nStops)); } while
(0)
;
2477
2478 len = (client->req_len << 2) - sizeof(xRenderCreateLinearGradientReq);
2479 if (stuff->nStops > UINT32_MAX4294967295U / (sizeof(xFixed) + sizeof(xRenderColor)))
2480 return BadLength16;
2481 if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
2482 return BadLength16;
2483
2484 swapStops(stuff + 1, stuff->nStops);
2485
2486 return (*ProcRenderVector[stuff->renderReqType]) (client);
2487}
2488
2489static int
2490SProcRenderCreateRadialGradient(ClientPtr client)
2491{
2492 int len;
2493
2494 REQUEST(xRenderCreateRadialGradientReq)xRenderCreateRadialGradientReq *stuff = (xRenderCreateRadialGradientReq
*)client->requestBuffer
;
2495 REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq)if ((sizeof(xRenderCreateRadialGradientReq) >> 2) > client
->req_len ) return(16)
;
2496
2497 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2498 swapl(&stuff->pid)do { if (sizeof(*(&stuff->pid)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->pid) & 3
) && ((uintptr_t)(&stuff->pid) & 3) == 0) *
(&stuff->pid) = lswapl(*(&stuff->pid)); else swap_uint32
((uint32_t *)(&stuff->pid)); } while (0)
;
2499 swapl(&stuff->inner.x)do { if (sizeof(*(&stuff->inner.x)) != 4) wrong_size()
; if (__builtin_constant_p((uintptr_t)(&stuff->inner.x
) & 3) && ((uintptr_t)(&stuff->inner.x) &
3) == 0) *(&stuff->inner.x) = lswapl(*(&stuff->
inner.x)); else swap_uint32((uint32_t *)(&stuff->inner
.x)); } while (0)
;
2500 swapl(&stuff->inner.y)do { if (sizeof(*(&stuff->inner.y)) != 4) wrong_size()
; if (__builtin_constant_p((uintptr_t)(&stuff->inner.y
) & 3) && ((uintptr_t)(&stuff->inner.y) &
3) == 0) *(&stuff->inner.y) = lswapl(*(&stuff->
inner.y)); else swap_uint32((uint32_t *)(&stuff->inner
.y)); } while (0)
;
2501 swapl(&stuff->outer.x)do { if (sizeof(*(&stuff->outer.x)) != 4) wrong_size()
; if (__builtin_constant_p((uintptr_t)(&stuff->outer.x
) & 3) && ((uintptr_t)(&stuff->outer.x) &
3) == 0) *(&stuff->outer.x) = lswapl(*(&stuff->
outer.x)); else swap_uint32((uint32_t *)(&stuff->outer
.x)); } while (0)
;
2502 swapl(&stuff->outer.y)do { if (sizeof(*(&stuff->outer.y)) != 4) wrong_size()
; if (__builtin_constant_p((uintptr_t)(&stuff->outer.y
) & 3) && ((uintptr_t)(&stuff->outer.y) &
3) == 0) *(&stuff->outer.y) = lswapl(*(&stuff->
outer.y)); else swap_uint32((uint32_t *)(&stuff->outer
.y)); } while (0)
;
2503 swapl(&stuff->inner_radius)do { if (sizeof(*(&stuff->inner_radius)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->inner_radius
) & 3) && ((uintptr_t)(&stuff->inner_radius
) & 3) == 0) *(&stuff->inner_radius) = lswapl(*(&
stuff->inner_radius)); else swap_uint32((uint32_t *)(&
stuff->inner_radius)); } while (0)
;
2504 swapl(&stuff->outer_radius)do { if (sizeof(*(&stuff->outer_radius)) != 4) wrong_size
(); if (__builtin_constant_p((uintptr_t)(&stuff->outer_radius
) & 3) && ((uintptr_t)(&stuff->outer_radius
) & 3) == 0) *(&stuff->outer_radius) = lswapl(*(&
stuff->outer_radius)); else swap_uint32((uint32_t *)(&
stuff->outer_radius)); } while (0)
;
2505 swapl(&stuff->nStops)do { if (sizeof(*(&stuff->nStops)) != 4) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->nStops) &
3) && ((uintptr_t)(&stuff->nStops) & 3) ==
0) *(&stuff->nStops) = lswapl(*(&stuff->nStops
)); else swap_uint32((uint32_t *)(&stuff->nStops)); } while
(0)
;
2506
2507 len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq);
2508 if (stuff->nStops > UINT32_MAX4294967295U / (sizeof(xFixed) + sizeof(xRenderColor)))
2509 return BadLength16;
2510 if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
2511 return BadLength16;
2512
2513 swapStops(stuff + 1, stuff->nStops);
2514
2515 return (*ProcRenderVector[stuff->renderReqType]) (client);
2516}
2517
2518static int
2519SProcRenderCreateConicalGradient(ClientPtr client)
2520{
2521 int len;
2522
2523 REQUEST(xRenderCreateConicalGradientReq)xRenderCreateConicalGradientReq *stuff = (xRenderCreateConicalGradientReq
*)client->requestBuffer
;
2524 REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq)if ((sizeof(xRenderCreateConicalGradientReq) >> 2) >
client->req_len ) return(16)
;
2525
2526 swaps(&stuff->length)do { if (sizeof(*(&stuff->length)) != 2) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->length) &
1) && ((uintptr_t)(&stuff->length) & 1) ==
0) *(&stuff->length) = lswaps(*(&stuff->length
)); else swap_uint16((uint16_t *)(&stuff->length)); } while
(0)
;
2527 swapl(&stuff->pid)do { if (sizeof(*(&stuff->pid)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->pid) & 3
) && ((uintptr_t)(&stuff->pid) & 3) == 0) *
(&stuff->pid) = lswapl(*(&stuff->pid)); else swap_uint32
((uint32_t *)(&stuff->pid)); } while (0)
;
2528 swapl(&stuff->center.x)do { if (sizeof(*(&stuff->center.x)) != 4) wrong_size(
); if (__builtin_constant_p((uintptr_t)(&stuff->center
.x) & 3) && ((uintptr_t)(&stuff->center.x)
& 3) == 0) *(&stuff->center.x) = lswapl(*(&stuff
->center.x)); else swap_uint32((uint32_t *)(&stuff->
center.x)); } while (0)
;
2529 swapl(&stuff->center.y)do { if (sizeof(*(&stuff->center.y)) != 4) wrong_size(
); if (__builtin_constant_p((uintptr_t)(&stuff->center
.y) & 3) && ((uintptr_t)(&stuff->center.y)
& 3) == 0) *(&stuff->center.y) = lswapl(*(&stuff
->center.y)); else swap_uint32((uint32_t *)(&stuff->
center.y)); } while (0)
;
2530 swapl(&stuff->angle)do { if (sizeof(*(&stuff->angle)) != 4) wrong_size(); if
(__builtin_constant_p((uintptr_t)(&stuff->angle) &
3) && ((uintptr_t)(&stuff->angle) & 3) ==
0) *(&stuff->angle) = lswapl(*(&stuff->angle))
; else swap_uint32((uint32_t *)(&stuff->angle)); } while
(0)
;
2531 swapl(&stuff->nStops)do { if (sizeof(*(&stuff->nStops)) != 4) wrong_size();
if (__builtin_constant_p((uintptr_t)(&stuff->nStops) &
3) && ((uintptr_t)(&stuff->nStops) & 3) ==
0) *(&stuff->nStops) = lswapl(*(&stuff->nStops
)); else swap_uint32((uint32_t *)(&stuff->nStops)); } while
(0)
;
2532
2533 len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq);
2534 if (stuff->nStops > UINT32_MAX4294967295U / (sizeof(xFixed) + sizeof(xRenderColor)))
2535 return BadLength16;
2536 if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
2537 return BadLength16;
2538
2539 swapStops(stuff + 1, stuff->nStops);
2540
2541 return (*ProcRenderVector[stuff->renderReqType]) (client);
2542}
2543
2544static int
2545SProcRenderDispatch(ClientPtr client)
2546{
2547 REQUEST(xReq)xReq *stuff = (xReq *)client->requestBuffer;
2548
2549 if (stuff->data < RenderNumberRequests(36 +1))
2550 return (*SProcRenderVector[stuff->data]) (client);
2551 else
2552 return BadRequest1;
2553}
2554
2555#ifdef PANORAMIX1
2556#define VERIFY_XIN_PICTURE(pPicture, pid, client, mode){ int rc = dixLookupResourceByType((void **)&(pPicture), pid
, XRT_PICTURE, client, mode); if (rc != 0) return rc;}
{\
2557 int rc = dixLookupResourceByType((void **)&(pPicture), pid,\
2558 XRT_PICTURE, client, mode);\
2559 if (rc != Success0)\
2560 return rc;\
2561}
2562
2563#define VERIFY_XIN_ALPHA(pPicture, pid, client, mode){ if (pid == 0L) pPicture = 0; else { { int rc = dixLookupResourceByType
((void **)&(pPicture), pid, XRT_PICTURE, client, mode); if
(rc != 0) return rc;}; } }
{\
2564 if (pid == None0L) \
2565 pPicture = 0; \
2566 else { \
2567 VERIFY_XIN_PICTURE(pPicture, pid, client, mode){ int rc = dixLookupResourceByType((void **)&(pPicture), pid
, XRT_PICTURE, client, mode); if (rc != 0) return rc;}
; \
2568 } \
2569} \
2570
2571int (*PanoramiXSaveRenderVector[RenderNumberRequests(36 +1)]) (ClientPtr);
2572
2573static int
2574PanoramiXRenderCreatePicture(ClientPtr client)
2575{
2576 REQUEST(xRenderCreatePictureReq)xRenderCreatePictureReq *stuff = (xRenderCreatePictureReq *)client
->requestBuffer
;
2577 PanoramiXRes *refDraw, *newPict;
2578 int result, j;
2579
2580 REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq)if ((sizeof(xRenderCreatePictureReq) >> 2) > client->
req_len ) return(16)
;
2581 result = dixLookupResourceByClass((void **) &refDraw, stuff->drawable,
2582 XRC_DRAWABLE, client, DixWriteAccess(1<<1));
2583 if (result != Success0)
2584 return (result == BadValue2) ? BadDrawable9 : result;
2585 if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
2586 return BadAlloc11;
2587 newPict->type = XRT_PICTURE;
2588 panoramix_setup_ids(newPict, client, stuff->pid);
2589
2590 if (refDraw->type == XRT_WINDOW &&
2591 stuff->drawable == screenInfo.screens[0]->root->drawable.id) {
2592 newPict->u.pict.root = TRUE1;
2593 }
2594 else
2595 newPict->u.pict.root = FALSE0;
2596
2597 FOR_NSCREENS_BACKWARD(j)for(j = PanoramiXNumScreens - 1; j >= 0; j--) {
2598 stuff->pid = newPict->info[j].id;
2599 stuff->drawable = refDraw->info[j].id;
2600 result = (*PanoramiXSaveRenderVector[X_RenderCreatePicture4]) (client);
2601 if (result != Success0)
2602 break;
2603 }
2604
2605 if (result == Success0)
2606 AddResourceDarwin_X_AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
2607 else
2608 free(newPict);
2609
2610 return result;
2611}
2612
2613static int
2614PanoramiXRenderChangePicture(ClientPtr client)
2615{
2616 PanoramiXRes *pict;
2617 int result = Success0, j;
2618
2619 REQUEST(xRenderChangePictureReq)xRenderChangePictureReq *stuff = (xRenderChangePictureReq *)client
->requestBuffer
;
2620
2621 REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq)if ((sizeof(xRenderChangePictureReq) >> 2) > client->
req_len ) return(16)
;
2622
2623 VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess){ int rc = dixLookupResourceByType((void **)&(pict), stuff
->picture, XRT_PICTURE, client, (1<<1)); if (rc != 0
) return rc;}
;
2624
2625 FOR_NSCREENS_BACKWARD(j)for(j = PanoramiXNumScreens - 1; j >= 0; j--) {
2626 stuff->picture = pict->info[j].id;
2627 result = (*PanoramiXSaveRenderVector[X_RenderChangePicture5]) (client);
2628 if (result != Success0)
2629 break;
2630 }
2631
2632 return result;
2633}
2634
2635static int
2636PanoramiXRenderSetPictureClipRectangles(ClientPtr client)
2637{
2638 REQUEST(xRenderSetPictureClipRectanglesReq)xRenderSetPictureClipRectanglesReq *stuff = (xRenderSetPictureClipRectanglesReq
*)client->requestBuffer
;
2639 int result = Success0, j;
2640 PanoramiXRes *pict;
2641
2642 REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq)if ((sizeof(xRenderSetPictureClipRectanglesReq) >> 2) >
client->req_len ) return(16)
;
2643
2644 VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess){ int rc = dixLookupResourceByType((void **)&(pict), stuff
->picture, XRT_PICTURE, client, (1<<1)); if (rc != 0
) return rc;}
;
2645
2646 FOR_NSCREENS_BACKWARD(j)for(j = PanoramiXNumScreens - 1; j >= 0; j--) {
2647 stuff->picture = pict->info[j].id;
2648 result =
2649 (*PanoramiXSaveRenderVector[X_RenderSetPictureClipRectangles6])
2650 (client);
2651 if (result != Success0)
2652 break;
2653 }
2654
2655 return result;
2656}
2657
2658static int
2659PanoramiXRenderSetPictureTransform(ClientPtr client)
2660{
2661 REQUEST(xRenderSetPictureTransformReq)xRenderSetPictureTransformReq *stuff = (xRenderSetPictureTransformReq
*)client->requestBuffer
;
2662 int result = Success0, j;
2663 PanoramiXRes *pict;
2664
2665 REQUEST_AT_LEAST_SIZE(xRenderSetPictureTransformReq)if ((sizeof(xRenderSetPictureTransformReq) >> 2) > client
->req_len ) return(16)
;
2666
2667 VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess){ int rc = dixLookupResourceByType((void **)&(pict), stuff
->picture, XRT_PICTURE, client, (1<<1)); if (rc != 0
) return rc;}
;
2668
2669 FOR_NSCREENS_BACKWARD(j)for(j = PanoramiXNumScreens - 1; j >= 0; j--) {
2670 stuff->picture = pict->info[j].id;
2671 result =
2672 (*PanoramiXSaveRenderVector[X_RenderSetPictureTransform28]) (client);
2673 if (result != Success0)
2674 break;
2675 }
2676
2677 return result;
2678}
2679
2680static int
2681PanoramiXRenderSetPictureFilter(ClientPtr client)
2682{
2683 REQUEST(xRenderSetPictureFilterReq)xRenderSetPictureFilterReq *stuff = (xRenderSetPictureFilterReq
*)client->requestBuffer
;
2684 int result = Success0, j;
2685 PanoramiXRes *pict;
2686
2687 REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq)if ((sizeof(xRenderSetPictureFilterReq) >> 2) > client
->req_len ) return(16)
;
2688
2689 VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess){ int rc = dixLookupResourceByType((void **)&(pict), stuff
->picture, XRT_PICTURE, client, (1<<1)); if (rc != 0
) return rc;}
;
2690
2691 FOR_NSCREENS_BACKWARD(j)for(j = PanoramiXNumScreens - 1; j >= 0; j--) {
2692 stuff->picture = pict->info[j].id;
2693 result =
2694 (*PanoramiXSaveRenderVector[X_RenderSetPictureFilter30]) (client);
2695 if (result != Success0)
2696 break;
2697 }
2698
2699 return result;
2700}
2701
2702static int
2703PanoramiXRenderFreePicture(ClientPtr client)
2704{
2705 PanoramiXRes *pict;
2706 int result = Success0, j;
2707
2708 REQUEST(xRenderFreePictureReq)xRenderFreePictureReq *stuff = (xRenderFreePictureReq *)client
->requestBuffer
;
2709
2710 REQUEST_SIZE_MATCH(xRenderFreePictureReq)if ((sizeof(xRenderFreePictureReq) >> 2) != client->
req_len) return(16)
;
2711
2712 client->errorValue = stuff->picture;
2713
2714 VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixDestroyAccess){ int rc = dixLookupResourceByType((void **)&(pict), stuff
->picture, XRT_PICTURE, client, (1<<2)); if (rc != 0
) return rc;}
;
2715
2716 FOR_NSCREENS_BACKWARD(j)for(j = PanoramiXNumScreens - 1; j >= 0; j--) {
2717 stuff->picture = pict->info[j].id;
2718 result = (*PanoramiXSaveRenderVector[X_RenderFreePicture7]) (client);
2719 if (result != Success0)
2720 break;
2721 }
2722
2723 /* Since ProcRenderFreePicture is using FreeResource, it will free
2724 our resource for us on the last pass through the loop above */
2725
2726 return result;
2727}
2728
2729static int
2730PanoramiXRenderComposite(ClientPtr client)
2731{
2732 PanoramiXRes *src, *msk, *dst;
2733 int result = Success0, j;
2734 xRenderCompositeReq orig;
2735
2736 REQUEST(xRenderCompositeReq)xRenderCompositeReq *stuff = (xRenderCompositeReq *)client->
requestBuffer
;
2737
2738 REQUEST_SIZE_MATCH(xRenderCompositeReq)if ((sizeof(xRenderCompositeReq) >> 2) != client->req_len
) return(16)
;
2739
2740 VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(src), stuff
->src, XRT_PICTURE, client, (1<<0)); if (rc != 0) return
rc;}
;
2741 VERIFY_XIN_ALPHA(msk, stuff->mask, client, DixReadAccess){ if (stuff->mask == 0L) msk = 0; else { { int rc = dixLookupResourceByType
((void **)&(msk), stuff->mask, XRT_PICTURE, client, (1
<<0)); if (rc != 0) return rc;}; } }
;
2742 VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess){ int rc = dixLookupResourceByType((void **)&(dst), stuff
->dst, XRT_PICTURE, client, (1<<1)); if (rc != 0) return
rc;}
;
2743
2744 orig = *stuff;
2745
2746 FOR_NSCREENS_FORWARD(j)for(j = 0; j < PanoramiXNumScreens; j++) {
2747 stuff->src = src->info[j].id;
2748 if (src->u.pict.root) {
2749 stuff->xSrc = orig.xSrc - screenInfo.screens[j]->x;
2750 stuff->ySrc = orig.ySrc - screenInfo.screens[j]->y;
2751 }
2752 stuff->dst = dst->info[j].id;
2753 if (dst->u.pict.root) {
2754 stuff->xDst = orig.xDst - screenInfo.screens[j]->x;
2755 stuff->yDst = orig.yDst - screenInfo.screens[j]->y;
2756 }
2757 if (msk) {
2758 stuff->mask = msk->info[j].id;
2759 if (msk->u.pict.root) {
2760 stuff->xMask = orig.xMask - screenInfo.screens[j]->x;
2761 stuff->yMask = orig.yMask - screenInfo.screens[j]->y;
2762 }
2763 }
2764 result = (*PanoramiXSaveRenderVector[X_RenderComposite8]) (client);
2765 if (result != Success0)
2766 break;
2767 }
2768
2769 return result;
2770}
2771
2772static int
2773PanoramiXRenderCompositeGlyphs(ClientPtr client)
2774{
2775 PanoramiXRes *src, *dst;
2776 int result = Success0, j;
2777
2778 REQUEST(xRenderCompositeGlyphsReq)xRenderCompositeGlyphsReq *stuff = (xRenderCompositeGlyphsReq
*)client->requestBuffer
;
2779 xGlyphElt origElt, *elt;
2780 INT16 xSrc, ySrc;
2781
2782 REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq)if ((sizeof(xRenderCompositeGlyphsReq) >> 2) > client
->req_len ) return(16)
;
2783 VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(src), stuff
->src, XRT_PICTURE, client, (1<<0)); if (rc != 0) return
rc;}
;
2784 VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess){ int rc = dixLookupResourceByType((void **)&(dst), stuff
->dst, XRT_PICTURE, client, (1<<1)); if (rc != 0) return
rc;}
;
2785
2786 if (client->req_len << 2 >= (sizeof(xRenderCompositeGlyphsReq) +
2787 sizeof(xGlyphElt))) {
2788 elt = (xGlyphElt *) (stuff + 1);
2789 origElt = *elt;
2790 xSrc = stuff->xSrc;
2791 ySrc = stuff->ySrc;
2792 FOR_NSCREENS_FORWARD(j)for(j = 0; j < PanoramiXNumScreens; j++) {
2793 stuff->src = src->info[j].id;
2794 if (src->u.pict.root) {
2795 stuff->xSrc = xSrc - screenInfo.screens[j]->x;
2796 stuff->ySrc = ySrc - screenInfo.screens[j]->y;
2797 }
2798 stuff->dst = dst->info[j].id;
2799 if (dst->u.pict.root) {
2800 elt->deltax = origElt.deltax - screenInfo.screens[j]->x;
2801 elt->deltay = origElt.deltay - screenInfo.screens[j]->y;
2802 }
2803 result =
2804 (*PanoramiXSaveRenderVector[stuff->renderReqType]) (client);
2805 if (result != Success0)
2806 break;
2807 }
2808 }
2809
2810 return result;
2811}
2812
2813static int
2814PanoramiXRenderFillRectangles(ClientPtr client)
2815{
2816 PanoramiXRes *dst;
2817 int result = Success0, j;
2818
2819 REQUEST(xRenderFillRectanglesReq)xRenderFillRectanglesReq *stuff = (xRenderFillRectanglesReq *
)client->requestBuffer
;
2820 char *extra;
2821 int extra_len;
2822
2823 REQUEST_AT_LEAST_SIZE(xRenderFillRectanglesReq)if ((sizeof(xRenderFillRectanglesReq) >> 2) > client
->req_len ) return(16)
;
2824 VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess){ int rc = dixLookupResourceByType((void **)&(dst), stuff
->dst, XRT_PICTURE, client, (1<<1)); if (rc != 0) return
rc;}
;
2825 extra_len = (client->req_len << 2) - sizeof(xRenderFillRectanglesReq);
2826 if (extra_len && (extra = (char *) malloc(extra_len))) {
2827 memcpy(extra, stuff + 1, extra_len)__builtin___memcpy_chk (extra, stuff + 1, extra_len, __builtin_object_size
(extra, 0))
;
2828 FOR_NSCREENS_FORWARD(j)for(j = 0; j < PanoramiXNumScreens; j++) {
2829 if (j)
2830 memcpy(stuff + 1, extra, extra_len)__builtin___memcpy_chk (stuff + 1, extra, extra_len, __builtin_object_size
(stuff + 1, 0))
;
2831 if (dst->u.pict.root) {
2832 int x_off = screenInfo.screens[j]->x;
2833 int y_off = screenInfo.screens[j]->y;
2834
2835 if (x_off || y_off) {
2836 xRectangle *rects = (xRectangle *) (stuff + 1);
2837 int i = extra_len / sizeof(xRectangle);
2838
2839 while (i--) {
2840 rects->x -= x_off;
2841 rects->y -= y_off;
2842 rects++;
2843 }
2844 }
2845 }
2846 stuff->dst = dst->info[j].id;
2847 result =
2848 (*PanoramiXSaveRenderVector[X_RenderFillRectangles26]) (client);
2849 if (result != Success0)
2850 break;
2851 }
2852 free(extra);
2853 }
2854
2855 return result;
2856}
2857
2858static int
2859PanoramiXRenderTrapezoids(ClientPtr client)
2860{
2861 PanoramiXRes *src, *dst;
2862 int result = Success0, j;
2863
2864 REQUEST(xRenderTrapezoidsReq)xRenderTrapezoidsReq *stuff = (xRenderTrapezoidsReq *)client->
requestBuffer
;
2865 char *extra;
2866 int extra_len;
2867
2868 REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq)if ((sizeof(xRenderTrapezoidsReq) >> 2) > client->
req_len ) return(16)
;
2869
2870 VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(src), stuff
->src, XRT_PICTURE, client, (1<<0)); if (rc != 0) return
rc;}
;
2871 VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess){ int rc = dixLookupResourceByType((void **)&(dst), stuff
->dst, XRT_PICTURE, client, (1<<1)); if (rc != 0) return
rc;}
;
2872
2873 extra_len = (client->req_len << 2) - sizeof(xRenderTrapezoidsReq);
2874
2875 if (extra_len && (extra = (char *) malloc(extra_len))) {
2876 memcpy(extra, stuff + 1, extra_len)__builtin___memcpy_chk (extra, stuff + 1, extra_len, __builtin_object_size
(extra, 0))
;
2877
2878 FOR_NSCREENS_FORWARD(j)for(j = 0; j < PanoramiXNumScreens; j++) {
2879 if (j)
2880 memcpy(stuff + 1, extra, extra_len)__builtin___memcpy_chk (stuff + 1, extra, extra_len, __builtin_object_size
(stuff + 1, 0))
;
2881 if (dst->u.pict.root) {
2882 int x_off = screenInfo.screens[j]->x;
2883 int y_off = screenInfo.screens[j]->y;
2884
2885 if (x_off || y_off) {
2886 xTrapezoid *trap = (xTrapezoid *) (stuff + 1);
2887 int i = extra_len / sizeof(xTrapezoid);
2888
2889 while (i--) {
2890 trap->top -= y_off;
2891 trap->bottom -= y_off;
2892 trap->left.p1.x -= x_off;
2893 trap->left.p1.y -= y_off;
2894 trap->left.p2.x -= x_off;
2895 trap->left.p2.y -= y_off;
2896 trap->right.p1.x -= x_off;
2897 trap->right.p1.y -= y_off;
2898 trap->right.p2.x -= x_off;
2899 trap->right.p2.y -= y_off;
2900 trap++;
2901 }
2902 }
2903 }
2904
2905 stuff->src = src->info[j].id;
2906 stuff->dst = dst->info[j].id;
2907 result = (*PanoramiXSaveRenderVector[X_RenderTrapezoids10]) (client);
2908
2909 if (result != Success0)
2910 break;
2911 }
2912
2913 free(extra);
2914 }
2915
2916 return result;
2917}
2918
2919static int
2920PanoramiXRenderTriangles(ClientPtr client)
2921{
2922 PanoramiXRes *src, *dst;
2923 int result = Success0, j;
2924
2925 REQUEST(xRenderTrianglesReq)xRenderTrianglesReq *stuff = (xRenderTrianglesReq *)client->
requestBuffer
;
2926 char *extra;
2927 int extra_len;
2928
2929 REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq)if ((sizeof(xRenderTrianglesReq) >> 2) > client->
req_len ) return(16)
;
2930
2931 VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(src), stuff
->src, XRT_PICTURE, client, (1<<0)); if (rc != 0) return
rc;}
;
2932 VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess){ int rc = dixLookupResourceByType((void **)&(dst), stuff
->dst, XRT_PICTURE, client, (1<<1)); if (rc != 0) return
rc;}
;
2933
2934 extra_len = (client->req_len << 2) - sizeof(xRenderTrianglesReq);
2935
2936 if (extra_len && (extra = (char *) malloc(extra_len))) {
2937 memcpy(extra, stuff + 1, extra_len)__builtin___memcpy_chk (extra, stuff + 1, extra_len, __builtin_object_size
(extra, 0))
;
2938
2939 FOR_NSCREENS_FORWARD(j)for(j = 0; j < PanoramiXNumScreens; j++) {
2940 if (j)
2941 memcpy(stuff + 1, extra, extra_len)__builtin___memcpy_chk (stuff + 1, extra, extra_len, __builtin_object_size
(stuff + 1, 0))
;
2942 if (dst->u.pict.root) {
2943 int x_off = screenInfo.screens[j]->x;
2944 int y_off = screenInfo.screens[j]->y;
2945
2946 if (x_off || y_off) {
2947 xTriangle *tri = (xTriangle *) (stuff + 1);
2948 int i = extra_len / sizeof(xTriangle);
2949
2950 while (i--) {
2951 tri->p1.x -= x_off;
2952 tri->p1.y -= y_off;
2953 tri->p2.x -= x_off;
2954 tri->p2.y -= y_off;
2955 tri->p3.x -= x_off;
2956 tri->p3.y -= y_off;
2957 tri++;
2958 }
2959 }
2960 }
2961
2962 stuff->src = src->info[j].id;
2963 stuff->dst = dst->info[j].id;
2964 result = (*PanoramiXSaveRenderVector[X_RenderTriangles11]) (client);
2965
2966 if (result != Success0)
2967 break;
2968 }
2969
2970 free(extra);
2971 }
2972
2973 return result;
2974}
2975
2976static int
2977PanoramiXRenderTriStrip(ClientPtr client)
2978{
2979 PanoramiXRes *src, *dst;
2980 int result = Success0, j;
2981
2982 REQUEST(xRenderTriStripReq)xRenderTriStripReq *stuff = (xRenderTriStripReq *)client->
requestBuffer
;
2983 char *extra;
2984 int extra_len;
2985
2986 REQUEST_AT_LEAST_SIZE(xRenderTriStripReq)if ((sizeof(xRenderTriStripReq) >> 2) > client->req_len
) return(16)
;
2987
2988 VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(src), stuff
->src, XRT_PICTURE, client, (1<<0)); if (rc != 0) return
rc;}
;
2989 VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess){ int rc = dixLookupResourceByType((void **)&(dst), stuff
->dst, XRT_PICTURE, client, (1<<1)); if (rc != 0) return
rc;}
;
2990
2991 extra_len = (client->req_len << 2) - sizeof(xRenderTriStripReq);
2992
2993 if (extra_len && (extra = (char *) malloc(extra_len))) {
2994 memcpy(extra, stuff + 1, extra_len)__builtin___memcpy_chk (extra, stuff + 1, extra_len, __builtin_object_size
(extra, 0))
;
2995
2996 FOR_NSCREENS_FORWARD(j)for(j = 0; j < PanoramiXNumScreens; j++) {
2997 if (j)
2998 memcpy(stuff + 1, extra, extra_len)__builtin___memcpy_chk (stuff + 1, extra, extra_len, __builtin_object_size
(stuff + 1, 0))
;
2999 if (dst->u.pict.root) {
3000 int x_off = screenInfo.screens[j]->x;
3001 int y_off = screenInfo.screens[j]->y;
3002
3003 if (x_off || y_off) {
3004 xPointFixed *fixed = (xPointFixed *) (stuff + 1);
3005 int i = extra_len / sizeof(xPointFixed);
3006
3007 while (i--) {
3008 fixed->x -= x_off;
3009 fixed->y -= y_off;
3010 fixed++;
3011 }
3012 }
3013 }
3014
3015 stuff->src = src->info[j].id;
3016 stuff->dst = dst->info[j].id;
3017 result = (*PanoramiXSaveRenderVector[X_RenderTriStrip12]) (client);
3018
3019 if (result != Success0)
3020 break;
3021 }
3022
3023 free(extra);
3024 }
3025
3026 return result;
3027}
3028
3029static int
3030PanoramiXRenderTriFan(ClientPtr client)
3031{
3032 PanoramiXRes *src, *dst;
3033 int result = Success0, j;
3034
3035 REQUEST(xRenderTriFanReq)xRenderTriFanReq *stuff = (xRenderTriFanReq *)client->requestBuffer;
3036 char *extra;
3037 int extra_len;
3038
3039 REQUEST_AT_LEAST_SIZE(xRenderTriFanReq)if ((sizeof(xRenderTriFanReq) >> 2) > client->req_len
) return(16)
;
3040
3041 VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess){ int rc = dixLookupResourceByType((void **)&(src), stuff
->src, XRT_PICTURE, client, (1<<0)); if (rc != 0) return
rc;}
;
3042 VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess){ int rc = dixLookupResourceByType((void **)&(dst), stuff
->dst, XRT_PICTURE, client, (1<<1)); if (rc != 0) return
rc;}
;
3043
3044 extra_len = (client->req_len << 2) - sizeof(xRenderTriFanReq);
3045
3046 if (extra_len && (extra = (char *) malloc(extra_len))) {
3047 memcpy(extra, stuff + 1, extra_len)__builtin___memcpy_chk (extra, stuff + 1, extra_len, __builtin_object_size
(extra, 0))
;
3048
3049 FOR_NSCREENS_FORWARD(j)for(j = 0; j < PanoramiXNumScreens; j++) {
3050 if (j)
3051 memcpy(stuff + 1, extra, extra_len)__builtin___memcpy_chk (stuff + 1, extra, extra_len, __builtin_object_size
(stuff + 1, 0))
;
3052 if (dst->u.pict.root) {
3053 int x_off = screenInfo.screens[j]->x;
3054 int y_off = screenInfo.screens[j]->y;
3055
3056 if (x_off || y_off) {
3057 xPointFixed *fixed = (xPointFixed *) (stuff + 1);
3058 int i = extra_len / sizeof(xPointFixed);
3059
3060 while (i--) {
3061 fixed->x -= x_off;
3062 fixed->y -= y_off;
3063 fixed++;
3064 }
3065 }
3066 }
3067
3068 stuff->src = src->info[j].id;
3069 stuff->dst = dst->info[j].id;
3070 result = (*PanoramiXSaveRenderVector[X_RenderTriFan13]) (client);
3071
3072 if (result != Success0)
3073 break;
3074 }
3075
3076 free(extra);
3077 }
3078
3079 return result;
3080}
3081
3082static int
3083PanoramiXRenderAddTraps(ClientPtr client)
3084{
3085 PanoramiXRes *picture;
3086 int result = Success0, j;
3087
3088 REQUEST(xRenderAddTrapsReq)xRenderAddTrapsReq *stuff = (xRenderAddTrapsReq *)client->
requestBuffer
;
3089 char *extra;
3090 int extra_len;
3091 INT16 x_off, y_off;
3092
3093 REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq)if ((sizeof(xRenderAddTrapsReq) >> 2) > client->req_len
) return(16)
;
3094 VERIFY_XIN_PICTURE(picture, stuff->picture, client, DixWriteAccess){ int rc = dixLookupResourceByType((void **)&(picture), stuff
->picture, XRT_PICTURE, client, (1<<1)); if (rc != 0
) return rc;}
;
3095 extra_len = (client->req_len << 2) - sizeof(xRenderAddTrapsReq);
3096 if (extra_len && (extra = (char *) malloc(extra_len))) {
3097 memcpy(extra, stuff + 1, extra_len)__builtin___memcpy_chk (extra, stuff + 1, extra_len, __builtin_object_size
(extra, 0))
;
3098 x_off = stuff->xOff;
3099 y_off = stuff->yOff;
3100 FOR_NSCREENS_FORWARD(j)for(j = 0; j < PanoramiXNumScreens; j++) {
3101 if (j)
3102 memcpy(stuff + 1, extra, extra_len)__builtin___memcpy_chk (stuff + 1, extra, extra_len, __builtin_object_size
(stuff + 1, 0))
;
3103 stuff->picture = picture->info[j].id;
3104
3105 if (picture->u.pict.root) {
3106 stuff->xOff = x_off + screenInfo.screens[j]->x;
3107 stuff->yOff = y_off + screenInfo.screens[j]->y;
3108 }
3109 result = (*PanoramiXSaveRenderVector[X_RenderAddTraps32]) (client);
3110 if (result != Success0)
3111 break;
3112 }
3113 free(extra);
3114 }
3115
3116 return result;
3117}
3118
3119static int
3120PanoramiXRenderCreateSolidFill(ClientPtr client)
3121{
3122 REQUEST(xRenderCreateSolidFillReq)xRenderCreateSolidFillReq *stuff = (xRenderCreateSolidFillReq
*)client->requestBuffer
;
3123 PanoramiXRes *newPict;
3124 int result = Success0, j;
3125
3126 REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq)if ((sizeof(xRenderCreateSolidFillReq) >> 2) > client
->req_len ) return(16)
;
3127
3128 if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
3129 return BadAlloc11;
3130
3131 newPict->type = XRT_PICTURE;
3132 panoramix_setup_ids(newPict, client, stuff->pid);
3133 newPict->u.pict.root = FALSE0;
3134
3135 FOR_NSCREENS_BACKWARD(j)for(j = PanoramiXNumScreens - 1; j >= 0; j--) {
3136 stuff->pid = newPict->info[j].id;
3137 result = (*PanoramiXSaveRenderVector[X_RenderCreateSolidFill33]) (client);
3138 if (result != Success0)
3139 break;
3140 }
3141
3142 if (result == Success0)
3143 AddResourceDarwin_X_AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
3144 else
3145 free(newPict);
3146
3147 return result;
3148}
3149
3150static int
3151PanoramiXRenderCreateLinearGradient(ClientPtr client)
3152{
3153 REQUEST(xRenderCreateLinearGradientReq)xRenderCreateLinearGradientReq *stuff = (xRenderCreateLinearGradientReq
*)client->requestBuffer
;
3154 PanoramiXRes *newPict;
3155 int result = Success0, j;
3156
3157 REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq)if ((sizeof(xRenderCreateLinearGradientReq) >> 2) > client
->req_len ) return(16)
;
3158
3159 if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
3160 return BadAlloc11;
3161
3162 newPict->type = XRT_PICTURE;
3163 panoramix_setup_ids(newPict, client, stuff->pid);
3164 newPict->u.pict.root = FALSE0;
3165
3166 FOR_NSCREENS_BACKWARD(j)for(j = PanoramiXNumScreens - 1; j >= 0; j--) {
3167 stuff->pid = newPict->info[j].id;
3168 result =
3169 (*PanoramiXSaveRenderVector[X_RenderCreateLinearGradient34]) (client);
3170 if (result != Success0)
3171 break;
3172 }
3173
3174 if (result == Success0)
3175 AddResourceDarwin_X_AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
3176 else
3177 free(newPict);
3178
3179 return result;
3180}
3181
3182static int
3183PanoramiXRenderCreateRadialGradient(ClientPtr client)
3184{
3185 REQUEST(xRenderCreateRadialGradientReq)xRenderCreateRadialGradientReq *stuff = (xRenderCreateRadialGradientReq
*)client->requestBuffer
;
3186 PanoramiXRes *newPict;
3187 int result = Success0, j;
3188
3189 REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq)if ((sizeof(xRenderCreateRadialGradientReq) >> 2) > client
->req_len ) return(16)
;
3190
3191 if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
3192 return BadAlloc11;
3193
3194 newPict->type = XRT_PICTURE;
3195 panoramix_setup_ids(newPict, client, stuff->pid);
3196 newPict->u.pict.root = FALSE0;
3197
3198 FOR_NSCREENS_BACKWARD(j)for(j = PanoramiXNumScreens - 1; j >= 0; j--) {
3199 stuff->pid = newPict->info[j].id;
3200 result =
3201 (*PanoramiXSaveRenderVector[X_RenderCreateRadialGradient35]) (client);
3202 if (result != Success0)
3203 break;
3204 }
3205
3206 if (result == Success0)
3207 AddResourceDarwin_X_AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
3208 else
3209 free(newPict);
3210
3211 return result;
3212}
3213
3214static int
3215PanoramiXRenderCreateConicalGradient(ClientPtr client)
3216{
3217 REQUEST(xRenderCreateConicalGradientReq)xRenderCreateConicalGradientReq *stuff = (xRenderCreateConicalGradientReq
*)client->requestBuffer
;
3218 PanoramiXRes *newPict;
3219 int result = Success0, j;
3220
3221 REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq)if ((sizeof(xRenderCreateConicalGradientReq) >> 2) >
client->req_len ) return(16)
;
3222
3223 if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
3224 return BadAlloc11;
3225
3226 newPict->type = XRT_PICTURE;
3227 panoramix_setup_ids(newPict, client, stuff->pid);
3228 newPict->u.pict.root = FALSE0;
3229
3230 FOR_NSCREENS_BACKWARD(j)for(j = PanoramiXNumScreens - 1; j >= 0; j--) {
3231 stuff->pid = newPict->info[j].id;
3232 result =
3233 (*PanoramiXSaveRenderVector[X_RenderCreateConicalGradient36])
3234 (client);
3235 if (result != Success0)
3236 break;
3237 }
3238
3239 if (result == Success0)
3240 AddResourceDarwin_X_AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
3241 else
3242 free(newPict);
3243
3244 return result;
3245}
3246
3247void
3248PanoramiXRenderInit(void)
3249{
3250 int i;
3251
3252 XRT_PICTURE = CreateNewResourceType(XineramaDeleteResource,
3253 "XineramaPicture");
3254 if (RenderErrBase)
3255 SetResourceTypeErrorValue(XRT_PICTURE, RenderErrBase + BadPicture1);
3256 for (i = 0; i < RenderNumberRequests(36 +1); i++)
3257 PanoramiXSaveRenderVector[i] = ProcRenderVector[i];
3258 /*
3259 * Stuff in Xinerama aware request processing hooks
3260 */
3261 ProcRenderVector[X_RenderCreatePicture4] = PanoramiXRenderCreatePicture;
3262 ProcRenderVector[X_RenderChangePicture5] = PanoramiXRenderChangePicture;
3263 ProcRenderVector[X_RenderSetPictureTransform28] =
3264 PanoramiXRenderSetPictureTransform;
3265 ProcRenderVector[X_RenderSetPictureFilter30] =
3266 PanoramiXRenderSetPictureFilter;
3267 ProcRenderVector[X_RenderSetPictureClipRectangles6] =
3268 PanoramiXRenderSetPictureClipRectangles;
3269 ProcRenderVector[X_RenderFreePicture7] = PanoramiXRenderFreePicture;
3270 ProcRenderVector[X_RenderComposite8] = PanoramiXRenderComposite;
3271 ProcRenderVector[X_RenderCompositeGlyphs823] = PanoramiXRenderCompositeGlyphs;
3272 ProcRenderVector[X_RenderCompositeGlyphs1624] =
3273 PanoramiXRenderCompositeGlyphs;
3274 ProcRenderVector[X_RenderCompositeGlyphs3225] =
3275 PanoramiXRenderCompositeGlyphs;
3276 ProcRenderVector[X_RenderFillRectangles26] = PanoramiXRenderFillRectangles;
3277
3278 ProcRenderVector[X_RenderTrapezoids10] = PanoramiXRenderTrapezoids;
3279 ProcRenderVector[X_RenderTriangles11] = PanoramiXRenderTriangles;
3280 ProcRenderVector[X_RenderTriStrip12] = PanoramiXRenderTriStrip;
3281 ProcRenderVector[X_RenderTriFan13] = PanoramiXRenderTriFan;
3282 ProcRenderVector[X_RenderAddTraps32] = PanoramiXRenderAddTraps;
3283
3284 ProcRenderVector[X_RenderCreateSolidFill33] = PanoramiXRenderCreateSolidFill;
3285 ProcRenderVector[X_RenderCreateLinearGradient34] =
3286 PanoramiXRenderCreateLinearGradient;
3287 ProcRenderVector[X_RenderCreateRadialGradient35] =
3288 PanoramiXRenderCreateRadialGradient;
3289 ProcRenderVector[X_RenderCreateConicalGradient36] =
3290 PanoramiXRenderCreateConicalGradient;
3291}
3292
3293void
3294PanoramiXRenderReset(void)
3295{
3296 int i;
3297
3298 for (i = 0; i < RenderNumberRequests(36 +1); i++)
3299 ProcRenderVector[i] = PanoramiXSaveRenderVector[i];
3300 RenderErrBase = 0;
3301}
3302
3303#endif /* PANORAMIX */