3 * Copyright © 2000 SuSE, Inc.
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.
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.
22 * Author: Keith Packard, SuSE, Inc.
27 #ifdef HAVE_DIX_CONFIG_H
28 #include <dix-config.h>
32 #include <X11/Xproto.h>
35 #include "dixstruct.h"
37 #include "scrnintstr.h"
38 #include "windowstr.h"
39 #include "pixmapstr.h"
40 #include "colormapst.h"
41 #include "extnsionst.h"
43 #include <X11/extensions/render.h>
44 #include <X11/extensions/renderproto.h>
45 #include "picturestr.h"
47 #include <X11/Xfuncproto.h>
48 #include "cursorstr.h"
52 #elif !defined(UINT32_MAX)
53 #define UINT32_MAX 0xffffffffU
56 static int ProcRenderQueryVersion (ClientPtr pClient
);
57 static int ProcRenderQueryPictFormats (ClientPtr pClient
);
58 static int ProcRenderQueryPictIndexValues (ClientPtr pClient
);
59 static int ProcRenderQueryDithers (ClientPtr pClient
);
60 static int ProcRenderCreatePicture (ClientPtr pClient
);
61 static int ProcRenderChangePicture (ClientPtr pClient
);
62 static int ProcRenderSetPictureClipRectangles (ClientPtr pClient
);
63 static int ProcRenderFreePicture (ClientPtr pClient
);
64 static int ProcRenderComposite (ClientPtr pClient
);
65 static int ProcRenderScale (ClientPtr pClient
);
66 static int ProcRenderTrapezoids (ClientPtr pClient
);
67 static int ProcRenderTriangles (ClientPtr pClient
);
68 static int ProcRenderTriStrip (ClientPtr pClient
);
69 static int ProcRenderTriFan (ClientPtr pClient
);
70 static int ProcRenderColorTrapezoids (ClientPtr pClient
);
71 static int ProcRenderColorTriangles (ClientPtr pClient
);
72 static int ProcRenderTransform (ClientPtr pClient
);
73 static int ProcRenderCreateGlyphSet (ClientPtr pClient
);
74 static int ProcRenderReferenceGlyphSet (ClientPtr pClient
);
75 static int ProcRenderFreeGlyphSet (ClientPtr pClient
);
76 static int ProcRenderAddGlyphs (ClientPtr pClient
);
77 static int ProcRenderAddGlyphsFromPicture (ClientPtr pClient
);
78 static int ProcRenderFreeGlyphs (ClientPtr pClient
);
79 static int ProcRenderCompositeGlyphs (ClientPtr pClient
);
80 static int ProcRenderFillRectangles (ClientPtr pClient
);
81 static int ProcRenderCreateCursor (ClientPtr pClient
);
82 static int ProcRenderSetPictureTransform (ClientPtr pClient
);
83 static int ProcRenderQueryFilters (ClientPtr pClient
);
84 static int ProcRenderSetPictureFilter (ClientPtr pClient
);
85 static int ProcRenderCreateAnimCursor (ClientPtr pClient
);
86 static int ProcRenderAddTraps (ClientPtr pClient
);
87 static int ProcRenderCreateSolidFill (ClientPtr pClient
);
88 static int ProcRenderCreateLinearGradient (ClientPtr pClient
);
89 static int ProcRenderCreateRadialGradient (ClientPtr pClient
);
90 static int ProcRenderCreateConicalGradient (ClientPtr pClient
);
92 static int ProcRenderDispatch (ClientPtr pClient
);
94 static int SProcRenderQueryVersion (ClientPtr pClient
);
95 static int SProcRenderQueryPictFormats (ClientPtr pClient
);
96 static int SProcRenderQueryPictIndexValues (ClientPtr pClient
);
97 static int SProcRenderQueryDithers (ClientPtr pClient
);
98 static int SProcRenderCreatePicture (ClientPtr pClient
);
99 static int SProcRenderChangePicture (ClientPtr pClient
);
100 static int SProcRenderSetPictureClipRectangles (ClientPtr pClient
);
101 static int SProcRenderFreePicture (ClientPtr pClient
);
102 static int SProcRenderComposite (ClientPtr pClient
);
103 static int SProcRenderScale (ClientPtr pClient
);
104 static int SProcRenderTrapezoids (ClientPtr pClient
);
105 static int SProcRenderTriangles (ClientPtr pClient
);
106 static int SProcRenderTriStrip (ClientPtr pClient
);
107 static int SProcRenderTriFan (ClientPtr pClient
);
108 static int SProcRenderColorTrapezoids (ClientPtr pClient
);
109 static int SProcRenderColorTriangles (ClientPtr pClient
);
110 static int SProcRenderTransform (ClientPtr pClient
);
111 static int SProcRenderCreateGlyphSet (ClientPtr pClient
);
112 static int SProcRenderReferenceGlyphSet (ClientPtr pClient
);
113 static int SProcRenderFreeGlyphSet (ClientPtr pClient
);
114 static int SProcRenderAddGlyphs (ClientPtr pClient
);
115 static int SProcRenderAddGlyphsFromPicture (ClientPtr pClient
);
116 static int SProcRenderFreeGlyphs (ClientPtr pClient
);
117 static int SProcRenderCompositeGlyphs (ClientPtr pClient
);
118 static int SProcRenderFillRectangles (ClientPtr pClient
);
119 static int SProcRenderCreateCursor (ClientPtr pClient
);
120 static int SProcRenderSetPictureTransform (ClientPtr pClient
);
121 static int SProcRenderQueryFilters (ClientPtr pClient
);
122 static int SProcRenderSetPictureFilter (ClientPtr pClient
);
123 static int SProcRenderCreateAnimCursor (ClientPtr pClient
);
124 static int SProcRenderAddTraps (ClientPtr pClient
);
125 static int SProcRenderCreateSolidFill (ClientPtr pClient
);
126 static int SProcRenderCreateLinearGradient (ClientPtr pClient
);
127 static int SProcRenderCreateRadialGradient (ClientPtr pClient
);
128 static int SProcRenderCreateConicalGradient (ClientPtr pClient
);
130 static int SProcRenderDispatch (ClientPtr pClient
);
132 int (*ProcRenderVector
[RenderNumberRequests
])(ClientPtr
) = {
133 ProcRenderQueryVersion
,
134 ProcRenderQueryPictFormats
,
135 ProcRenderQueryPictIndexValues
,
136 ProcRenderQueryDithers
,
137 ProcRenderCreatePicture
,
138 ProcRenderChangePicture
,
139 ProcRenderSetPictureClipRectangles
,
140 ProcRenderFreePicture
,
143 ProcRenderTrapezoids
,
147 ProcRenderColorTrapezoids
,
148 ProcRenderColorTriangles
,
150 ProcRenderCreateGlyphSet
,
151 ProcRenderReferenceGlyphSet
,
152 ProcRenderFreeGlyphSet
,
154 ProcRenderAddGlyphsFromPicture
,
155 ProcRenderFreeGlyphs
,
156 ProcRenderCompositeGlyphs
,
157 ProcRenderCompositeGlyphs
,
158 ProcRenderCompositeGlyphs
,
159 ProcRenderFillRectangles
,
160 ProcRenderCreateCursor
,
161 ProcRenderSetPictureTransform
,
162 ProcRenderQueryFilters
,
163 ProcRenderSetPictureFilter
,
164 ProcRenderCreateAnimCursor
,
166 ProcRenderCreateSolidFill
,
167 ProcRenderCreateLinearGradient
,
168 ProcRenderCreateRadialGradient
,
169 ProcRenderCreateConicalGradient
172 int (*SProcRenderVector
[RenderNumberRequests
])(ClientPtr
) = {
173 SProcRenderQueryVersion
,
174 SProcRenderQueryPictFormats
,
175 SProcRenderQueryPictIndexValues
,
176 SProcRenderQueryDithers
,
177 SProcRenderCreatePicture
,
178 SProcRenderChangePicture
,
179 SProcRenderSetPictureClipRectangles
,
180 SProcRenderFreePicture
,
181 SProcRenderComposite
,
183 SProcRenderTrapezoids
,
184 SProcRenderTriangles
,
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
,
206 SProcRenderCreateSolidFill
,
207 SProcRenderCreateLinearGradient
,
208 SProcRenderCreateRadialGradient
,
209 SProcRenderCreateConicalGradient
213 RenderResetProc (ExtensionEntry
*extEntry
);
216 static CARD8 RenderReqCode
;
219 int RenderClientPrivateIndex
;
221 typedef struct _RenderClient
{
224 } RenderClientRec
, *RenderClientPtr
;
226 #define GetRenderClient(pClient) ((RenderClientPtr) (pClient)->devPrivates[RenderClientPrivateIndex].ptr)
229 RenderClientCallback (CallbackListPtr
*list
,
233 NewClientInfoRec
*clientinfo
= (NewClientInfoRec
*) data
;
234 ClientPtr pClient
= clientinfo
->client
;
235 RenderClientPtr pRenderClient
= GetRenderClient (pClient
);
237 pRenderClient
->major_version
= 0;
238 pRenderClient
->minor_version
= 0;
242 RenderExtensionInit (void)
244 ExtensionEntry
*extEntry
;
248 if (!PictureFinishInit ())
250 RenderClientPrivateIndex
= AllocateClientPrivateIndex ();
251 if (!AllocateClientPrivate (RenderClientPrivateIndex
,
252 sizeof (RenderClientRec
)))
254 if (!AddCallback (&ClientStateCallback
, RenderClientCallback
, 0))
257 extEntry
= AddExtension (RENDER_NAME
, 0, RenderNumberErrors
,
258 ProcRenderDispatch
, SProcRenderDispatch
,
259 RenderResetProc
, StandardMinorOpcode
);
263 RenderReqCode
= (CARD8
) extEntry
->base
;
265 RenderErrBase
= extEntry
->errorBase
;
269 RenderResetProc (ExtensionEntry
*extEntry
)
271 ResetPicturePrivateIndex();
272 ResetGlyphSetPrivateIndex();
276 ProcRenderQueryVersion (ClientPtr client
)
278 RenderClientPtr pRenderClient
= GetRenderClient (client
);
279 xRenderQueryVersionReply rep
;
281 REQUEST(xRenderQueryVersionReq
);
283 pRenderClient
->major_version
= stuff
->majorVersion
;
284 pRenderClient
->minor_version
= stuff
->minorVersion
;
286 REQUEST_SIZE_MATCH(xRenderQueryVersionReq
);
289 rep
.sequenceNumber
= client
->sequence
;
290 rep
.majorVersion
= RENDER_MAJOR
;
291 rep
.minorVersion
= RENDER_MINOR
;
292 if (client
->swapped
) {
293 swaps(&rep
.sequenceNumber
, n
);
294 swapl(&rep
.length
, n
);
295 swapl(&rep
.majorVersion
, n
);
296 swapl(&rep
.minorVersion
, n
);
298 WriteToClient(client
, sizeof(xRenderQueryVersionReply
), (char *)&rep
);
299 return (client
->noClientException
);
304 VisualDepth (ScreenPtr pScreen
, VisualPtr pVisual
)
309 for (d
= 0; d
< pScreen
->numDepths
; d
++)
311 pDepth
= pScreen
->allowedDepths
+ d
;
312 for (v
= 0; v
< pDepth
->numVids
; v
++)
314 if (pDepth
->vids
[v
] == pVisual
->vid
)
315 return pDepth
->depth
;
323 findVisual (ScreenPtr pScreen
, VisualID vid
)
328 for (v
= 0; v
< pScreen
->numVisuals
; v
++)
330 pVisual
= pScreen
->visuals
+ v
;
331 if (pVisual
->vid
== vid
)
337 extern char *ConnectionInfo
;
340 ProcRenderQueryPictFormats (ClientPtr client
)
342 RenderClientPtr pRenderClient
= GetRenderClient (client
);
343 xRenderQueryPictFormatsReply
*reply
;
344 xPictScreen
*pictScreen
;
345 xPictDepth
*pictDepth
;
346 xPictVisual
*pictVisual
;
347 xPictFormInfo
*pictForm
;
348 CARD32
*pictSubpixel
;
354 PictFormatPtr pFormat
;
363 /* REQUEST(xRenderQueryPictFormatsReq); */
365 REQUEST_SIZE_MATCH(xRenderQueryPictFormatsReq
);
368 if (noPanoramiXExtension
)
369 numScreens
= screenInfo
.numScreens
;
371 numScreens
= ((xConnSetup
*)ConnectionInfo
)->numRoots
;
373 numScreens
= screenInfo
.numScreens
;
375 ndepth
= nformat
= nvisual
= 0;
376 for (s
= 0; s
< numScreens
; s
++)
378 pScreen
= screenInfo
.screens
[s
];
379 for (d
= 0; d
< pScreen
->numDepths
; d
++)
381 pDepth
= pScreen
->allowedDepths
+ d
;
384 for (v
= 0; v
< pDepth
->numVids
; v
++)
386 pVisual
= findVisual (pScreen
, pDepth
->vids
[v
]);
387 if (pVisual
&& PictureMatchVisual (pScreen
, pDepth
->depth
, pVisual
))
391 ps
= GetPictureScreenIfSet(pScreen
);
393 nformat
+= ps
->nformats
;
395 if (pRenderClient
->major_version
== 0 && pRenderClient
->minor_version
< 6)
398 numSubpixel
= numScreens
;
400 rlength
= (sizeof (xRenderQueryPictFormatsReply
) +
401 nformat
* sizeof (xPictFormInfo
) +
402 numScreens
* sizeof (xPictScreen
) +
403 ndepth
* sizeof (xPictDepth
) +
404 nvisual
* sizeof (xPictVisual
) +
405 numSubpixel
* sizeof (CARD32
));
406 reply
= (xRenderQueryPictFormatsReply
*) xalloc (rlength
);
409 reply
->type
= X_Reply
;
410 reply
->sequenceNumber
= client
->sequence
;
411 reply
->length
= (rlength
- sizeof(xGenericReply
)) >> 2;
412 reply
->numFormats
= nformat
;
413 reply
->numScreens
= numScreens
;
414 reply
->numDepths
= ndepth
;
415 reply
->numVisuals
= nvisual
;
416 reply
->numSubpixel
= numSubpixel
;
418 pictForm
= (xPictFormInfo
*) (reply
+ 1);
420 for (s
= 0; s
< numScreens
; s
++)
422 pScreen
= screenInfo
.screens
[s
];
423 ps
= GetPictureScreenIfSet(pScreen
);
426 for (nformat
= 0, pFormat
= ps
->formats
;
427 nformat
< ps
->nformats
;
428 nformat
++, pFormat
++)
430 pictForm
->id
= pFormat
->id
;
431 pictForm
->type
= pFormat
->type
;
432 pictForm
->depth
= pFormat
->depth
;
433 pictForm
->direct
.red
= pFormat
->direct
.red
;
434 pictForm
->direct
.redMask
= pFormat
->direct
.redMask
;
435 pictForm
->direct
.green
= pFormat
->direct
.green
;
436 pictForm
->direct
.greenMask
= pFormat
->direct
.greenMask
;
437 pictForm
->direct
.blue
= pFormat
->direct
.blue
;
438 pictForm
->direct
.blueMask
= pFormat
->direct
.blueMask
;
439 pictForm
->direct
.alpha
= pFormat
->direct
.alpha
;
440 pictForm
->direct
.alphaMask
= pFormat
->direct
.alphaMask
;
441 if (pFormat
->type
== PictTypeIndexed
&& pFormat
->index
.pColormap
)
442 pictForm
->colormap
= pFormat
->index
.pColormap
->mid
;
444 pictForm
->colormap
= None
;
447 swapl (&pictForm
->id
, n
);
448 swaps (&pictForm
->direct
.red
, n
);
449 swaps (&pictForm
->direct
.redMask
, n
);
450 swaps (&pictForm
->direct
.green
, n
);
451 swaps (&pictForm
->direct
.greenMask
, n
);
452 swaps (&pictForm
->direct
.blue
, n
);
453 swaps (&pictForm
->direct
.blueMask
, n
);
454 swaps (&pictForm
->direct
.alpha
, n
);
455 swaps (&pictForm
->direct
.alphaMask
, n
);
456 swapl (&pictForm
->colormap
, n
);
463 pictScreen
= (xPictScreen
*) pictForm
;
464 for (s
= 0; s
< numScreens
; s
++)
466 pScreen
= screenInfo
.screens
[s
];
467 pictDepth
= (xPictDepth
*) (pictScreen
+ 1);
469 for (d
= 0; d
< pScreen
->numDepths
; d
++)
471 pictVisual
= (xPictVisual
*) (pictDepth
+ 1);
472 pDepth
= pScreen
->allowedDepths
+ d
;
475 for (v
= 0; v
< pDepth
->numVids
; v
++)
477 pVisual
= findVisual (pScreen
, pDepth
->vids
[v
]);
478 if (pVisual
&& (pFormat
= PictureMatchVisual (pScreen
,
482 pictVisual
->visual
= pVisual
->vid
;
483 pictVisual
->format
= pFormat
->id
;
486 swapl (&pictVisual
->visual
, n
);
487 swapl (&pictVisual
->format
, n
);
493 pictDepth
->depth
= pDepth
->depth
;
494 pictDepth
->nPictVisuals
= nvisual
;
497 swaps (&pictDepth
->nPictVisuals
, n
);
500 pictDepth
= (xPictDepth
*) pictVisual
;
502 pictScreen
->nDepth
= ndepth
;
503 ps
= GetPictureScreenIfSet(pScreen
);
505 pictScreen
->fallback
= ps
->fallback
->id
;
507 pictScreen
->fallback
= 0;
510 swapl (&pictScreen
->nDepth
, n
);
511 swapl (&pictScreen
->fallback
, n
);
513 pictScreen
= (xPictScreen
*) pictDepth
;
515 pictSubpixel
= (CARD32
*) pictScreen
;
517 for (s
= 0; s
< numSubpixel
; s
++)
519 pScreen
= screenInfo
.screens
[s
];
520 ps
= GetPictureScreenIfSet(pScreen
);
522 *pictSubpixel
= ps
->subpixel
;
524 *pictSubpixel
= SubPixelUnknown
;
527 swapl (pictSubpixel
, n
);
534 swaps (&reply
->sequenceNumber
, n
);
535 swapl (&reply
->length
, n
);
536 swapl (&reply
->numFormats
, n
);
537 swapl (&reply
->numScreens
, n
);
538 swapl (&reply
->numDepths
, n
);
539 swapl (&reply
->numVisuals
, n
);
540 swapl (&reply
->numSubpixel
, n
);
542 WriteToClient(client
, rlength
, (char *) reply
);
544 return client
->noClientException
;
548 ProcRenderQueryPictIndexValues (ClientPtr client
)
550 PictFormatPtr pFormat
;
554 REQUEST(xRenderQueryPictIndexValuesReq
);
555 xRenderQueryPictIndexValuesReply
*reply
;
558 REQUEST_AT_LEAST_SIZE(xRenderQueryPictIndexValuesReq
);
560 pFormat
= (PictFormatPtr
) SecurityLookupIDByType (client
,
567 client
->errorValue
= stuff
->format
;
568 return RenderErrBase
+ BadPictFormat
;
570 if (pFormat
->type
!= PictTypeIndexed
)
572 client
->errorValue
= stuff
->format
;
575 num
= pFormat
->index
.nvalues
;
576 rlength
= (sizeof (xRenderQueryPictIndexValuesReply
) +
577 num
* sizeof(xIndexValue
));
578 reply
= (xRenderQueryPictIndexValuesReply
*) xalloc (rlength
);
582 reply
->type
= X_Reply
;
583 reply
->sequenceNumber
= client
->sequence
;
584 reply
->length
= (rlength
- sizeof(xGenericReply
)) >> 2;
585 reply
->numIndexValues
= num
;
587 values
= (xIndexValue
*) (reply
+ 1);
589 memcpy (reply
+ 1, pFormat
->index
.pValues
, num
* sizeof (xIndexValue
));
593 for (i
= 0; i
< num
; i
++)
595 swapl (&values
[i
].pixel
, n
);
596 swaps (&values
[i
].red
, n
);
597 swaps (&values
[i
].green
, n
);
598 swaps (&values
[i
].blue
, n
);
599 swaps (&values
[i
].alpha
, n
);
601 swaps (&reply
->sequenceNumber
, n
);
602 swapl (&reply
->length
, n
);
603 swapl (&reply
->numIndexValues
, n
);
606 WriteToClient(client
, rlength
, (char *) reply
);
608 return (client
->noClientException
);
612 ProcRenderQueryDithers (ClientPtr client
)
614 return BadImplementation
;
618 ProcRenderCreatePicture (ClientPtr client
)
621 DrawablePtr pDrawable
;
622 PictFormatPtr pFormat
;
624 REQUEST(xRenderCreatePictureReq
);
626 REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq
);
628 LEGAL_NEW_RESOURCE(stuff
->pid
, client
);
629 rc
= dixLookupDrawable(&pDrawable
, stuff
->drawable
, client
, 0,
634 pFormat
= (PictFormatPtr
) SecurityLookupIDByType (client
,
640 client
->errorValue
= stuff
->format
;
641 return RenderErrBase
+ BadPictFormat
;
643 if (pFormat
->depth
!= pDrawable
->depth
)
645 len
= client
->req_len
- (sizeof(xRenderCreatePictureReq
) >> 2);
646 if (Ones(stuff
->mask
) != len
)
649 pPicture
= CreatePicture (stuff
->pid
,
658 if (!AddResource (stuff
->pid
, PictureType
, (pointer
)pPicture
))
664 ProcRenderChangePicture (ClientPtr client
)
667 REQUEST(xRenderChangePictureReq
);
670 REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq
);
671 VERIFY_PICTURE (pPicture
, stuff
->picture
, client
, DixWriteAccess
,
672 RenderErrBase
+ BadPicture
);
674 len
= client
->req_len
- (sizeof(xRenderChangePictureReq
) >> 2);
675 if (Ones(stuff
->mask
) != len
)
678 return ChangePicture (pPicture
, stuff
->mask
, (XID
*) (stuff
+ 1),
679 (DevUnion
*) 0, client
);
683 ProcRenderSetPictureClipRectangles (ClientPtr client
)
685 REQUEST(xRenderSetPictureClipRectanglesReq
);
690 REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq
);
691 VERIFY_PICTURE (pPicture
, stuff
->picture
, client
, DixWriteAccess
,
692 RenderErrBase
+ BadPicture
);
693 if (!pPicture
->pDrawable
)
696 nr
= (client
->req_len
<< 2) - sizeof(xRenderChangePictureReq
);
700 result
= SetPictureClipRects (pPicture
,
701 stuff
->xOrigin
, stuff
->yOrigin
,
702 nr
, (xRectangle
*) &stuff
[1]);
703 if (client
->noClientException
!= Success
)
704 return(client
->noClientException
);
710 ProcRenderFreePicture (ClientPtr client
)
713 REQUEST(xRenderFreePictureReq
);
715 REQUEST_SIZE_MATCH(xRenderFreePictureReq
);
717 VERIFY_PICTURE (pPicture
, stuff
->picture
, client
, DixDestroyAccess
,
718 RenderErrBase
+ BadPicture
);
719 FreeResource (stuff
->picture
, RT_NONE
);
720 return(client
->noClientException
);
724 PictOpValid (CARD8 op
)
726 if (/*PictOpMinimum <= op && */ op
<= PictOpMaximum
)
728 if (PictOpDisjointMinimum
<= op
&& op
<= PictOpDisjointMaximum
)
730 if (PictOpConjointMinimum
<= op
&& op
<= PictOpConjointMaximum
)
736 ProcRenderComposite (ClientPtr client
)
738 PicturePtr pSrc
, pMask
, pDst
;
739 REQUEST(xRenderCompositeReq
);
741 REQUEST_SIZE_MATCH(xRenderCompositeReq
);
742 if (!PictOpValid (stuff
->op
))
744 client
->errorValue
= stuff
->op
;
747 VERIFY_PICTURE (pDst
, stuff
->dst
, client
, DixWriteAccess
,
748 RenderErrBase
+ BadPicture
);
749 if (!pDst
->pDrawable
)
751 VERIFY_PICTURE (pSrc
, stuff
->src
, client
, DixReadAccess
,
752 RenderErrBase
+ BadPicture
);
753 VERIFY_ALPHA (pMask
, stuff
->mask
, client
, DixReadAccess
,
754 RenderErrBase
+ BadPicture
);
755 if ((pSrc
->pDrawable
&& pSrc
->pDrawable
->pScreen
!= pDst
->pDrawable
->pScreen
) ||
756 (pMask
&& pMask
->pDrawable
&& pDst
->pDrawable
->pScreen
!= pMask
->pDrawable
->pScreen
))
758 CompositePicture (stuff
->op
,
774 ProcRenderScale (ClientPtr client
)
776 return BadImplementation
;
780 ProcRenderTrapezoids (ClientPtr client
)
783 PicturePtr pSrc
, pDst
;
784 PictFormatPtr pFormat
;
785 REQUEST(xRenderTrapezoidsReq
);
787 REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq
);
788 if (!PictOpValid (stuff
->op
))
790 client
->errorValue
= stuff
->op
;
793 VERIFY_PICTURE (pSrc
, stuff
->src
, client
, DixReadAccess
,
794 RenderErrBase
+ BadPicture
);
795 VERIFY_PICTURE (pDst
, stuff
->dst
, client
, DixWriteAccess
,
796 RenderErrBase
+ BadPicture
);
797 if (!pDst
->pDrawable
)
799 if (pSrc
->pDrawable
&& pSrc
->pDrawable
->pScreen
!= pDst
->pDrawable
->pScreen
)
801 if (stuff
->maskFormat
)
803 pFormat
= (PictFormatPtr
) SecurityLookupIDByType (client
,
809 client
->errorValue
= stuff
->maskFormat
;
810 return RenderErrBase
+ BadPictFormat
;
815 ntraps
= (client
->req_len
<< 2) - sizeof (xRenderTrapezoidsReq
);
816 if (ntraps
% sizeof (xTrapezoid
))
818 ntraps
/= sizeof (xTrapezoid
);
820 CompositeTrapezoids (stuff
->op
, pSrc
, pDst
, pFormat
,
821 stuff
->xSrc
, stuff
->ySrc
,
822 ntraps
, (xTrapezoid
*) &stuff
[1]);
823 return client
->noClientException
;
827 ProcRenderTriangles (ClientPtr client
)
830 PicturePtr pSrc
, pDst
;
831 PictFormatPtr pFormat
;
832 REQUEST(xRenderTrianglesReq
);
834 REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq
);
835 if (!PictOpValid (stuff
->op
))
837 client
->errorValue
= stuff
->op
;
840 VERIFY_PICTURE (pSrc
, stuff
->src
, client
, DixReadAccess
,
841 RenderErrBase
+ BadPicture
);
842 VERIFY_PICTURE (pDst
, stuff
->dst
, client
, DixWriteAccess
,
843 RenderErrBase
+ BadPicture
);
844 if (!pDst
->pDrawable
)
846 if (pSrc
->pDrawable
&& pSrc
->pDrawable
->pScreen
!= pDst
->pDrawable
->pScreen
)
848 if (stuff
->maskFormat
)
850 pFormat
= (PictFormatPtr
) SecurityLookupIDByType (client
,
856 client
->errorValue
= stuff
->maskFormat
;
857 return RenderErrBase
+ BadPictFormat
;
862 ntris
= (client
->req_len
<< 2) - sizeof (xRenderTrianglesReq
);
863 if (ntris
% sizeof (xTriangle
))
865 ntris
/= sizeof (xTriangle
);
867 CompositeTriangles (stuff
->op
, pSrc
, pDst
, pFormat
,
868 stuff
->xSrc
, stuff
->ySrc
,
869 ntris
, (xTriangle
*) &stuff
[1]);
870 return client
->noClientException
;
874 ProcRenderTriStrip (ClientPtr client
)
877 PicturePtr pSrc
, pDst
;
878 PictFormatPtr pFormat
;
879 REQUEST(xRenderTrianglesReq
);
881 REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq
);
882 if (!PictOpValid (stuff
->op
))
884 client
->errorValue
= stuff
->op
;
887 VERIFY_PICTURE (pSrc
, stuff
->src
, client
, DixReadAccess
,
888 RenderErrBase
+ BadPicture
);
889 VERIFY_PICTURE (pDst
, stuff
->dst
, client
, DixWriteAccess
,
890 RenderErrBase
+ BadPicture
);
891 if (!pDst
->pDrawable
)
893 if (pSrc
->pDrawable
&& pSrc
->pDrawable
->pScreen
!= pDst
->pDrawable
->pScreen
)
895 if (stuff
->maskFormat
)
897 pFormat
= (PictFormatPtr
) SecurityLookupIDByType (client
,
903 client
->errorValue
= stuff
->maskFormat
;
904 return RenderErrBase
+ BadPictFormat
;
909 npoints
= ((client
->req_len
<< 2) - sizeof (xRenderTriStripReq
));
914 CompositeTriStrip (stuff
->op
, pSrc
, pDst
, pFormat
,
915 stuff
->xSrc
, stuff
->ySrc
,
916 npoints
, (xPointFixed
*) &stuff
[1]);
917 return client
->noClientException
;
921 ProcRenderTriFan (ClientPtr client
)
924 PicturePtr pSrc
, pDst
;
925 PictFormatPtr pFormat
;
926 REQUEST(xRenderTrianglesReq
);
928 REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq
);
929 if (!PictOpValid (stuff
->op
))
931 client
->errorValue
= stuff
->op
;
934 VERIFY_PICTURE (pSrc
, stuff
->src
, client
, DixReadAccess
,
935 RenderErrBase
+ BadPicture
);
936 VERIFY_PICTURE (pDst
, stuff
->dst
, client
, DixWriteAccess
,
937 RenderErrBase
+ BadPicture
);
938 if (!pDst
->pDrawable
)
940 if (pSrc
->pDrawable
&& pSrc
->pDrawable
->pScreen
!= pDst
->pDrawable
->pScreen
)
942 if (stuff
->maskFormat
)
944 pFormat
= (PictFormatPtr
) SecurityLookupIDByType (client
,
950 client
->errorValue
= stuff
->maskFormat
;
951 return RenderErrBase
+ BadPictFormat
;
956 npoints
= ((client
->req_len
<< 2) - sizeof (xRenderTriStripReq
));
961 CompositeTriFan (stuff
->op
, pSrc
, pDst
, pFormat
,
962 stuff
->xSrc
, stuff
->ySrc
,
963 npoints
, (xPointFixed
*) &stuff
[1]);
964 return client
->noClientException
;
968 ProcRenderColorTrapezoids (ClientPtr client
)
970 return BadImplementation
;
974 ProcRenderColorTriangles (ClientPtr client
)
976 return BadImplementation
;
980 ProcRenderTransform (ClientPtr client
)
982 return BadImplementation
;
986 ProcRenderCreateGlyphSet (ClientPtr client
)
988 GlyphSetPtr glyphSet
;
989 PictFormatPtr format
;
991 REQUEST(xRenderCreateGlyphSetReq
);
993 REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq
);
995 LEGAL_NEW_RESOURCE(stuff
->gsid
, client
);
996 format
= (PictFormatPtr
) SecurityLookupIDByType (client
,
1002 client
->errorValue
= stuff
->format
;
1003 return RenderErrBase
+ BadPictFormat
;
1005 switch (format
->depth
) {
1024 if (format
->type
!= PictTypeDirect
)
1026 glyphSet
= AllocateGlyphSet (f
, format
);
1029 if (!AddResource (stuff
->gsid
, GlyphSetType
, (pointer
)glyphSet
))
1035 ProcRenderReferenceGlyphSet (ClientPtr client
)
1037 GlyphSetPtr glyphSet
;
1038 REQUEST(xRenderReferenceGlyphSetReq
);
1040 REQUEST_SIZE_MATCH(xRenderReferenceGlyphSetReq
);
1042 LEGAL_NEW_RESOURCE(stuff
->gsid
, client
);
1044 glyphSet
= (GlyphSetPtr
) SecurityLookupIDByType (client
,
1050 client
->errorValue
= stuff
->existing
;
1051 return RenderErrBase
+ BadGlyphSet
;
1054 if (!AddResource (stuff
->gsid
, GlyphSetType
, (pointer
)glyphSet
))
1056 return client
->noClientException
;
1059 #define NLOCALDELTA 64
1060 #define NLOCALGLYPH 256
1063 ProcRenderFreeGlyphSet (ClientPtr client
)
1065 GlyphSetPtr glyphSet
;
1066 REQUEST(xRenderFreeGlyphSetReq
);
1068 REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq
);
1069 glyphSet
= (GlyphSetPtr
) SecurityLookupIDByType (client
,
1075 client
->errorValue
= stuff
->glyphset
;
1076 return RenderErrBase
+ BadGlyphSet
;
1078 FreeResource (stuff
->glyphset
, RT_NONE
);
1079 return client
->noClientException
;
1082 typedef struct _GlyphNew
{
1085 } GlyphNewRec
, *GlyphNewPtr
;
1088 ProcRenderAddGlyphs (ClientPtr client
)
1090 GlyphSetPtr glyphSet
;
1091 REQUEST(xRenderAddGlyphsReq
);
1092 GlyphNewRec glyphsLocal
[NLOCALGLYPH
];
1093 GlyphNewPtr glyphsBase
, glyphs
;
1095 int remain
, nglyphs
;
1102 REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq
);
1103 glyphSet
= (GlyphSetPtr
) SecurityLookupIDByType (client
,
1109 client
->errorValue
= stuff
->glyphset
;
1110 return RenderErrBase
+ BadGlyphSet
;
1113 nglyphs
= stuff
->nglyphs
;
1114 if (nglyphs
> UINT32_MAX
/ sizeof(GlyphNewRec
))
1117 if (nglyphs
<= NLOCALGLYPH
)
1118 glyphsBase
= glyphsLocal
;
1121 glyphsBase
= (GlyphNewPtr
) Xalloc (nglyphs
* sizeof (GlyphNewRec
));
1126 remain
= (client
->req_len
<< 2) - sizeof (xRenderAddGlyphsReq
);
1128 glyphs
= glyphsBase
;
1130 gids
= (CARD32
*) (stuff
+ 1);
1131 gi
= (xGlyphInfo
*) (gids
+ nglyphs
);
1132 bits
= (CARD8
*) (gi
+ nglyphs
);
1133 remain
-= (sizeof (CARD32
) + sizeof (xGlyphInfo
)) * nglyphs
;
1134 while (remain
>= 0 && nglyphs
)
1136 glyph
= AllocateGlyph (gi
, glyphSet
->fdepth
);
1143 glyphs
->glyph
= glyph
;
1146 size
= glyph
->size
- sizeof (xGlyphInfo
);
1149 memcpy ((CARD8
*) (glyph
+ 1), bits
, size
);
1152 size
+= 4 - (size
& 3);
1160 if (nglyphs
|| remain
)
1165 nglyphs
= stuff
->nglyphs
;
1166 if (!ResizeGlyphSet (glyphSet
, nglyphs
))
1171 glyphs
= glyphsBase
;
1173 AddGlyph (glyphSet
, glyphs
->glyph
, glyphs
->id
);
1177 if (glyphsBase
!= glyphsLocal
)
1179 return client
->noClientException
;
1181 while (glyphs
!= glyphsBase
)
1184 xfree (glyphs
->glyph
);
1186 if (glyphsBase
!= glyphsLocal
)
1192 ProcRenderAddGlyphsFromPicture (ClientPtr client
)
1194 return BadImplementation
;
1198 ProcRenderFreeGlyphs (ClientPtr client
)
1200 REQUEST(xRenderFreeGlyphsReq
);
1201 GlyphSetPtr glyphSet
;
1206 REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq
);
1207 glyphSet
= (GlyphSetPtr
) SecurityLookupIDByType (client
,
1213 client
->errorValue
= stuff
->glyphset
;
1214 return RenderErrBase
+ BadGlyphSet
;
1216 nglyph
= ((client
->req_len
<< 2) - sizeof (xRenderFreeGlyphsReq
)) >> 2;
1217 gids
= (CARD32
*) (stuff
+ 1);
1218 while (nglyph
-- > 0)
1221 if (!DeleteGlyph (glyphSet
, glyph
))
1223 client
->errorValue
= glyph
;
1224 return RenderErrBase
+ BadGlyph
;
1227 return client
->noClientException
;
1231 ProcRenderCompositeGlyphs (ClientPtr client
)
1233 GlyphSetPtr glyphSet
;
1235 PicturePtr pSrc
, pDst
;
1236 PictFormatPtr pFormat
;
1237 GlyphListRec listsLocal
[NLOCALDELTA
];
1238 GlyphListPtr lists
, listsBase
;
1239 GlyphPtr glyphsLocal
[NLOCALGLYPH
];
1241 GlyphPtr
*glyphs
, *glyphsBase
;
1243 CARD8
*buffer
, *end
;
1250 REQUEST(xRenderCompositeGlyphsReq
);
1252 REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq
);
1254 switch (stuff
->renderReqType
) {
1255 default: size
= 1; break;
1256 case X_RenderCompositeGlyphs16
: size
= 2; break;
1257 case X_RenderCompositeGlyphs32
: size
= 4; break;
1260 if (!PictOpValid (stuff
->op
))
1262 client
->errorValue
= stuff
->op
;
1265 VERIFY_PICTURE (pSrc
, stuff
->src
, client
, DixReadAccess
,
1266 RenderErrBase
+ BadPicture
);
1267 VERIFY_PICTURE (pDst
, stuff
->dst
, client
, DixWriteAccess
,
1268 RenderErrBase
+ BadPicture
);
1269 if (!pDst
->pDrawable
)
1271 if (pSrc
->pDrawable
&& pSrc
->pDrawable
->pScreen
!= pDst
->pDrawable
->pScreen
)
1273 if (stuff
->maskFormat
)
1275 pFormat
= (PictFormatPtr
) SecurityLookupIDByType (client
,
1281 client
->errorValue
= stuff
->maskFormat
;
1282 return RenderErrBase
+ BadPictFormat
;
1288 glyphSet
= (GlyphSetPtr
) SecurityLookupIDByType (client
,
1294 client
->errorValue
= stuff
->glyphset
;
1295 return RenderErrBase
+ BadGlyphSet
;
1298 buffer
= (CARD8
*) (stuff
+ 1);
1299 end
= (CARD8
*) stuff
+ (client
->req_len
<< 2);
1302 while (buffer
+ sizeof (xGlyphElt
) < end
)
1304 elt
= (xGlyphElt
*) buffer
;
1305 buffer
+= sizeof (xGlyphElt
);
1307 if (elt
->len
== 0xff)
1315 space
= size
* elt
->len
;
1317 space
+= 4 - (space
& 3);
1321 if (nglyph
<= NLOCALGLYPH
)
1322 glyphsBase
= glyphsLocal
;
1325 glyphsBase
= (GlyphPtr
*) ALLOCATE_LOCAL (nglyph
* sizeof (GlyphPtr
));
1329 if (nlist
<= NLOCALDELTA
)
1330 listsBase
= listsLocal
;
1333 listsBase
= (GlyphListPtr
) ALLOCATE_LOCAL (nlist
* sizeof (GlyphListRec
));
1337 buffer
= (CARD8
*) (stuff
+ 1);
1338 glyphs
= glyphsBase
;
1340 while (buffer
+ sizeof (xGlyphElt
) < end
)
1342 elt
= (xGlyphElt
*) buffer
;
1343 buffer
+= sizeof (xGlyphElt
);
1345 if (elt
->len
== 0xff)
1347 if (buffer
+ sizeof (GlyphSet
) < end
)
1349 memcpy(&gs
, buffer
, sizeof(GlyphSet
));
1350 glyphSet
= (GlyphSetPtr
) SecurityLookupIDByType (client
,
1356 client
->errorValue
= gs
;
1357 if (glyphsBase
!= glyphsLocal
)
1358 DEALLOCATE_LOCAL (glyphsBase
);
1359 if (listsBase
!= listsLocal
)
1360 DEALLOCATE_LOCAL (listsBase
);
1361 return RenderErrBase
+ BadGlyphSet
;
1368 lists
->xOff
= elt
->deltax
;
1369 lists
->yOff
= elt
->deltay
;
1370 lists
->format
= glyphSet
->format
;
1375 if (buffer
+ size
<= end
)
1379 glyph
= *((CARD8
*)buffer
); break;
1381 glyph
= *((CARD16
*)buffer
); break;
1384 glyph
= *((CARD32
*)buffer
); break;
1386 if ((*glyphs
= FindGlyph (glyphSet
, glyph
)))
1394 space
= size
* elt
->len
;
1396 buffer
+= 4 - (space
& 3);
1403 CompositeGlyphs (stuff
->op
,
1413 if (glyphsBase
!= glyphsLocal
)
1414 DEALLOCATE_LOCAL (glyphsBase
);
1415 if (listsBase
!= listsLocal
)
1416 DEALLOCATE_LOCAL (listsBase
);
1418 return client
->noClientException
;
1422 ProcRenderFillRectangles (ClientPtr client
)
1426 REQUEST(xRenderFillRectanglesReq
);
1428 REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq
);
1429 if (!PictOpValid (stuff
->op
))
1431 client
->errorValue
= stuff
->op
;
1434 VERIFY_PICTURE (pDst
, stuff
->dst
, client
, DixWriteAccess
,
1435 RenderErrBase
+ BadPicture
);
1436 if (!pDst
->pDrawable
)
1439 things
= (client
->req_len
<< 2) - sizeof(xRenderFillRectanglesReq
);
1444 CompositeRects (stuff
->op
,
1448 (xRectangle
*) &stuff
[1]);
1450 return client
->noClientException
;
1454 SetBit (unsigned char *line
, int x
, int bit
)
1458 if (screenInfo
.bitmapBitOrder
== LSBFirst
)
1459 mask
= (1 << (x
& 7));
1461 mask
= (0x80 >> (x
& 7));
1462 /* XXX assumes byte order is host byte order */
1470 #define DITHER_DIM 2
1472 static CARD32 orderedDither
[DITHER_DIM
][DITHER_DIM
] = {
1477 #define DITHER_SIZE ((sizeof orderedDither / sizeof orderedDither[0][0]) + 1)
1480 ProcRenderCreateCursor (ClientPtr client
)
1482 REQUEST(xRenderCreateCursorReq
);
1485 unsigned short width
, height
;
1486 CARD32
*argbbits
, *argb
;
1487 unsigned char *srcbits
, *srcline
;
1488 unsigned char *mskbits
, *mskline
;
1497 REQUEST_SIZE_MATCH (xRenderCreateCursorReq
);
1498 LEGAL_NEW_RESOURCE(stuff
->cid
, client
);
1500 VERIFY_PICTURE (pSrc
, stuff
->src
, client
, DixReadAccess
,
1501 RenderErrBase
+ BadPicture
);
1502 if (!pSrc
->pDrawable
)
1504 pScreen
= pSrc
->pDrawable
->pScreen
;
1505 width
= pSrc
->pDrawable
->width
;
1506 height
= pSrc
->pDrawable
->height
;
1507 if ( stuff
->x
> width
1508 || stuff
->y
> height
)
1510 argbbits
= xalloc (width
* height
* sizeof (CARD32
));
1514 stride
= BitmapBytePad(width
);
1515 nbytes_mono
= stride
*height
;
1516 srcbits
= (unsigned char *)xalloc(nbytes_mono
);
1522 mskbits
= (unsigned char *)xalloc(nbytes_mono
);
1529 bzero ((char *) mskbits
, nbytes_mono
);
1530 bzero ((char *) srcbits
, nbytes_mono
);
1532 if (pSrc
->format
== PICT_a8r8g8b8
)
1534 (*pScreen
->GetImage
) (pSrc
->pDrawable
,
1535 0, 0, width
, height
, ZPixmap
,
1536 0xffffffff, (pointer
) argbbits
);
1541 PicturePtr pPicture
;
1542 PictFormatPtr pFormat
;
1545 pFormat
= PictureMatchFormat (pScreen
, 32, PICT_a8r8g8b8
);
1551 return (BadImplementation
);
1553 pPixmap
= (*pScreen
->CreatePixmap
) (pScreen
, width
, height
, 32);
1561 pPicture
= CreatePicture (0, &pPixmap
->drawable
, pFormat
, 0, 0,
1570 (*pScreen
->DestroyPixmap
) (pPixmap
);
1571 CompositePicture (PictOpSrc
,
1573 0, 0, 0, 0, 0, 0, width
, height
);
1574 (*pScreen
->GetImage
) (pPicture
->pDrawable
,
1575 0, 0, width
, height
, ZPixmap
,
1576 0xffffffff, (pointer
) argbbits
);
1577 FreePicture (pPicture
, 0);
1580 * Check whether the cursor can be directly supported by
1581 * the core cursor code
1585 for (y
= 0; ncolor
<= 2 && y
< height
; y
++)
1587 for (x
= 0; ncolor
<= 2 && x
< width
; x
++)
1590 CARD32 a
= (p
>> 24);
1592 if (a
== 0) /* transparent */
1594 if (a
== 0xff) /* opaque */
1597 for (n
= 0; n
< ncolor
; n
++)
1598 if (p
== twocolor
[n
])
1601 twocolor
[ncolor
++] = p
;
1609 * Convert argb image to two plane cursor
1614 for (y
= 0; y
< height
; y
++)
1616 for (x
= 0; x
< width
; x
++)
1622 CARD32 a
= ((p
>> 24));
1624 SetBit (mskline
, x
, a
!= 0);
1625 SetBit (srcline
, x
, a
!= 0 && p
== twocolor
[0]);
1629 CARD32 a
= ((p
>> 24) * DITHER_SIZE
+ 127) / 255;
1630 CARD32 i
= ((CvtR8G8B8toY15(p
) >> 7) * DITHER_SIZE
+ 127) / 255;
1631 CARD32 d
= orderedDither
[y
&(DITHER_DIM
-1)][x
&(DITHER_DIM
-1)];
1632 /* Set mask from dithered alpha value */
1633 SetBit(mskline
, x
, a
> d
);
1634 /* Set src from dithered intensity value */
1635 SetBit(srcline
, x
, a
> d
&& i
<= d
);
1642 * Dither to white and black if the cursor has more than two colors
1646 twocolor
[0] = 0xff000000;
1647 twocolor
[1] = 0xffffffff;
1655 #define GetByte(p,s) (((p) >> (s)) & 0xff)
1656 #define GetColor(p,s) (GetByte(p,s) | (GetByte(p,s) << 8))
1662 pCursor
= AllocCursorARGB (srcbits
, mskbits
, argbbits
, &cm
,
1663 GetColor(twocolor
[0], 16),
1664 GetColor(twocolor
[0], 8),
1665 GetColor(twocolor
[0], 0),
1666 GetColor(twocolor
[1], 16),
1667 GetColor(twocolor
[1], 8),
1668 GetColor(twocolor
[1], 0));
1669 if (pCursor
&& AddResource(stuff
->cid
, RT_CURSOR
, (pointer
)pCursor
))
1670 return (client
->noClientException
);
1675 ProcRenderSetPictureTransform (ClientPtr client
)
1677 REQUEST(xRenderSetPictureTransformReq
);
1678 PicturePtr pPicture
;
1681 REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq
);
1682 VERIFY_PICTURE (pPicture
, stuff
->picture
, client
, DixWriteAccess
,
1683 RenderErrBase
+ BadPicture
);
1684 result
= SetPictureTransform (pPicture
, (PictTransform
*) &stuff
->transform
);
1685 if (client
->noClientException
!= Success
)
1686 return(client
->noClientException
);
1692 ProcRenderQueryFilters (ClientPtr client
)
1694 REQUEST (xRenderQueryFiltersReq
);
1695 DrawablePtr pDrawable
;
1696 xRenderQueryFiltersReply
*reply
;
1700 PictureScreenPtr ps
;
1701 int i
, j
, len
, total_bytes
, rc
;
1705 REQUEST_SIZE_MATCH(xRenderQueryFiltersReq
);
1706 rc
= dixLookupDrawable(&pDrawable
, stuff
->drawable
, client
, 0,
1711 pScreen
= pDrawable
->pScreen
;
1714 ps
= GetPictureScreenIfSet(pScreen
);
1717 for (i
= 0; i
< ps
->nfilters
; i
++)
1718 nbytesName
+= 1 + strlen (ps
->filters
[i
].name
);
1719 for (i
= 0; i
< ps
->nfilterAliases
; i
++)
1720 nbytesName
+= 1 + strlen (ps
->filterAliases
[i
].alias
);
1721 nnames
= ps
->nfilters
+ ps
->nfilterAliases
;
1723 len
= ((nnames
+ 1) >> 1) + ((nbytesName
+ 3) >> 2);
1724 total_bytes
= sizeof (xRenderQueryFiltersReply
) + (len
<< 2);
1725 reply
= (xRenderQueryFiltersReply
*) xalloc (total_bytes
);
1728 aliases
= (INT16
*) (reply
+ 1);
1729 names
= (char *) (aliases
+ ((nnames
+ 1) & ~1));
1731 reply
->type
= X_Reply
;
1732 reply
->sequenceNumber
= client
->sequence
;
1733 reply
->length
= len
;
1734 reply
->numAliases
= nnames
;
1735 reply
->numFilters
= nnames
;
1739 /* fill in alias values */
1740 for (i
= 0; i
< ps
->nfilters
; i
++)
1741 aliases
[i
] = FilterAliasNone
;
1742 for (i
= 0; i
< ps
->nfilterAliases
; i
++)
1744 for (j
= 0; j
< ps
->nfilters
; j
++)
1745 if (ps
->filterAliases
[i
].filter_id
== ps
->filters
[j
].id
)
1747 if (j
== ps
->nfilters
)
1749 for (j
= 0; j
< ps
->nfilterAliases
; j
++)
1750 if (ps
->filterAliases
[i
].filter_id
==
1751 ps
->filterAliases
[j
].alias_id
)
1755 if (j
== ps
->nfilterAliases
)
1756 j
= FilterAliasNone
;
1758 j
= j
+ ps
->nfilters
;
1760 aliases
[i
+ ps
->nfilters
] = j
;
1763 /* fill in filter names */
1764 for (i
= 0; i
< ps
->nfilters
; i
++)
1766 j
= strlen (ps
->filters
[i
].name
);
1768 strncpy (names
, ps
->filters
[i
].name
, j
);
1772 /* fill in filter alias names */
1773 for (i
= 0; i
< ps
->nfilterAliases
; i
++)
1775 j
= strlen (ps
->filterAliases
[i
].alias
);
1777 strncpy (names
, ps
->filterAliases
[i
].alias
, j
);
1782 if (client
->swapped
)
1786 for (i
= 0; i
< reply
->numAliases
; i
++)
1788 swaps (&aliases
[i
], n
);
1790 swaps(&reply
->sequenceNumber
, n
);
1791 swapl(&reply
->length
, n
);
1792 swapl(&reply
->numAliases
, n
);
1793 swapl(&reply
->numFilters
, n
);
1795 WriteToClient(client
, total_bytes
, (char *) reply
);
1798 return(client
->noClientException
);
1802 ProcRenderSetPictureFilter (ClientPtr client
)
1804 REQUEST (xRenderSetPictureFilterReq
);
1805 PicturePtr pPicture
;
1811 REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq
);
1812 VERIFY_PICTURE (pPicture
, stuff
->picture
, client
, DixWriteAccess
,
1813 RenderErrBase
+ BadPicture
);
1814 name
= (char *) (stuff
+ 1);
1815 params
= (xFixed
*) (name
+ ((stuff
->nbytes
+ 3) & ~3));
1816 nparams
= ((xFixed
*) stuff
+ client
->req_len
) - params
;
1817 result
= SetPictureFilter (pPicture
, name
, stuff
->nbytes
, params
, nparams
);
1822 ProcRenderCreateAnimCursor (ClientPtr client
)
1824 REQUEST(xRenderCreateAnimCursorReq
);
1829 xAnimCursorElt
*elt
;
1833 REQUEST_AT_LEAST_SIZE(xRenderCreateAnimCursorReq
);
1834 LEGAL_NEW_RESOURCE(stuff
->cid
, client
);
1835 if (client
->req_len
& 1)
1837 ncursor
= (client
->req_len
- (SIZEOF(xRenderCreateAnimCursorReq
) >> 2)) >> 1;
1838 cursors
= xalloc (ncursor
* (sizeof (CursorPtr
) + sizeof (CARD32
)));
1841 deltas
= (CARD32
*) (cursors
+ ncursor
);
1842 elt
= (xAnimCursorElt
*) (stuff
+ 1);
1843 for (i
= 0; i
< ncursor
; i
++)
1845 cursors
[i
] = (CursorPtr
)SecurityLookupIDByType(client
, elt
->cursor
,
1846 RT_CURSOR
, DixReadAccess
);
1850 client
->errorValue
= elt
->cursor
;
1853 deltas
[i
] = elt
->delay
;
1856 ret
= AnimCursorCreate (cursors
, deltas
, ncursor
, &pCursor
);
1861 if (AddResource (stuff
->cid
, RT_CURSOR
, (pointer
)pCursor
))
1862 return client
->noClientException
;
1867 ProcRenderAddTraps (ClientPtr client
)
1870 PicturePtr pPicture
;
1871 REQUEST(xRenderAddTrapsReq
);
1873 REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq
);
1874 VERIFY_PICTURE (pPicture
, stuff
->picture
, client
, DixWriteAccess
,
1875 RenderErrBase
+ BadPicture
);
1876 if (!pPicture
->pDrawable
)
1878 ntraps
= (client
->req_len
<< 2) - sizeof (xRenderAddTrapsReq
);
1879 if (ntraps
% sizeof (xTrap
))
1881 ntraps
/= sizeof (xTrap
);
1884 stuff
->xOff
, stuff
->yOff
,
1885 ntraps
, (xTrap
*) &stuff
[1]);
1886 return client
->noClientException
;
1889 static int ProcRenderCreateSolidFill(ClientPtr client
)
1891 PicturePtr pPicture
;
1893 REQUEST(xRenderCreateSolidFillReq
);
1895 REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq
);
1897 LEGAL_NEW_RESOURCE(stuff
->pid
, client
);
1899 pPicture
= CreateSolidPicture(stuff
->pid
, &stuff
->color
, &error
);
1902 if (!AddResource (stuff
->pid
, PictureType
, (pointer
)pPicture
))
1907 static int ProcRenderCreateLinearGradient (ClientPtr client
)
1909 PicturePtr pPicture
;
1913 xRenderColor
*colors
;
1914 REQUEST(xRenderCreateLinearGradientReq
);
1916 REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq
);
1918 LEGAL_NEW_RESOURCE(stuff
->pid
, client
);
1920 len
= (client
->req_len
<< 2) - sizeof(xRenderCreateLinearGradientReq
);
1921 if (len
!= stuff
->nStops
*(sizeof(xFixed
) + sizeof(xRenderColor
)))
1924 stops
= (xFixed
*)(stuff
+ 1);
1925 colors
= (xRenderColor
*)(stops
+ stuff
->nStops
);
1927 pPicture
= CreateLinearGradientPicture (stuff
->pid
, &stuff
->p1
, &stuff
->p2
,
1928 stuff
->nStops
, stops
, colors
, &error
);
1931 if (!AddResource (stuff
->pid
, PictureType
, (pointer
)pPicture
))
1936 static int ProcRenderCreateRadialGradient (ClientPtr client
)
1938 PicturePtr pPicture
;
1942 xRenderColor
*colors
;
1943 REQUEST(xRenderCreateRadialGradientReq
);
1945 REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq
);
1947 LEGAL_NEW_RESOURCE(stuff
->pid
, client
);
1949 len
= (client
->req_len
<< 2) - sizeof(xRenderCreateRadialGradientReq
);
1950 if (len
!= stuff
->nStops
*(sizeof(xFixed
) + sizeof(xRenderColor
)))
1953 stops
= (xFixed
*)(stuff
+ 1);
1954 colors
= (xRenderColor
*)(stops
+ stuff
->nStops
);
1956 pPicture
= CreateRadialGradientPicture (stuff
->pid
, &stuff
->inner
, &stuff
->outer
,
1957 stuff
->inner_radius
, stuff
->outer_radius
,
1958 stuff
->nStops
, stops
, colors
, &error
);
1961 if (!AddResource (stuff
->pid
, PictureType
, (pointer
)pPicture
))
1966 static int ProcRenderCreateConicalGradient (ClientPtr client
)
1968 PicturePtr pPicture
;
1972 xRenderColor
*colors
;
1973 REQUEST(xRenderCreateConicalGradientReq
);
1975 REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq
);
1977 LEGAL_NEW_RESOURCE(stuff
->pid
, client
);
1979 len
= (client
->req_len
<< 2) - sizeof(xRenderCreateConicalGradientReq
);
1980 if (len
!= stuff
->nStops
*(sizeof(xFixed
) + sizeof(xRenderColor
)))
1983 stops
= (xFixed
*)(stuff
+ 1);
1984 colors
= (xRenderColor
*)(stops
+ stuff
->nStops
);
1986 pPicture
= CreateConicalGradientPicture (stuff
->pid
, &stuff
->center
, stuff
->angle
,
1987 stuff
->nStops
, stops
, colors
, &error
);
1990 if (!AddResource (stuff
->pid
, PictureType
, (pointer
)pPicture
))
1997 ProcRenderDispatch (ClientPtr client
)
2001 if (stuff
->data
< RenderNumberRequests
)
2002 return (*ProcRenderVector
[stuff
->data
]) (client
);
2008 SProcRenderQueryVersion (ClientPtr client
)
2011 REQUEST(xRenderQueryVersionReq
);
2013 swaps(&stuff
->length
, n
);
2014 swapl(&stuff
->majorVersion
, n
);
2015 swapl(&stuff
->minorVersion
, n
);
2016 return (*ProcRenderVector
[stuff
->renderReqType
])(client
);
2020 SProcRenderQueryPictFormats (ClientPtr client
)
2023 REQUEST(xRenderQueryPictFormatsReq
);
2024 swaps(&stuff
->length
, n
);
2025 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2029 SProcRenderQueryPictIndexValues (ClientPtr client
)
2032 REQUEST(xRenderQueryPictIndexValuesReq
);
2033 swaps(&stuff
->length
, n
);
2034 swapl(&stuff
->format
, n
);
2035 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2039 SProcRenderQueryDithers (ClientPtr client
)
2041 return BadImplementation
;
2045 SProcRenderCreatePicture (ClientPtr client
)
2048 REQUEST(xRenderCreatePictureReq
);
2049 swaps(&stuff
->length
, n
);
2050 swapl(&stuff
->pid
, n
);
2051 swapl(&stuff
->drawable
, n
);
2052 swapl(&stuff
->format
, n
);
2053 swapl(&stuff
->mask
, n
);
2055 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2059 SProcRenderChangePicture (ClientPtr client
)
2062 REQUEST(xRenderChangePictureReq
);
2063 swaps(&stuff
->length
, n
);
2064 swapl(&stuff
->picture
, n
);
2065 swapl(&stuff
->mask
, n
);
2067 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2071 SProcRenderSetPictureClipRectangles (ClientPtr client
)
2074 REQUEST(xRenderSetPictureClipRectanglesReq
);
2075 swaps(&stuff
->length
, n
);
2076 swapl(&stuff
->picture
, n
);
2077 swaps(&stuff
->xOrigin
, n
);
2078 swaps(&stuff
->yOrigin
, n
);
2080 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2084 SProcRenderFreePicture (ClientPtr client
)
2087 REQUEST(xRenderFreePictureReq
);
2088 swaps(&stuff
->length
, n
);
2089 swapl(&stuff
->picture
, n
);
2090 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2094 SProcRenderComposite (ClientPtr client
)
2097 REQUEST(xRenderCompositeReq
);
2098 swaps(&stuff
->length
, n
);
2099 swapl(&stuff
->src
, n
);
2100 swapl(&stuff
->mask
, n
);
2101 swapl(&stuff
->dst
, n
);
2102 swaps(&stuff
->xSrc
, n
);
2103 swaps(&stuff
->ySrc
, n
);
2104 swaps(&stuff
->xMask
, n
);
2105 swaps(&stuff
->yMask
, n
);
2106 swaps(&stuff
->xDst
, n
);
2107 swaps(&stuff
->yDst
, n
);
2108 swaps(&stuff
->width
, n
);
2109 swaps(&stuff
->height
, n
);
2110 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2114 SProcRenderScale (ClientPtr client
)
2117 REQUEST(xRenderScaleReq
);
2118 swaps(&stuff
->length
, n
);
2119 swapl(&stuff
->src
, n
);
2120 swapl(&stuff
->dst
, n
);
2121 swapl(&stuff
->colorScale
, n
);
2122 swapl(&stuff
->alphaScale
, n
);
2123 swaps(&stuff
->xSrc
, n
);
2124 swaps(&stuff
->ySrc
, n
);
2125 swaps(&stuff
->xDst
, n
);
2126 swaps(&stuff
->yDst
, n
);
2127 swaps(&stuff
->width
, n
);
2128 swaps(&stuff
->height
, n
);
2129 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2133 SProcRenderTrapezoids (ClientPtr client
)
2136 REQUEST(xRenderTrapezoidsReq
);
2138 REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq
);
2139 swaps (&stuff
->length
, n
);
2140 swapl (&stuff
->src
, n
);
2141 swapl (&stuff
->dst
, n
);
2142 swapl (&stuff
->maskFormat
, n
);
2143 swaps (&stuff
->xSrc
, n
);
2144 swaps (&stuff
->ySrc
, n
);
2146 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2150 SProcRenderTriangles (ClientPtr client
)
2153 REQUEST(xRenderTrianglesReq
);
2155 REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq
);
2156 swaps (&stuff
->length
, n
);
2157 swapl (&stuff
->src
, n
);
2158 swapl (&stuff
->dst
, n
);
2159 swapl (&stuff
->maskFormat
, n
);
2160 swaps (&stuff
->xSrc
, n
);
2161 swaps (&stuff
->ySrc
, n
);
2163 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2167 SProcRenderTriStrip (ClientPtr client
)
2170 REQUEST(xRenderTriStripReq
);
2172 REQUEST_AT_LEAST_SIZE(xRenderTriStripReq
);
2173 swaps (&stuff
->length
, n
);
2174 swapl (&stuff
->src
, n
);
2175 swapl (&stuff
->dst
, n
);
2176 swapl (&stuff
->maskFormat
, n
);
2177 swaps (&stuff
->xSrc
, n
);
2178 swaps (&stuff
->ySrc
, n
);
2180 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2184 SProcRenderTriFan (ClientPtr client
)
2187 REQUEST(xRenderTriFanReq
);
2189 REQUEST_AT_LEAST_SIZE(xRenderTriFanReq
);
2190 swaps (&stuff
->length
, n
);
2191 swapl (&stuff
->src
, n
);
2192 swapl (&stuff
->dst
, n
);
2193 swapl (&stuff
->maskFormat
, n
);
2194 swaps (&stuff
->xSrc
, n
);
2195 swaps (&stuff
->ySrc
, n
);
2197 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2201 SProcRenderColorTrapezoids (ClientPtr client
)
2203 return BadImplementation
;
2207 SProcRenderColorTriangles (ClientPtr client
)
2209 return BadImplementation
;
2213 SProcRenderTransform (ClientPtr client
)
2215 return BadImplementation
;
2219 SProcRenderCreateGlyphSet (ClientPtr client
)
2222 REQUEST(xRenderCreateGlyphSetReq
);
2223 swaps(&stuff
->length
, n
);
2224 swapl(&stuff
->gsid
, n
);
2225 swapl(&stuff
->format
, n
);
2226 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2230 SProcRenderReferenceGlyphSet (ClientPtr client
)
2233 REQUEST(xRenderReferenceGlyphSetReq
);
2234 swaps(&stuff
->length
, n
);
2235 swapl(&stuff
->gsid
, n
);
2236 swapl(&stuff
->existing
, n
);
2237 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2241 SProcRenderFreeGlyphSet (ClientPtr client
)
2244 REQUEST(xRenderFreeGlyphSetReq
);
2245 swaps(&stuff
->length
, n
);
2246 swapl(&stuff
->glyphset
, n
);
2247 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2251 SProcRenderAddGlyphs (ClientPtr client
)
2258 REQUEST(xRenderAddGlyphsReq
);
2259 swaps(&stuff
->length
, n
);
2260 swapl(&stuff
->glyphset
, n
);
2261 swapl(&stuff
->nglyphs
, n
);
2262 if (stuff
->nglyphs
& 0xe0000000)
2264 end
= (CARD8
*) stuff
+ (client
->req_len
<< 2);
2265 gids
= (CARD32
*) (stuff
+ 1);
2266 gi
= (xGlyphInfo
*) (gids
+ stuff
->nglyphs
);
2267 if ((char *) end
- (char *) (gids
+ stuff
->nglyphs
) < 0)
2269 if ((char *) end
- (char *) (gi
+ stuff
->nglyphs
) < 0)
2271 for (i
= 0; i
< stuff
->nglyphs
; i
++)
2273 swapl (&gids
[i
], n
);
2274 swaps (&gi
[i
].width
, n
);
2275 swaps (&gi
[i
].height
, n
);
2276 swaps (&gi
[i
].x
, n
);
2277 swaps (&gi
[i
].y
, n
);
2278 swaps (&gi
[i
].xOff
, n
);
2279 swaps (&gi
[i
].yOff
, n
);
2281 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2285 SProcRenderAddGlyphsFromPicture (ClientPtr client
)
2287 return BadImplementation
;
2291 SProcRenderFreeGlyphs (ClientPtr client
)
2294 REQUEST(xRenderFreeGlyphsReq
);
2295 swaps(&stuff
->length
, n
);
2296 swapl(&stuff
->glyphset
, n
);
2298 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2302 SProcRenderCompositeGlyphs (ClientPtr client
)
2312 REQUEST(xRenderCompositeGlyphsReq
);
2314 switch (stuff
->renderReqType
) {
2315 default: size
= 1; break;
2316 case X_RenderCompositeGlyphs16
: size
= 2; break;
2317 case X_RenderCompositeGlyphs32
: size
= 4; break;
2320 swaps(&stuff
->length
, n
);
2321 swapl(&stuff
->src
, n
);
2322 swapl(&stuff
->dst
, n
);
2323 swapl(&stuff
->maskFormat
, n
);
2324 swapl(&stuff
->glyphset
, n
);
2325 swaps(&stuff
->xSrc
, n
);
2326 swaps(&stuff
->ySrc
, n
);
2327 buffer
= (CARD8
*) (stuff
+ 1);
2328 end
= (CARD8
*) stuff
+ (client
->req_len
<< 2);
2329 while (buffer
+ sizeof (xGlyphElt
) < end
)
2331 elt
= (xGlyphElt
*) buffer
;
2332 buffer
+= sizeof (xGlyphElt
);
2334 swaps (&elt
->deltax
, n
);
2335 swaps (&elt
->deltay
, n
);
2366 buffer
+= 4 - (space
& 3);
2369 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2373 SProcRenderFillRectangles (ClientPtr client
)
2376 REQUEST(xRenderFillRectanglesReq
);
2378 REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq
);
2379 swaps(&stuff
->length
, n
);
2380 swapl(&stuff
->dst
, n
);
2381 swaps(&stuff
->color
.red
, n
);
2382 swaps(&stuff
->color
.green
, n
);
2383 swaps(&stuff
->color
.blue
, n
);
2384 swaps(&stuff
->color
.alpha
, n
);
2386 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2390 SProcRenderCreateCursor (ClientPtr client
)
2393 REQUEST(xRenderCreateCursorReq
);
2394 REQUEST_SIZE_MATCH (xRenderCreateCursorReq
);
2396 swaps(&stuff
->length
, n
);
2397 swapl(&stuff
->cid
, n
);
2398 swapl(&stuff
->src
, n
);
2399 swaps(&stuff
->x
, n
);
2400 swaps(&stuff
->y
, n
);
2401 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2405 SProcRenderSetPictureTransform (ClientPtr client
)
2408 REQUEST(xRenderSetPictureTransformReq
);
2409 REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq
);
2411 swaps(&stuff
->length
, n
);
2412 swapl(&stuff
->picture
, n
);
2413 swapl(&stuff
->transform
.matrix11
, n
);
2414 swapl(&stuff
->transform
.matrix12
, n
);
2415 swapl(&stuff
->transform
.matrix13
, n
);
2416 swapl(&stuff
->transform
.matrix21
, n
);
2417 swapl(&stuff
->transform
.matrix22
, n
);
2418 swapl(&stuff
->transform
.matrix23
, n
);
2419 swapl(&stuff
->transform
.matrix31
, n
);
2420 swapl(&stuff
->transform
.matrix32
, n
);
2421 swapl(&stuff
->transform
.matrix33
, n
);
2422 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2426 SProcRenderQueryFilters (ClientPtr client
)
2429 REQUEST (xRenderQueryFiltersReq
);
2430 REQUEST_SIZE_MATCH (xRenderQueryFiltersReq
);
2432 swaps(&stuff
->length
, n
);
2433 swapl(&stuff
->drawable
, n
);
2434 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2438 SProcRenderSetPictureFilter (ClientPtr client
)
2441 REQUEST (xRenderSetPictureFilterReq
);
2442 REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq
);
2444 swaps(&stuff
->length
, n
);
2445 swapl(&stuff
->picture
, n
);
2446 swaps(&stuff
->nbytes
, n
);
2447 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2451 SProcRenderCreateAnimCursor (ClientPtr client
)
2454 REQUEST (xRenderCreateAnimCursorReq
);
2455 REQUEST_AT_LEAST_SIZE (xRenderCreateAnimCursorReq
);
2457 swaps(&stuff
->length
, n
);
2458 swapl(&stuff
->cid
, n
);
2460 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2464 SProcRenderAddTraps (ClientPtr client
)
2467 REQUEST (xRenderAddTrapsReq
);
2468 REQUEST_AT_LEAST_SIZE (xRenderAddTrapsReq
);
2470 swaps(&stuff
->length
, n
);
2471 swapl(&stuff
->picture
, n
);
2472 swaps(&stuff
->xOff
, n
);
2473 swaps(&stuff
->yOff
, n
);
2475 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2479 SProcRenderCreateSolidFill(ClientPtr client
)
2482 REQUEST (xRenderCreateSolidFillReq
);
2483 REQUEST_AT_LEAST_SIZE (xRenderCreateSolidFillReq
);
2485 swaps(&stuff
->length
, n
);
2486 swapl(&stuff
->pid
, n
);
2487 swaps(&stuff
->color
.alpha
, n
);
2488 swaps(&stuff
->color
.red
, n
);
2489 swaps(&stuff
->color
.green
, n
);
2490 swaps(&stuff
->color
.blue
, n
);
2491 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2494 static void swapStops(void *stuff
, int n
)
2499 stops
= (CARD32
*)(stuff
);
2500 for (i
= 0; i
< n
; ++i
) {
2504 colors
= (CARD16
*)(stops
);
2505 for (i
= 0; i
< 4*n
; ++i
) {
2512 SProcRenderCreateLinearGradient (ClientPtr client
)
2516 REQUEST (xRenderCreateLinearGradientReq
);
2517 REQUEST_AT_LEAST_SIZE (xRenderCreateLinearGradientReq
);
2519 swaps(&stuff
->length
, n
);
2520 swapl(&stuff
->pid
, n
);
2521 swapl(&stuff
->p1
.x
, n
);
2522 swapl(&stuff
->p1
.y
, n
);
2523 swapl(&stuff
->p2
.x
, n
);
2524 swapl(&stuff
->p2
.y
, n
);
2525 swapl(&stuff
->nStops
, n
);
2527 len
= (client
->req_len
<< 2) - sizeof(xRenderCreateLinearGradientReq
);
2528 if (len
!= stuff
->nStops
*(sizeof(xFixed
) + sizeof(xRenderColor
)))
2531 swapStops(stuff
+1, stuff
->nStops
);
2533 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2537 SProcRenderCreateRadialGradient (ClientPtr client
)
2541 REQUEST (xRenderCreateRadialGradientReq
);
2542 REQUEST_AT_LEAST_SIZE (xRenderCreateRadialGradientReq
);
2544 swaps(&stuff
->length
, n
);
2545 swapl(&stuff
->pid
, n
);
2546 swapl(&stuff
->inner
.x
, n
);
2547 swapl(&stuff
->inner
.y
, n
);
2548 swapl(&stuff
->outer
.x
, n
);
2549 swapl(&stuff
->outer
.y
, n
);
2550 swapl(&stuff
->inner_radius
, n
);
2551 swapl(&stuff
->outer_radius
, n
);
2552 swapl(&stuff
->nStops
, n
);
2554 len
= (client
->req_len
<< 2) - sizeof(xRenderCreateRadialGradientReq
);
2555 if (len
!= stuff
->nStops
*(sizeof(xFixed
) + sizeof(xRenderColor
)))
2558 swapStops(stuff
+1, stuff
->nStops
);
2560 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2564 SProcRenderCreateConicalGradient (ClientPtr client
)
2568 REQUEST (xRenderCreateConicalGradientReq
);
2569 REQUEST_AT_LEAST_SIZE (xRenderCreateConicalGradientReq
);
2571 swaps(&stuff
->length
, n
);
2572 swapl(&stuff
->pid
, n
);
2573 swapl(&stuff
->center
.x
, n
);
2574 swapl(&stuff
->center
.y
, n
);
2575 swapl(&stuff
->angle
, n
);
2576 swapl(&stuff
->nStops
, n
);
2578 len
= (client
->req_len
<< 2) - sizeof(xRenderCreateConicalGradientReq
);
2579 if (len
!= stuff
->nStops
*(sizeof(xFixed
) + sizeof(xRenderColor
)))
2582 swapStops(stuff
+1, stuff
->nStops
);
2584 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2588 SProcRenderDispatch (ClientPtr client
)
2592 if (stuff
->data
< RenderNumberRequests
)
2593 return (*SProcRenderVector
[stuff
->data
]) (client
);
2599 #include "panoramiX.h"
2600 #include "panoramiXsrv.h"
2602 #define VERIFY_XIN_PICTURE(pPicture, pid, client, mode, err) {\
2603 pPicture = SecurityLookupIDByType(client, pid, XRT_PICTURE, mode);\
2605 client->errorValue = pid; \
2610 #define VERIFY_XIN_ALPHA(pPicture, pid, client, mode, err) {\
2614 VERIFY_XIN_PICTURE(pPicture, pid, client, mode, err); \
2618 int (*PanoramiXSaveRenderVector[RenderNumberRequests])(ClientPtr);
2620 unsigned long XRT_PICTURE
;
2623 PanoramiXRenderCreatePicture (ClientPtr client
)
2625 REQUEST(xRenderCreatePictureReq
);
2626 PanoramiXRes
*refDraw
, *newPict
;
2627 int result
= Success
, j
;
2629 REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq
);
2630 if(!(refDraw
= (PanoramiXRes
*)SecurityLookupIDByClass(
2631 client
, stuff
->drawable
, XRC_DRAWABLE
, DixWriteAccess
)))
2633 if(!(newPict
= (PanoramiXRes
*) xalloc(sizeof(PanoramiXRes
))))
2635 newPict
->type
= XRT_PICTURE
;
2636 newPict
->info
[0].id
= stuff
->pid
;
2638 if (refDraw
->type
== XRT_WINDOW
&&
2639 stuff
->drawable
== WindowTable
[0]->drawable
.id
)
2641 newPict
->u
.pict
.root
= TRUE
;
2644 newPict
->u
.pict
.root
= FALSE
;
2646 for(j
= 1; j
< PanoramiXNumScreens
; j
++)
2647 newPict
->info
[j
].id
= FakeClientID(client
->index
);
2649 FOR_NSCREENS_BACKWARD(j
) {
2650 stuff
->pid
= newPict
->info
[j
].id
;
2651 stuff
->drawable
= refDraw
->info
[j
].id
;
2652 result
= (*PanoramiXSaveRenderVector
[X_RenderCreatePicture
]) (client
);
2653 if(result
!= Success
) break;
2656 if (result
== Success
)
2657 AddResource(newPict
->info
[0].id
, XRT_PICTURE
, newPict
);
2665 PanoramiXRenderChangePicture (ClientPtr client
)
2668 int result
= Success
, j
;
2669 REQUEST(xRenderChangePictureReq
);
2671 REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq
);
2673 VERIFY_XIN_PICTURE(pict
, stuff
->picture
, client
, DixWriteAccess
,
2674 RenderErrBase
+ BadPicture
);
2676 FOR_NSCREENS_BACKWARD(j
) {
2677 stuff
->picture
= pict
->info
[j
].id
;
2678 result
= (*PanoramiXSaveRenderVector
[X_RenderChangePicture
]) (client
);
2679 if(result
!= Success
) break;
2686 PanoramiXRenderSetPictureClipRectangles (ClientPtr client
)
2688 REQUEST(xRenderSetPictureClipRectanglesReq
);
2689 int result
= Success
, j
;
2692 REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq
);
2694 VERIFY_XIN_PICTURE(pict
, stuff
->picture
, client
, DixWriteAccess
,
2695 RenderErrBase
+ BadPicture
);
2697 FOR_NSCREENS_BACKWARD(j
) {
2698 stuff
->picture
= pict
->info
[j
].id
;
2699 result
= (*PanoramiXSaveRenderVector
[X_RenderSetPictureClipRectangles
]) (client
);
2700 if(result
!= Success
) break;
2707 PanoramiXRenderSetPictureTransform (ClientPtr client
)
2709 REQUEST(xRenderSetPictureTransformReq
);
2710 int result
= Success
, j
;
2713 REQUEST_AT_LEAST_SIZE(xRenderSetPictureTransformReq
);
2715 VERIFY_XIN_PICTURE(pict
, stuff
->picture
, client
, DixWriteAccess
,
2716 RenderErrBase
+ BadPicture
);
2718 FOR_NSCREENS_BACKWARD(j
) {
2719 stuff
->picture
= pict
->info
[j
].id
;
2720 result
= (*PanoramiXSaveRenderVector
[X_RenderSetPictureTransform
]) (client
);
2721 if(result
!= Success
) break;
2728 PanoramiXRenderSetPictureFilter (ClientPtr client
)
2730 REQUEST(xRenderSetPictureFilterReq
);
2731 int result
= Success
, j
;
2734 REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq
);
2736 VERIFY_XIN_PICTURE(pict
, stuff
->picture
, client
, DixWriteAccess
,
2737 RenderErrBase
+ BadPicture
);
2739 FOR_NSCREENS_BACKWARD(j
) {
2740 stuff
->picture
= pict
->info
[j
].id
;
2741 result
= (*PanoramiXSaveRenderVector
[X_RenderSetPictureFilter
]) (client
);
2742 if(result
!= Success
) break;
2749 PanoramiXRenderFreePicture (ClientPtr client
)
2752 int result
= Success
, j
;
2753 REQUEST(xRenderFreePictureReq
);
2755 REQUEST_SIZE_MATCH(xRenderFreePictureReq
);
2757 client
->errorValue
= stuff
->picture
;
2759 VERIFY_XIN_PICTURE(pict
, stuff
->picture
, client
, DixDestroyAccess
,
2760 RenderErrBase
+ BadPicture
);
2763 FOR_NSCREENS_BACKWARD(j
) {
2764 stuff
->picture
= pict
->info
[j
].id
;
2765 result
= (*PanoramiXSaveRenderVector
[X_RenderFreePicture
]) (client
);
2766 if(result
!= Success
) break;
2769 /* Since ProcRenderFreePicture is using FreeResource, it will free
2770 our resource for us on the last pass through the loop above */
2776 PanoramiXRenderComposite (ClientPtr client
)
2778 PanoramiXRes
*src
, *msk
, *dst
;
2779 int result
= Success
, j
;
2780 xRenderCompositeReq orig
;
2781 REQUEST(xRenderCompositeReq
);
2783 REQUEST_SIZE_MATCH(xRenderCompositeReq
);
2785 VERIFY_XIN_PICTURE (src
, stuff
->src
, client
, DixReadAccess
,
2786 RenderErrBase
+ BadPicture
);
2787 VERIFY_XIN_ALPHA (msk
, stuff
->mask
, client
, DixReadAccess
,
2788 RenderErrBase
+ BadPicture
);
2789 VERIFY_XIN_PICTURE (dst
, stuff
->dst
, client
, DixWriteAccess
,
2790 RenderErrBase
+ BadPicture
);
2794 FOR_NSCREENS_FORWARD(j
) {
2795 stuff
->src
= src
->info
[j
].id
;
2796 if (src
->u
.pict
.root
)
2798 stuff
->xSrc
= orig
.xSrc
- panoramiXdataPtr
[j
].x
;
2799 stuff
->ySrc
= orig
.ySrc
- panoramiXdataPtr
[j
].y
;
2801 stuff
->dst
= dst
->info
[j
].id
;
2802 if (dst
->u
.pict
.root
)
2804 stuff
->xDst
= orig
.xDst
- panoramiXdataPtr
[j
].x
;
2805 stuff
->yDst
= orig
.yDst
- panoramiXdataPtr
[j
].y
;
2809 stuff
->mask
= msk
->info
[j
].id
;
2810 if (msk
->u
.pict
.root
)
2812 stuff
->xMask
= orig
.xMask
- panoramiXdataPtr
[j
].x
;
2813 stuff
->yMask
= orig
.yMask
- panoramiXdataPtr
[j
].y
;
2816 result
= (*PanoramiXSaveRenderVector
[X_RenderComposite
]) (client
);
2817 if(result
!= Success
) break;
2824 PanoramiXRenderCompositeGlyphs (ClientPtr client
)
2826 PanoramiXRes
*src
, *dst
;
2827 int result
= Success
, j
;
2828 REQUEST(xRenderCompositeGlyphsReq
);
2829 xGlyphElt origElt
, *elt
;
2832 REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq
);
2833 VERIFY_XIN_PICTURE (src
, stuff
->src
, client
, DixReadAccess
,
2834 RenderErrBase
+ BadPicture
);
2835 VERIFY_XIN_PICTURE (dst
, stuff
->dst
, client
, DixWriteAccess
,
2836 RenderErrBase
+ BadPicture
);
2838 if (client
->req_len
<< 2 >= (sizeof (xRenderCompositeGlyphsReq
) +
2839 sizeof (xGlyphElt
)))
2841 elt
= (xGlyphElt
*) (stuff
+ 1);
2845 FOR_NSCREENS_FORWARD(j
) {
2846 stuff
->src
= src
->info
[j
].id
;
2847 if (src
->u
.pict
.root
)
2849 stuff
->xSrc
= xSrc
- panoramiXdataPtr
[j
].x
;
2850 stuff
->ySrc
= ySrc
- panoramiXdataPtr
[j
].y
;
2852 stuff
->dst
= dst
->info
[j
].id
;
2853 if (dst
->u
.pict
.root
)
2855 elt
->deltax
= origElt
.deltax
- panoramiXdataPtr
[j
].x
;
2856 elt
->deltay
= origElt
.deltay
- panoramiXdataPtr
[j
].y
;
2858 result
= (*PanoramiXSaveRenderVector
[stuff
->renderReqType
]) (client
);
2859 if(result
!= Success
) break;
2867 PanoramiXRenderFillRectangles (ClientPtr client
)
2870 int result
= Success
, j
;
2871 REQUEST(xRenderFillRectanglesReq
);
2875 REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq
);
2876 VERIFY_XIN_PICTURE (dst
, stuff
->dst
, client
, DixWriteAccess
,
2877 RenderErrBase
+ BadPicture
);
2878 extra_len
= (client
->req_len
<< 2) - sizeof (xRenderFillRectanglesReq
);
2880 (extra
= (char *) ALLOCATE_LOCAL (extra_len
)))
2882 memcpy (extra
, stuff
+ 1, extra_len
);
2883 FOR_NSCREENS_FORWARD(j
) {
2884 if (j
) memcpy (stuff
+ 1, extra
, extra_len
);
2885 if (dst
->u
.pict
.root
)
2887 int x_off
= panoramiXdataPtr
[j
].x
;
2888 int y_off
= panoramiXdataPtr
[j
].y
;
2890 if(x_off
|| y_off
) {
2891 xRectangle
*rects
= (xRectangle
*) (stuff
+ 1);
2892 int i
= extra_len
/ sizeof (xRectangle
);
2902 stuff
->dst
= dst
->info
[j
].id
;
2903 result
= (*PanoramiXSaveRenderVector
[X_RenderFillRectangles
]) (client
);
2904 if(result
!= Success
) break;
2906 DEALLOCATE_LOCAL(extra
);
2913 PanoramiXRenderTrapezoids(ClientPtr client
)
2915 PanoramiXRes
*src
, *dst
;
2916 int result
= Success
, j
;
2917 REQUEST(xRenderTrapezoidsReq
);
2921 REQUEST_AT_LEAST_SIZE (xRenderTrapezoidsReq
);
2923 VERIFY_XIN_PICTURE (src
, stuff
->src
, client
, DixReadAccess
,
2924 RenderErrBase
+ BadPicture
);
2925 VERIFY_XIN_PICTURE (dst
, stuff
->dst
, client
, DixWriteAccess
,
2926 RenderErrBase
+ BadPicture
);
2928 extra_len
= (client
->req_len
<< 2) - sizeof (xRenderTrapezoidsReq
);
2931 (extra
= (char *) ALLOCATE_LOCAL (extra_len
))) {
2932 memcpy (extra
, stuff
+ 1, extra_len
);
2934 FOR_NSCREENS_FORWARD(j
) {
2935 if (j
) memcpy (stuff
+ 1, extra
, extra_len
);
2936 if (dst
->u
.pict
.root
) {
2937 int x_off
= panoramiXdataPtr
[j
].x
;
2938 int y_off
= panoramiXdataPtr
[j
].y
;
2940 if(x_off
|| y_off
) {
2941 xTrapezoid
*trap
= (xTrapezoid
*) (stuff
+ 1);
2942 int i
= extra_len
/ sizeof (xTrapezoid
);
2946 trap
->bottom
-= y_off
;
2947 trap
->left
.p1
.x
-= x_off
;
2948 trap
->left
.p1
.y
-= y_off
;
2949 trap
->left
.p2
.x
-= x_off
;
2950 trap
->left
.p2
.y
-= y_off
;
2951 trap
->right
.p1
.x
-= x_off
;
2952 trap
->right
.p1
.y
-= y_off
;
2953 trap
->right
.p2
.x
-= x_off
;
2954 trap
->right
.p2
.y
-= y_off
;
2960 stuff
->src
= src
->info
[j
].id
;
2961 stuff
->dst
= dst
->info
[j
].id
;
2963 (*PanoramiXSaveRenderVector
[X_RenderTrapezoids
]) (client
);
2965 if(result
!= Success
) break;
2968 DEALLOCATE_LOCAL(extra
);
2975 PanoramiXRenderTriangles(ClientPtr client
)
2977 PanoramiXRes
*src
, *dst
;
2978 int result
= Success
, j
;
2979 REQUEST(xRenderTrianglesReq
);
2983 REQUEST_AT_LEAST_SIZE (xRenderTrianglesReq
);
2985 VERIFY_XIN_PICTURE (src
, stuff
->src
, client
, DixReadAccess
,
2986 RenderErrBase
+ BadPicture
);
2987 VERIFY_XIN_PICTURE (dst
, stuff
->dst
, client
, DixWriteAccess
,
2988 RenderErrBase
+ BadPicture
);
2990 extra_len
= (client
->req_len
<< 2) - sizeof (xRenderTrianglesReq
);
2993 (extra
= (char *) ALLOCATE_LOCAL (extra_len
))) {
2994 memcpy (extra
, stuff
+ 1, extra_len
);
2996 FOR_NSCREENS_FORWARD(j
) {
2997 if (j
) memcpy (stuff
+ 1, extra
, extra_len
);
2998 if (dst
->u
.pict
.root
) {
2999 int x_off
= panoramiXdataPtr
[j
].x
;
3000 int y_off
= panoramiXdataPtr
[j
].y
;
3002 if(x_off
|| y_off
) {
3003 xTriangle
*tri
= (xTriangle
*) (stuff
+ 1);
3004 int i
= extra_len
/ sizeof (xTriangle
);
3018 stuff
->src
= src
->info
[j
].id
;
3019 stuff
->dst
= dst
->info
[j
].id
;
3021 (*PanoramiXSaveRenderVector
[X_RenderTriangles
]) (client
);
3023 if(result
!= Success
) break;
3026 DEALLOCATE_LOCAL(extra
);
3033 PanoramiXRenderTriStrip(ClientPtr client
)
3035 PanoramiXRes
*src
, *dst
;
3036 int result
= Success
, j
;
3037 REQUEST(xRenderTriStripReq
);
3041 REQUEST_AT_LEAST_SIZE (xRenderTriStripReq
);
3043 VERIFY_XIN_PICTURE (src
, stuff
->src
, client
, DixReadAccess
,
3044 RenderErrBase
+ BadPicture
);
3045 VERIFY_XIN_PICTURE (dst
, stuff
->dst
, client
, DixWriteAccess
,
3046 RenderErrBase
+ BadPicture
);
3048 extra_len
= (client
->req_len
<< 2) - sizeof (xRenderTriStripReq
);
3051 (extra
= (char *) ALLOCATE_LOCAL (extra_len
))) {
3052 memcpy (extra
, stuff
+ 1, extra_len
);
3054 FOR_NSCREENS_FORWARD(j
) {
3055 if (j
) memcpy (stuff
+ 1, extra
, extra_len
);
3056 if (dst
->u
.pict
.root
) {
3057 int x_off
= panoramiXdataPtr
[j
].x
;
3058 int y_off
= panoramiXdataPtr
[j
].y
;
3060 if(x_off
|| y_off
) {
3061 xPointFixed
*fixed
= (xPointFixed
*) (stuff
+ 1);
3062 int i
= extra_len
/ sizeof (xPointFixed
);
3072 stuff
->src
= src
->info
[j
].id
;
3073 stuff
->dst
= dst
->info
[j
].id
;
3075 (*PanoramiXSaveRenderVector
[X_RenderTriStrip
]) (client
);
3077 if(result
!= Success
) break;
3080 DEALLOCATE_LOCAL(extra
);
3087 PanoramiXRenderTriFan(ClientPtr client
)
3089 PanoramiXRes
*src
, *dst
;
3090 int result
= Success
, j
;
3091 REQUEST(xRenderTriFanReq
);
3095 REQUEST_AT_LEAST_SIZE (xRenderTriFanReq
);
3097 VERIFY_XIN_PICTURE (src
, stuff
->src
, client
, DixReadAccess
,
3098 RenderErrBase
+ BadPicture
);
3099 VERIFY_XIN_PICTURE (dst
, stuff
->dst
, client
, DixWriteAccess
,
3100 RenderErrBase
+ BadPicture
);
3102 extra_len
= (client
->req_len
<< 2) - sizeof (xRenderTriFanReq
);
3105 (extra
= (char *) ALLOCATE_LOCAL (extra_len
))) {
3106 memcpy (extra
, stuff
+ 1, extra_len
);
3108 FOR_NSCREENS_FORWARD(j
) {
3109 if (j
) memcpy (stuff
+ 1, extra
, extra_len
);
3110 if (dst
->u
.pict
.root
) {
3111 int x_off
= panoramiXdataPtr
[j
].x
;
3112 int y_off
= panoramiXdataPtr
[j
].y
;
3114 if(x_off
|| y_off
) {
3115 xPointFixed
*fixed
= (xPointFixed
*) (stuff
+ 1);
3116 int i
= extra_len
/ sizeof (xPointFixed
);
3126 stuff
->src
= src
->info
[j
].id
;
3127 stuff
->dst
= dst
->info
[j
].id
;
3129 (*PanoramiXSaveRenderVector
[X_RenderTriFan
]) (client
);
3131 if(result
!= Success
) break;
3134 DEALLOCATE_LOCAL(extra
);
3140 #if 0 /* Not implemented yet */
3143 PanoramiXRenderColorTrapezoids(ClientPtr client
)
3145 PanoramiXRes
*src
, *dst
;
3146 int result
= Success
, j
;
3147 REQUEST(xRenderColorTrapezoidsReq
);
3151 REQUEST_AT_LEAST_SIZE (xRenderColorTrapezoidsReq
);
3153 VERIFY_XIN_PICTURE (dst
, stuff
->dst
, client
, DixWriteAccess
,
3154 RenderErrBase
+ BadPicture
);
3156 extra_len
= (client
->req_len
<< 2) - sizeof (xRenderColorTrapezoidsReq
);
3159 (extra
= (char *) ALLOCATE_LOCAL (extra_len
))) {
3160 memcpy (extra
, stuff
+ 1, extra_len
);
3162 FOR_NSCREENS_FORWARD(j
) {
3163 if (j
) memcpy (stuff
+ 1, extra
, extra_len
);
3164 if (dst
->u
.pict
.root
) {
3165 int x_off
= panoramiXdataPtr
[j
].x
;
3166 int y_off
= panoramiXdataPtr
[j
].y
;
3168 if(x_off
|| y_off
) {
3173 stuff
->dst
= dst
->info
[j
].id
;
3175 (*PanoramiXSaveRenderVector
[X_RenderColorTrapezoids
]) (client
);
3177 if(result
!= Success
) break;
3180 DEALLOCATE_LOCAL(extra
);
3187 PanoramiXRenderColorTriangles(ClientPtr client
)
3189 PanoramiXRes
*src
, *dst
;
3190 int result
= Success
, j
;
3191 REQUEST(xRenderColorTrianglesReq
);
3195 REQUEST_AT_LEAST_SIZE (xRenderColorTrianglesReq
);
3197 VERIFY_XIN_PICTURE (dst
, stuff
->dst
, client
, DixWriteAccess
,
3198 RenderErrBase
+ BadPicture
);
3200 extra_len
= (client
->req_len
<< 2) - sizeof (xRenderColorTrianglesReq
);
3203 (extra
= (char *) ALLOCATE_LOCAL (extra_len
))) {
3204 memcpy (extra
, stuff
+ 1, extra_len
);
3206 FOR_NSCREENS_FORWARD(j
) {
3207 if (j
) memcpy (stuff
+ 1, extra
, extra_len
);
3208 if (dst
->u
.pict
.root
) {
3209 int x_off
= panoramiXdataPtr
[j
].x
;
3210 int y_off
= panoramiXdataPtr
[j
].y
;
3212 if(x_off
|| y_off
) {
3217 stuff
->dst
= dst
->info
[j
].id
;
3219 (*PanoramiXSaveRenderVector
[X_RenderColorTriangles
]) (client
);
3221 if(result
!= Success
) break;
3224 DEALLOCATE_LOCAL(extra
);
3233 PanoramiXRenderAddTraps (ClientPtr client
)
3235 PanoramiXRes
*picture
;
3236 int result
= Success
, j
;
3237 REQUEST(xRenderAddTrapsReq
);
3242 REQUEST_AT_LEAST_SIZE (xRenderAddTrapsReq
);
3243 VERIFY_XIN_PICTURE (picture
, stuff
->picture
, client
, DixWriteAccess
,
3244 RenderErrBase
+ BadPicture
);
3245 extra_len
= (client
->req_len
<< 2) - sizeof (xRenderAddTrapsReq
);
3247 (extra
= (char *) ALLOCATE_LOCAL (extra_len
)))
3249 memcpy (extra
, stuff
+ 1, extra_len
);
3250 x_off
= stuff
->xOff
;
3251 y_off
= stuff
->yOff
;
3252 FOR_NSCREENS_FORWARD(j
) {
3253 if (j
) memcpy (stuff
+ 1, extra
, extra_len
);
3254 stuff
->picture
= picture
->info
[j
].id
;
3256 if (picture
->u
.pict
.root
)
3258 stuff
->xOff
= x_off
+ panoramiXdataPtr
[j
].x
;
3259 stuff
->yOff
= y_off
+ panoramiXdataPtr
[j
].y
;
3261 result
= (*PanoramiXSaveRenderVector
[X_RenderAddTraps
]) (client
);
3262 if(result
!= Success
) break;
3264 DEALLOCATE_LOCAL(extra
);
3271 PanoramiXRenderInit (void)
3275 XRT_PICTURE
= CreateNewResourceType (XineramaDeleteResource
);
3276 for (i
= 0; i
< RenderNumberRequests
; i
++)
3277 PanoramiXSaveRenderVector
[i
] = ProcRenderVector
[i
];
3279 * Stuff in Xinerama aware request processing hooks
3281 ProcRenderVector
[X_RenderCreatePicture
] = PanoramiXRenderCreatePicture
;
3282 ProcRenderVector
[X_RenderChangePicture
] = PanoramiXRenderChangePicture
;
3283 ProcRenderVector
[X_RenderSetPictureTransform
] = PanoramiXRenderSetPictureTransform
;
3284 ProcRenderVector
[X_RenderSetPictureFilter
] = PanoramiXRenderSetPictureFilter
;
3285 ProcRenderVector
[X_RenderSetPictureClipRectangles
] = PanoramiXRenderSetPictureClipRectangles
;
3286 ProcRenderVector
[X_RenderFreePicture
] = PanoramiXRenderFreePicture
;
3287 ProcRenderVector
[X_RenderComposite
] = PanoramiXRenderComposite
;
3288 ProcRenderVector
[X_RenderCompositeGlyphs8
] = PanoramiXRenderCompositeGlyphs
;
3289 ProcRenderVector
[X_RenderCompositeGlyphs16
] = PanoramiXRenderCompositeGlyphs
;
3290 ProcRenderVector
[X_RenderCompositeGlyphs32
] = PanoramiXRenderCompositeGlyphs
;
3291 ProcRenderVector
[X_RenderFillRectangles
] = PanoramiXRenderFillRectangles
;
3293 ProcRenderVector
[X_RenderTrapezoids
] = PanoramiXRenderTrapezoids
;
3294 ProcRenderVector
[X_RenderTriangles
] = PanoramiXRenderTriangles
;
3295 ProcRenderVector
[X_RenderTriStrip
] = PanoramiXRenderTriStrip
;
3296 ProcRenderVector
[X_RenderTriFan
] = PanoramiXRenderTriFan
;
3297 ProcRenderVector
[X_RenderAddTraps
] = PanoramiXRenderAddTraps
;
3301 PanoramiXRenderReset (void)
3304 for (i
= 0; i
< RenderNumberRequests
; i
++)
3305 ProcRenderVector
[i
] = PanoramiXSaveRenderVector
[i
];
3308 #endif /* PANORAMIX */