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.
25 #ifdef HAVE_DIX_CONFIG_H
26 #include <dix-config.h>
30 #include <X11/Xproto.h>
33 #include "dixstruct.h"
35 #include "scrnintstr.h"
36 #include "windowstr.h"
37 #include "pixmapstr.h"
38 #include "colormapst.h"
39 #include "extnsionst.h"
42 #include <X11/extensions/render.h>
43 #include <X11/extensions/renderproto.h>
44 #include "picturestr.h"
46 #include <X11/Xfuncproto.h>
47 #include "cursorstr.h"
49 #include "protocol-versions.h"
52 #include "panoramiX.h"
53 #include "panoramiXsrv.h"
58 static int ProcRenderQueryVersion(ClientPtr pClient
);
59 static int ProcRenderQueryPictFormats(ClientPtr pClient
);
60 static int ProcRenderQueryPictIndexValues(ClientPtr pClient
);
61 static int ProcRenderQueryDithers(ClientPtr pClient
);
62 static int ProcRenderCreatePicture(ClientPtr pClient
);
63 static int ProcRenderChangePicture(ClientPtr pClient
);
64 static int ProcRenderSetPictureClipRectangles(ClientPtr pClient
);
65 static int ProcRenderFreePicture(ClientPtr pClient
);
66 static int ProcRenderComposite(ClientPtr pClient
);
67 static int ProcRenderScale(ClientPtr pClient
);
68 static int ProcRenderTrapezoids(ClientPtr pClient
);
69 static int ProcRenderTriangles(ClientPtr pClient
);
70 static int ProcRenderTriStrip(ClientPtr pClient
);
71 static int ProcRenderTriFan(ClientPtr pClient
);
72 static int ProcRenderColorTrapezoids(ClientPtr pClient
);
73 static int ProcRenderColorTriangles(ClientPtr pClient
);
74 static int ProcRenderTransform(ClientPtr pClient
);
75 static int ProcRenderCreateGlyphSet(ClientPtr pClient
);
76 static int ProcRenderReferenceGlyphSet(ClientPtr pClient
);
77 static int ProcRenderFreeGlyphSet(ClientPtr pClient
);
78 static int ProcRenderAddGlyphs(ClientPtr pClient
);
79 static int ProcRenderAddGlyphsFromPicture(ClientPtr pClient
);
80 static int ProcRenderFreeGlyphs(ClientPtr pClient
);
81 static int ProcRenderCompositeGlyphs(ClientPtr pClient
);
82 static int ProcRenderFillRectangles(ClientPtr pClient
);
83 static int ProcRenderCreateCursor(ClientPtr pClient
);
84 static int ProcRenderSetPictureTransform(ClientPtr pClient
);
85 static int ProcRenderQueryFilters(ClientPtr pClient
);
86 static int ProcRenderSetPictureFilter(ClientPtr pClient
);
87 static int ProcRenderCreateAnimCursor(ClientPtr pClient
);
88 static int ProcRenderAddTraps(ClientPtr pClient
);
89 static int ProcRenderCreateSolidFill(ClientPtr pClient
);
90 static int ProcRenderCreateLinearGradient(ClientPtr pClient
);
91 static int ProcRenderCreateRadialGradient(ClientPtr pClient
);
92 static int ProcRenderCreateConicalGradient(ClientPtr pClient
);
94 static int ProcRenderDispatch(ClientPtr pClient
);
96 static int SProcRenderQueryVersion(ClientPtr pClient
);
97 static int SProcRenderQueryPictFormats(ClientPtr pClient
);
98 static int SProcRenderQueryPictIndexValues(ClientPtr pClient
);
99 static int SProcRenderQueryDithers(ClientPtr pClient
);
100 static int SProcRenderCreatePicture(ClientPtr pClient
);
101 static int SProcRenderChangePicture(ClientPtr pClient
);
102 static int SProcRenderSetPictureClipRectangles(ClientPtr pClient
);
103 static int SProcRenderFreePicture(ClientPtr pClient
);
104 static int SProcRenderComposite(ClientPtr pClient
);
105 static int SProcRenderScale(ClientPtr pClient
);
106 static int SProcRenderTrapezoids(ClientPtr pClient
);
107 static int SProcRenderTriangles(ClientPtr pClient
);
108 static int SProcRenderTriStrip(ClientPtr pClient
);
109 static int SProcRenderTriFan(ClientPtr pClient
);
110 static int SProcRenderColorTrapezoids(ClientPtr pClient
);
111 static int SProcRenderColorTriangles(ClientPtr pClient
);
112 static int SProcRenderTransform(ClientPtr pClient
);
113 static int SProcRenderCreateGlyphSet(ClientPtr pClient
);
114 static int SProcRenderReferenceGlyphSet(ClientPtr pClient
);
115 static int SProcRenderFreeGlyphSet(ClientPtr pClient
);
116 static int SProcRenderAddGlyphs(ClientPtr pClient
);
117 static int SProcRenderAddGlyphsFromPicture(ClientPtr pClient
);
118 static int SProcRenderFreeGlyphs(ClientPtr pClient
);
119 static int SProcRenderCompositeGlyphs(ClientPtr pClient
);
120 static int SProcRenderFillRectangles(ClientPtr pClient
);
121 static int SProcRenderCreateCursor(ClientPtr pClient
);
122 static int SProcRenderSetPictureTransform(ClientPtr pClient
);
123 static int SProcRenderQueryFilters(ClientPtr pClient
);
124 static int SProcRenderSetPictureFilter(ClientPtr pClient
);
125 static int SProcRenderCreateAnimCursor(ClientPtr pClient
);
126 static int SProcRenderAddTraps(ClientPtr pClient
);
127 static int SProcRenderCreateSolidFill(ClientPtr pClient
);
128 static int SProcRenderCreateLinearGradient(ClientPtr pClient
);
129 static int SProcRenderCreateRadialGradient(ClientPtr pClient
);
130 static int SProcRenderCreateConicalGradient(ClientPtr pClient
);
132 static int SProcRenderDispatch(ClientPtr pClient
);
134 int (*ProcRenderVector
[RenderNumberRequests
]) (ClientPtr
) = {
135 ProcRenderQueryVersion
,
136 ProcRenderQueryPictFormats
,
137 ProcRenderQueryPictIndexValues
,
138 ProcRenderQueryDithers
,
139 ProcRenderCreatePicture
,
140 ProcRenderChangePicture
,
141 ProcRenderSetPictureClipRectangles
,
142 ProcRenderFreePicture
,
145 ProcRenderTrapezoids
,
149 ProcRenderColorTrapezoids
,
150 ProcRenderColorTriangles
,
152 ProcRenderCreateGlyphSet
,
153 ProcRenderReferenceGlyphSet
,
154 ProcRenderFreeGlyphSet
,
156 ProcRenderAddGlyphsFromPicture
,
157 ProcRenderFreeGlyphs
,
158 ProcRenderCompositeGlyphs
,
159 ProcRenderCompositeGlyphs
,
160 ProcRenderCompositeGlyphs
,
161 ProcRenderFillRectangles
,
162 ProcRenderCreateCursor
,
163 ProcRenderSetPictureTransform
,
164 ProcRenderQueryFilters
,
165 ProcRenderSetPictureFilter
,
166 ProcRenderCreateAnimCursor
,
168 ProcRenderCreateSolidFill
,
169 ProcRenderCreateLinearGradient
,
170 ProcRenderCreateRadialGradient
, 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
, SProcRenderCreateConicalGradient
};
211 static DevPrivateKeyRec RenderClientPrivateKeyRec
;
213 #define RenderClientPrivateKey (&RenderClientPrivateKeyRec )
215 typedef struct _RenderClient
{
218 } RenderClientRec
, *RenderClientPtr
;
220 #define GetRenderClient(pClient) ((RenderClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RenderClientPrivateKey))
223 RenderClientCallback(CallbackListPtr
*list
, pointer closure
, pointer data
)
225 NewClientInfoRec
*clientinfo
= (NewClientInfoRec
*) data
;
226 ClientPtr pClient
= clientinfo
->client
;
227 RenderClientPtr pRenderClient
= GetRenderClient(pClient
);
229 pRenderClient
->major_version
= 0;
230 pRenderClient
->minor_version
= 0;
238 RenderExtensionInit(void)
240 ExtensionEntry
*extEntry
;
244 if (!PictureFinishInit())
246 if (!dixRegisterPrivateKey
247 (&RenderClientPrivateKeyRec
, PRIVATE_CLIENT
, sizeof(RenderClientRec
)))
249 if (!AddCallback(&ClientStateCallback
, RenderClientCallback
, 0))
252 extEntry
= AddExtension(RENDER_NAME
, 0, RenderNumberErrors
,
253 ProcRenderDispatch
, SProcRenderDispatch
,
254 NULL
, StandardMinorOpcode
);
257 RenderErrBase
= extEntry
->errorBase
;
260 SetResourceTypeErrorValue(XRT_PICTURE
, RenderErrBase
+ BadPicture
);
262 SetResourceTypeErrorValue(PictureType
, RenderErrBase
+ BadPicture
);
263 SetResourceTypeErrorValue(PictFormatType
, RenderErrBase
+ BadPictFormat
);
264 SetResourceTypeErrorValue(GlyphSetType
, RenderErrBase
+ BadGlyphSet
);
268 ProcRenderQueryVersion(ClientPtr client
)
270 RenderClientPtr pRenderClient
= GetRenderClient(client
);
271 xRenderQueryVersionReply rep
= {
273 .sequenceNumber
= client
->sequence
,
277 REQUEST(xRenderQueryVersionReq
);
279 pRenderClient
->major_version
= stuff
->majorVersion
;
280 pRenderClient
->minor_version
= stuff
->minorVersion
;
282 REQUEST_SIZE_MATCH(xRenderQueryVersionReq
);
284 if ((stuff
->majorVersion
* 1000 + stuff
->minorVersion
) <
285 (SERVER_RENDER_MAJOR_VERSION
* 1000 + SERVER_RENDER_MINOR_VERSION
)) {
286 rep
.majorVersion
= stuff
->majorVersion
;
287 rep
.minorVersion
= stuff
->minorVersion
;
290 rep
.majorVersion
= SERVER_RENDER_MAJOR_VERSION
;
291 rep
.minorVersion
= SERVER_RENDER_MINOR_VERSION
;
294 if (client
->swapped
) {
295 swaps(&rep
.sequenceNumber
);
297 swapl(&rep
.majorVersion
);
298 swapl(&rep
.minorVersion
);
300 WriteToClient(client
, sizeof(xRenderQueryVersionReply
), &rep
);
305 findVisual(ScreenPtr pScreen
, VisualID vid
)
310 for (v
= 0; v
< pScreen
->numVisuals
; v
++) {
311 pVisual
= pScreen
->visuals
+ v
;
312 if (pVisual
->vid
== vid
)
319 ProcRenderQueryPictFormats(ClientPtr client
)
321 RenderClientPtr pRenderClient
= GetRenderClient(client
);
322 xRenderQueryPictFormatsReply
*reply
;
323 xPictScreen
*pictScreen
;
324 xPictDepth
*pictDepth
;
325 xPictVisual
*pictVisual
;
326 xPictFormInfo
*pictForm
;
327 CARD32
*pictSubpixel
;
333 PictFormatPtr pFormat
;
342 /* REQUEST(xRenderQueryPictFormatsReq); */
344 REQUEST_SIZE_MATCH(xRenderQueryPictFormatsReq
);
347 if (noPanoramiXExtension
)
348 numScreens
= screenInfo
.numScreens
;
350 numScreens
= ((xConnSetup
*) ConnectionInfo
)->numRoots
;
352 numScreens
= screenInfo
.numScreens
;
354 ndepth
= nformat
= nvisual
= 0;
355 for (s
= 0; s
< numScreens
; s
++) {
356 pScreen
= screenInfo
.screens
[s
];
357 for (d
= 0; d
< pScreen
->numDepths
; d
++) {
358 pDepth
= pScreen
->allowedDepths
+ d
;
361 for (v
= 0; v
< pDepth
->numVids
; v
++) {
362 pVisual
= findVisual(pScreen
, pDepth
->vids
[v
]);
364 PictureMatchVisual(pScreen
, pDepth
->depth
, pVisual
))
368 ps
= GetPictureScreenIfSet(pScreen
);
370 nformat
+= ps
->nformats
;
372 if (pRenderClient
->major_version
== 0 && pRenderClient
->minor_version
< 6)
375 numSubpixel
= numScreens
;
377 rlength
= (sizeof(xRenderQueryPictFormatsReply
) +
378 nformat
* sizeof(xPictFormInfo
) +
379 numScreens
* sizeof(xPictScreen
) +
380 ndepth
* sizeof(xPictDepth
) +
381 nvisual
* sizeof(xPictVisual
) + numSubpixel
* sizeof(CARD32
));
382 reply
= (xRenderQueryPictFormatsReply
*) calloc(1, rlength
);
385 reply
->type
= X_Reply
;
386 reply
->sequenceNumber
= client
->sequence
;
387 reply
->length
= bytes_to_int32(rlength
- sizeof(xGenericReply
));
388 reply
->numFormats
= nformat
;
389 reply
->numScreens
= numScreens
;
390 reply
->numDepths
= ndepth
;
391 reply
->numVisuals
= nvisual
;
392 reply
->numSubpixel
= numSubpixel
;
394 pictForm
= (xPictFormInfo
*) (reply
+ 1);
396 for (s
= 0; s
< numScreens
; s
++) {
397 pScreen
= screenInfo
.screens
[s
];
398 ps
= GetPictureScreenIfSet(pScreen
);
400 for (nformat
= 0, pFormat
= ps
->formats
;
401 nformat
< ps
->nformats
; nformat
++, pFormat
++) {
402 pictForm
->id
= pFormat
->id
;
403 pictForm
->type
= pFormat
->type
;
404 pictForm
->depth
= pFormat
->depth
;
405 pictForm
->direct
.red
= pFormat
->direct
.red
;
406 pictForm
->direct
.redMask
= pFormat
->direct
.redMask
;
407 pictForm
->direct
.green
= pFormat
->direct
.green
;
408 pictForm
->direct
.greenMask
= pFormat
->direct
.greenMask
;
409 pictForm
->direct
.blue
= pFormat
->direct
.blue
;
410 pictForm
->direct
.blueMask
= pFormat
->direct
.blueMask
;
411 pictForm
->direct
.alpha
= pFormat
->direct
.alpha
;
412 pictForm
->direct
.alphaMask
= pFormat
->direct
.alphaMask
;
413 if (pFormat
->type
== PictTypeIndexed
&&
414 pFormat
->index
.pColormap
)
415 pictForm
->colormap
= pFormat
->index
.pColormap
->mid
;
417 pictForm
->colormap
= None
;
418 if (client
->swapped
) {
419 swapl(&pictForm
->id
);
420 swaps(&pictForm
->direct
.red
);
421 swaps(&pictForm
->direct
.redMask
);
422 swaps(&pictForm
->direct
.green
);
423 swaps(&pictForm
->direct
.greenMask
);
424 swaps(&pictForm
->direct
.blue
);
425 swaps(&pictForm
->direct
.blueMask
);
426 swaps(&pictForm
->direct
.alpha
);
427 swaps(&pictForm
->direct
.alphaMask
);
428 swapl(&pictForm
->colormap
);
435 pictScreen
= (xPictScreen
*) pictForm
;
436 for (s
= 0; s
< numScreens
; s
++) {
437 pScreen
= screenInfo
.screens
[s
];
438 pictDepth
= (xPictDepth
*) (pictScreen
+ 1);
440 for (d
= 0; d
< pScreen
->numDepths
; d
++) {
441 pictVisual
= (xPictVisual
*) (pictDepth
+ 1);
442 pDepth
= pScreen
->allowedDepths
+ d
;
445 for (v
= 0; v
< pDepth
->numVids
; v
++) {
446 pVisual
= findVisual(pScreen
, pDepth
->vids
[v
]);
447 if (pVisual
&& (pFormat
= PictureMatchVisual(pScreen
,
450 pictVisual
->visual
= pVisual
->vid
;
451 pictVisual
->format
= pFormat
->id
;
452 if (client
->swapped
) {
453 swapl(&pictVisual
->visual
);
454 swapl(&pictVisual
->format
);
460 pictDepth
->depth
= pDepth
->depth
;
461 pictDepth
->nPictVisuals
= nvisual
;
462 if (client
->swapped
) {
463 swaps(&pictDepth
->nPictVisuals
);
466 pictDepth
= (xPictDepth
*) pictVisual
;
468 pictScreen
->nDepth
= ndepth
;
469 ps
= GetPictureScreenIfSet(pScreen
);
471 pictScreen
->fallback
= ps
->fallback
->id
;
473 pictScreen
->fallback
= 0;
474 if (client
->swapped
) {
475 swapl(&pictScreen
->nDepth
);
476 swapl(&pictScreen
->fallback
);
478 pictScreen
= (xPictScreen
*) pictDepth
;
480 pictSubpixel
= (CARD32
*) pictScreen
;
482 for (s
= 0; s
< numSubpixel
; s
++) {
483 pScreen
= screenInfo
.screens
[s
];
484 ps
= GetPictureScreenIfSet(pScreen
);
486 *pictSubpixel
= ps
->subpixel
;
488 *pictSubpixel
= SubPixelUnknown
;
489 if (client
->swapped
) {
495 if (client
->swapped
) {
496 swaps(&reply
->sequenceNumber
);
497 swapl(&reply
->length
);
498 swapl(&reply
->numFormats
);
499 swapl(&reply
->numScreens
);
500 swapl(&reply
->numDepths
);
501 swapl(&reply
->numVisuals
);
502 swapl(&reply
->numSubpixel
);
504 WriteToClient(client
, rlength
, reply
);
510 ProcRenderQueryPictIndexValues(ClientPtr client
)
512 PictFormatPtr pFormat
;
517 REQUEST(xRenderQueryPictIndexValuesReq
);
518 xRenderQueryPictIndexValuesReply
*reply
;
521 REQUEST_AT_LEAST_SIZE(xRenderQueryPictIndexValuesReq
);
523 rc
= dixLookupResourceByType((pointer
*) &pFormat
, stuff
->format
,
524 PictFormatType
, client
, DixReadAccess
);
528 if (pFormat
->type
!= PictTypeIndexed
) {
529 client
->errorValue
= stuff
->format
;
532 num
= pFormat
->index
.nvalues
;
533 rlength
= (sizeof(xRenderQueryPictIndexValuesReply
) +
534 num
* sizeof(xIndexValue
));
535 reply
= (xRenderQueryPictIndexValuesReply
*) calloc(1, rlength
);
539 reply
->type
= X_Reply
;
540 reply
->sequenceNumber
= client
->sequence
;
541 reply
->length
= bytes_to_int32(rlength
- sizeof(xGenericReply
));
542 reply
->numIndexValues
= num
;
544 values
= (xIndexValue
*) (reply
+ 1);
546 memcpy(reply
+ 1, pFormat
->index
.pValues
, num
* sizeof(xIndexValue
));
548 if (client
->swapped
) {
549 for (i
= 0; i
< num
; i
++) {
550 swapl(&values
[i
].pixel
);
551 swaps(&values
[i
].red
);
552 swaps(&values
[i
].green
);
553 swaps(&values
[i
].blue
);
554 swaps(&values
[i
].alpha
);
556 swaps(&reply
->sequenceNumber
);
557 swapl(&reply
->length
);
558 swapl(&reply
->numIndexValues
);
561 WriteToClient(client
, rlength
, reply
);
567 ProcRenderQueryDithers(ClientPtr client
)
569 return BadImplementation
;
573 ProcRenderCreatePicture(ClientPtr client
)
576 DrawablePtr pDrawable
;
577 PictFormatPtr pFormat
;
580 REQUEST(xRenderCreatePictureReq
);
582 REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq
);
584 LEGAL_NEW_RESOURCE(stuff
->pid
, client
);
585 rc
= dixLookupDrawable(&pDrawable
, stuff
->drawable
, client
, 0,
586 DixReadAccess
| DixAddAccess
);
590 rc
= dixLookupResourceByType((pointer
*) &pFormat
, stuff
->format
,
591 PictFormatType
, client
, DixReadAccess
);
595 if (pFormat
->depth
!= pDrawable
->depth
)
597 len
= client
->req_len
- bytes_to_int32(sizeof(xRenderCreatePictureReq
));
598 if (Ones(stuff
->mask
) != len
)
601 pPicture
= CreatePicture(stuff
->pid
,
604 stuff
->mask
, (XID
*) (stuff
+ 1), client
, &error
);
607 if (!AddResource(stuff
->pid
, PictureType
, (pointer
) pPicture
))
613 ProcRenderChangePicture(ClientPtr client
)
617 REQUEST(xRenderChangePictureReq
);
620 REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq
);
621 VERIFY_PICTURE(pPicture
, stuff
->picture
, client
, DixSetAttrAccess
);
623 len
= client
->req_len
- bytes_to_int32(sizeof(xRenderChangePictureReq
));
624 if (Ones(stuff
->mask
) != len
)
627 return ChangePicture(pPicture
, stuff
->mask
, (XID
*) (stuff
+ 1),
628 (DevUnion
*) 0, client
);
632 ProcRenderSetPictureClipRectangles(ClientPtr client
)
634 REQUEST(xRenderSetPictureClipRectanglesReq
);
638 REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq
);
639 VERIFY_PICTURE(pPicture
, stuff
->picture
, client
, DixSetAttrAccess
);
640 if (!pPicture
->pDrawable
)
643 nr
= (client
->req_len
<< 2) - sizeof(xRenderSetPictureClipRectanglesReq
);
647 return SetPictureClipRects(pPicture
,
648 stuff
->xOrigin
, stuff
->yOrigin
,
649 nr
, (xRectangle
*) &stuff
[1]);
653 ProcRenderFreePicture(ClientPtr client
)
657 REQUEST(xRenderFreePictureReq
);
659 REQUEST_SIZE_MATCH(xRenderFreePictureReq
);
661 VERIFY_PICTURE(pPicture
, stuff
->picture
, client
, DixDestroyAccess
);
662 FreeResource(stuff
->picture
, RT_NONE
);
667 PictOpValid(CARD8 op
)
669 if ( /*PictOpMinimum <= op && */ op
<= PictOpMaximum
)
671 if (PictOpDisjointMinimum
<= op
&& op
<= PictOpDisjointMaximum
)
673 if (PictOpConjointMinimum
<= op
&& op
<= PictOpConjointMaximum
)
675 if (PictOpBlendMinimum
<= op
&& op
<= PictOpBlendMaximum
)
681 ProcRenderComposite(ClientPtr client
)
683 PicturePtr pSrc
, pMask
, pDst
;
685 REQUEST(xRenderCompositeReq
);
687 REQUEST_SIZE_MATCH(xRenderCompositeReq
);
688 if (!PictOpValid(stuff
->op
)) {
689 client
->errorValue
= stuff
->op
;
692 VERIFY_PICTURE(pDst
, stuff
->dst
, client
, DixWriteAccess
);
693 if (!pDst
->pDrawable
)
695 VERIFY_PICTURE(pSrc
, stuff
->src
, client
, DixReadAccess
);
696 VERIFY_ALPHA(pMask
, stuff
->mask
, client
, DixReadAccess
);
697 if ((pSrc
->pDrawable
&&
698 pSrc
->pDrawable
->pScreen
!= pDst
->pDrawable
->pScreen
) || (pMask
&&
708 CompositePicture(stuff
->op
,
716 stuff
->xDst
, stuff
->yDst
, stuff
->width
, stuff
->height
);
721 ProcRenderScale(ClientPtr client
)
723 return BadImplementation
;
727 ProcRenderTrapezoids(ClientPtr client
)
730 PicturePtr pSrc
, pDst
;
731 PictFormatPtr pFormat
;
733 REQUEST(xRenderTrapezoidsReq
);
735 REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq
);
736 if (!PictOpValid(stuff
->op
)) {
737 client
->errorValue
= stuff
->op
;
740 VERIFY_PICTURE(pSrc
, stuff
->src
, client
, DixReadAccess
);
741 VERIFY_PICTURE(pDst
, stuff
->dst
, client
, DixWriteAccess
);
742 if (!pDst
->pDrawable
)
744 if (pSrc
->pDrawable
&& pSrc
->pDrawable
->pScreen
!= pDst
->pDrawable
->pScreen
)
746 if (stuff
->maskFormat
) {
747 rc
= dixLookupResourceByType((pointer
*) &pFormat
, stuff
->maskFormat
,
748 PictFormatType
, client
, DixReadAccess
);
754 ntraps
= (client
->req_len
<< 2) - sizeof(xRenderTrapezoidsReq
);
755 if (ntraps
% sizeof(xTrapezoid
))
757 ntraps
/= sizeof(xTrapezoid
);
759 CompositeTrapezoids(stuff
->op
, pSrc
, pDst
, pFormat
,
760 stuff
->xSrc
, stuff
->ySrc
,
761 ntraps
, (xTrapezoid
*) &stuff
[1]);
766 ProcRenderTriangles(ClientPtr client
)
769 PicturePtr pSrc
, pDst
;
770 PictFormatPtr pFormat
;
772 REQUEST(xRenderTrianglesReq
);
774 REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq
);
775 if (!PictOpValid(stuff
->op
)) {
776 client
->errorValue
= stuff
->op
;
779 VERIFY_PICTURE(pSrc
, stuff
->src
, client
, DixReadAccess
);
780 VERIFY_PICTURE(pDst
, stuff
->dst
, client
, DixWriteAccess
);
781 if (!pDst
->pDrawable
)
783 if (pSrc
->pDrawable
&& pSrc
->pDrawable
->pScreen
!= pDst
->pDrawable
->pScreen
)
785 if (stuff
->maskFormat
) {
786 rc
= dixLookupResourceByType((pointer
*) &pFormat
, stuff
->maskFormat
,
787 PictFormatType
, client
, DixReadAccess
);
793 ntris
= (client
->req_len
<< 2) - sizeof(xRenderTrianglesReq
);
794 if (ntris
% sizeof(xTriangle
))
796 ntris
/= sizeof(xTriangle
);
798 CompositeTriangles(stuff
->op
, pSrc
, pDst
, pFormat
,
799 stuff
->xSrc
, stuff
->ySrc
,
800 ntris
, (xTriangle
*) &stuff
[1]);
805 ProcRenderTriStrip(ClientPtr client
)
808 PicturePtr pSrc
, pDst
;
809 PictFormatPtr pFormat
;
811 REQUEST(xRenderTrianglesReq
);
813 REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq
);
814 if (!PictOpValid(stuff
->op
)) {
815 client
->errorValue
= stuff
->op
;
818 VERIFY_PICTURE(pSrc
, stuff
->src
, client
, DixReadAccess
);
819 VERIFY_PICTURE(pDst
, stuff
->dst
, client
, DixWriteAccess
);
820 if (!pDst
->pDrawable
)
822 if (pSrc
->pDrawable
&& pSrc
->pDrawable
->pScreen
!= pDst
->pDrawable
->pScreen
)
824 if (stuff
->maskFormat
) {
825 rc
= dixLookupResourceByType((pointer
*) &pFormat
, stuff
->maskFormat
,
826 PictFormatType
, client
, DixReadAccess
);
832 npoints
= ((client
->req_len
<< 2) - sizeof(xRenderTriStripReq
));
837 CompositeTriStrip(stuff
->op
, pSrc
, pDst
, pFormat
,
838 stuff
->xSrc
, stuff
->ySrc
,
839 npoints
, (xPointFixed
*) &stuff
[1]);
844 ProcRenderTriFan(ClientPtr client
)
847 PicturePtr pSrc
, pDst
;
848 PictFormatPtr pFormat
;
850 REQUEST(xRenderTrianglesReq
);
852 REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq
);
853 if (!PictOpValid(stuff
->op
)) {
854 client
->errorValue
= stuff
->op
;
857 VERIFY_PICTURE(pSrc
, stuff
->src
, client
, DixReadAccess
);
858 VERIFY_PICTURE(pDst
, stuff
->dst
, client
, DixWriteAccess
);
859 if (!pDst
->pDrawable
)
861 if (pSrc
->pDrawable
&& pSrc
->pDrawable
->pScreen
!= pDst
->pDrawable
->pScreen
)
863 if (stuff
->maskFormat
) {
864 rc
= dixLookupResourceByType((pointer
*) &pFormat
, stuff
->maskFormat
,
865 PictFormatType
, client
, DixReadAccess
);
871 npoints
= ((client
->req_len
<< 2) - sizeof(xRenderTriStripReq
));
876 CompositeTriFan(stuff
->op
, pSrc
, pDst
, pFormat
,
877 stuff
->xSrc
, stuff
->ySrc
,
878 npoints
, (xPointFixed
*) &stuff
[1]);
883 ProcRenderColorTrapezoids(ClientPtr client
)
885 return BadImplementation
;
889 ProcRenderColorTriangles(ClientPtr client
)
891 return BadImplementation
;
895 ProcRenderTransform(ClientPtr client
)
897 return BadImplementation
;
901 ProcRenderCreateGlyphSet(ClientPtr client
)
903 GlyphSetPtr glyphSet
;
904 PictFormatPtr format
;
907 REQUEST(xRenderCreateGlyphSetReq
);
909 REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq
);
911 LEGAL_NEW_RESOURCE(stuff
->gsid
, client
);
912 rc
= dixLookupResourceByType((pointer
*) &format
, stuff
->format
,
913 PictFormatType
, client
, DixReadAccess
);
917 switch (format
->depth
) {
936 if (format
->type
!= PictTypeDirect
)
938 glyphSet
= AllocateGlyphSet(f
, format
);
941 /* security creation/labeling check */
942 rc
= XaceHook(XACE_RESOURCE_ACCESS
, client
, stuff
->gsid
, GlyphSetType
,
943 glyphSet
, RT_NONE
, NULL
, DixCreateAccess
);
946 if (!AddResource(stuff
->gsid
, GlyphSetType
, (pointer
) glyphSet
))
952 ProcRenderReferenceGlyphSet(ClientPtr client
)
954 GlyphSetPtr glyphSet
;
957 REQUEST(xRenderReferenceGlyphSetReq
);
959 REQUEST_SIZE_MATCH(xRenderReferenceGlyphSetReq
);
961 LEGAL_NEW_RESOURCE(stuff
->gsid
, client
);
963 rc
= dixLookupResourceByType((pointer
*) &glyphSet
, stuff
->existing
,
964 GlyphSetType
, client
, DixGetAttrAccess
);
966 client
->errorValue
= stuff
->existing
;
970 if (!AddResource(stuff
->gsid
, GlyphSetType
, (pointer
) glyphSet
))
975 #define NLOCALDELTA 64
976 #define NLOCALGLYPH 256
979 ProcRenderFreeGlyphSet(ClientPtr client
)
981 GlyphSetPtr glyphSet
;
984 REQUEST(xRenderFreeGlyphSetReq
);
986 REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq
);
987 rc
= dixLookupResourceByType((pointer
*) &glyphSet
, stuff
->glyphset
,
988 GlyphSetType
, client
, DixDestroyAccess
);
990 client
->errorValue
= stuff
->glyphset
;
993 FreeResource(stuff
->glyphset
, RT_NONE
);
997 typedef struct _GlyphNew
{
1001 unsigned char sha1
[20];
1002 } GlyphNewRec
, *GlyphNewPtr
;
1004 #define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
1007 ProcRenderAddGlyphs(ClientPtr client
)
1009 GlyphSetPtr glyphSet
;
1011 REQUEST(xRenderAddGlyphsReq
);
1012 GlyphNewRec glyphsLocal
[NLOCALGLYPH
];
1013 GlyphNewPtr glyphsBase
, glyphs
, glyph_new
;
1014 int remain
, nglyphs
;
1021 PicturePtr pSrc
= NULL
, pDst
= NULL
;
1022 PixmapPtr pSrcPix
= NULL
, pDstPix
= NULL
;
1023 CARD32 component_alpha
;
1025 REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq
);
1027 dixLookupResourceByType((pointer
*) &glyphSet
, stuff
->glyphset
,
1028 GlyphSetType
, client
, DixAddAccess
);
1029 if (err
!= Success
) {
1030 client
->errorValue
= stuff
->glyphset
;
1035 nglyphs
= stuff
->nglyphs
;
1036 if (nglyphs
> UINT32_MAX
/ sizeof(GlyphNewRec
))
1039 component_alpha
= NeedsComponent(glyphSet
->format
->format
);
1041 if (nglyphs
<= NLOCALGLYPH
) {
1042 memset(glyphsLocal
, 0, sizeof(glyphsLocal
));
1043 glyphsBase
= glyphsLocal
;
1046 glyphsBase
= (GlyphNewPtr
) calloc(nglyphs
, sizeof(GlyphNewRec
));
1051 remain
= (client
->req_len
<< 2) - sizeof(xRenderAddGlyphsReq
);
1053 glyphs
= glyphsBase
;
1055 gids
= (CARD32
*) (stuff
+ 1);
1056 gi
= (xGlyphInfo
*) (gids
+ nglyphs
);
1057 bits
= (CARD8
*) (gi
+ nglyphs
);
1058 remain
-= (sizeof(CARD32
) + sizeof(xGlyphInfo
)) * nglyphs
;
1060 /* protect against bad nglyphs */
1061 if (gi
< ((xGlyphInfo
*) stuff
) ||
1062 gi
> ((xGlyphInfo
*) ((CARD32
*) stuff
+ client
->req_len
)) ||
1063 bits
< ((CARD8
*) stuff
) ||
1064 bits
> ((CARD8
*) ((CARD32
*) stuff
+ client
->req_len
))) {
1069 for (i
= 0; i
< nglyphs
; i
++) {
1070 size_t padded_width
;
1072 glyph_new
= &glyphs
[i
];
1074 padded_width
= PixmapBytePad(gi
[i
].width
, glyphSet
->format
->depth
);
1077 padded_width
> (UINT32_MAX
- sizeof(GlyphRec
)) / gi
[i
].height
)
1080 size
= gi
[i
].height
* padded_width
;
1084 err
= HashGlyph(&gi
[i
], bits
, size
, glyph_new
->sha1
);
1088 glyph_new
->glyph
= FindGlyphByHash(glyph_new
->sha1
, glyphSet
->fdepth
);
1090 if (glyph_new
->glyph
&& glyph_new
->glyph
!= DeletedGlyph
) {
1091 glyph_new
->found
= TRUE
;
1096 glyph_new
->found
= FALSE
;
1097 glyph_new
->glyph
= glyph
= AllocateGlyph(&gi
[i
], glyphSet
->fdepth
);
1103 for (screen
= 0; screen
< screenInfo
.numScreens
; screen
++) {
1104 int width
= gi
[i
].width
;
1105 int height
= gi
[i
].height
;
1106 int depth
= glyphSet
->format
->depth
;
1110 /* Skip work if it's invisibly small anyway */
1111 if (!width
|| !height
)
1114 pScreen
= screenInfo
.screens
[screen
];
1115 pSrcPix
= GetScratchPixmapHeader(pScreen
,
1117 depth
, depth
, -1, bits
);
1123 pSrc
= CreatePicture(0, &pSrcPix
->drawable
,
1124 glyphSet
->format
, 0, NULL
,
1125 serverClient
, &error
);
1131 pDstPix
= (pScreen
->CreatePixmap
) (pScreen
,
1132 width
, height
, depth
,
1133 CREATE_PIXMAP_USAGE_GLYPH_PICTURE
);
1140 pDst
= CreatePicture(0, &pDstPix
->drawable
,
1142 CPComponentAlpha
, &component_alpha
,
1143 serverClient
, &error
);
1144 SetGlyphPicture(glyph
, pScreen
, pDst
);
1146 /* The picture takes a reference to the pixmap, so we
1148 (pScreen
->DestroyPixmap
) (pDstPix
);
1156 CompositePicture(PictOpSrc
,
1158 None
, pDst
, 0, 0, 0, 0, 0, 0, width
, height
);
1160 FreePicture((pointer
) pSrc
, 0);
1162 FreeScratchPixmapHeader(pSrcPix
);
1166 memcpy(glyph_new
->glyph
->sha1
, glyph_new
->sha1
, 20);
1169 glyph_new
->id
= gids
[i
];
1172 size
+= 4 - (size
& 3);
1176 if (remain
|| i
< nglyphs
) {
1180 if (!ResizeGlyphSet(glyphSet
, nglyphs
)) {
1184 for (i
= 0; i
< nglyphs
; i
++)
1185 AddGlyph(glyphSet
, glyphs
[i
].glyph
, glyphs
[i
].id
);
1187 if (glyphsBase
!= glyphsLocal
)
1192 FreePicture((pointer
) pSrc
, 0);
1194 FreeScratchPixmapHeader(pSrcPix
);
1195 for (i
= 0; i
< nglyphs
; i
++)
1196 if (glyphs
[i
].glyph
&& !glyphs
[i
].found
)
1197 free(glyphs
[i
].glyph
);
1198 if (glyphsBase
!= glyphsLocal
)
1204 ProcRenderAddGlyphsFromPicture(ClientPtr client
)
1206 return BadImplementation
;
1210 ProcRenderFreeGlyphs(ClientPtr client
)
1212 REQUEST(xRenderFreeGlyphsReq
);
1213 GlyphSetPtr glyphSet
;
1218 REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq
);
1219 rc
= dixLookupResourceByType((pointer
*) &glyphSet
, stuff
->glyphset
,
1220 GlyphSetType
, client
, DixRemoveAccess
);
1221 if (rc
!= Success
) {
1222 client
->errorValue
= stuff
->glyphset
;
1226 bytes_to_int32((client
->req_len
<< 2) - sizeof(xRenderFreeGlyphsReq
));
1227 gids
= (CARD32
*) (stuff
+ 1);
1228 while (nglyph
-- > 0) {
1230 if (!DeleteGlyph(glyphSet
, glyph
)) {
1231 client
->errorValue
= glyph
;
1232 return RenderErrBase
+ BadGlyph
;
1239 ProcRenderCompositeGlyphs(ClientPtr client
)
1241 GlyphSetPtr glyphSet
;
1243 PicturePtr pSrc
, pDst
;
1244 PictFormatPtr pFormat
;
1245 GlyphListRec listsLocal
[NLOCALDELTA
];
1246 GlyphListPtr lists
, listsBase
;
1247 GlyphPtr glyphsLocal
[NLOCALGLYPH
];
1249 GlyphPtr
*glyphs
, *glyphsBase
;
1251 CARD8
*buffer
, *end
;
1258 REQUEST(xRenderCompositeGlyphsReq
);
1260 REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq
);
1262 switch (stuff
->renderReqType
) {
1266 case X_RenderCompositeGlyphs16
:
1269 case X_RenderCompositeGlyphs32
:
1274 if (!PictOpValid(stuff
->op
)) {
1275 client
->errorValue
= stuff
->op
;
1278 VERIFY_PICTURE(pSrc
, stuff
->src
, client
, DixReadAccess
);
1279 VERIFY_PICTURE(pDst
, stuff
->dst
, client
, DixWriteAccess
);
1280 if (!pDst
->pDrawable
)
1282 if (pSrc
->pDrawable
&& pSrc
->pDrawable
->pScreen
!= pDst
->pDrawable
->pScreen
)
1284 if (stuff
->maskFormat
) {
1285 rc
= dixLookupResourceByType((pointer
*) &pFormat
, stuff
->maskFormat
,
1286 PictFormatType
, client
, DixReadAccess
);
1293 rc
= dixLookupResourceByType((pointer
*) &glyphSet
, stuff
->glyphset
,
1294 GlyphSetType
, client
, DixUseAccess
);
1298 buffer
= (CARD8
*) (stuff
+ 1);
1299 end
= (CARD8
*) stuff
+ (client
->req_len
<< 2);
1302 while (buffer
+ sizeof(xGlyphElt
) < end
) {
1303 elt
= (xGlyphElt
*) buffer
;
1304 buffer
+= sizeof(xGlyphElt
);
1306 if (elt
->len
== 0xff) {
1312 space
= size
* elt
->len
;
1314 space
+= 4 - (space
& 3);
1318 if (nglyph
<= NLOCALGLYPH
)
1319 glyphsBase
= glyphsLocal
;
1321 glyphsBase
= (GlyphPtr
*) malloc(nglyph
* sizeof(GlyphPtr
));
1325 if (nlist
<= NLOCALDELTA
)
1326 listsBase
= listsLocal
;
1328 listsBase
= (GlyphListPtr
) malloc(nlist
* sizeof(GlyphListRec
));
1334 buffer
= (CARD8
*) (stuff
+ 1);
1335 glyphs
= glyphsBase
;
1337 while (buffer
+ sizeof(xGlyphElt
) < end
) {
1338 elt
= (xGlyphElt
*) buffer
;
1339 buffer
+= sizeof(xGlyphElt
);
1341 if (elt
->len
== 0xff) {
1342 if (buffer
+ sizeof(GlyphSet
) < end
) {
1343 memcpy(&gs
, buffer
, sizeof(GlyphSet
));
1344 rc
= dixLookupResourceByType((pointer
*) &glyphSet
, gs
,
1345 GlyphSetType
, client
,
1353 lists
->xOff
= elt
->deltax
;
1354 lists
->yOff
= elt
->deltay
;
1355 lists
->format
= glyphSet
->format
;
1359 if (buffer
+ size
<= end
) {
1362 glyph
= *((CARD8
*) buffer
);
1365 glyph
= *((CARD16
*) buffer
);
1369 glyph
= *((CARD32
*) buffer
);
1372 if ((*glyphs
= FindGlyph(glyphSet
, glyph
))) {
1379 space
= size
* elt
->len
;
1381 buffer
+= 4 - (space
& 3);
1390 CompositeGlyphs(stuff
->op
,
1394 stuff
->xSrc
, stuff
->ySrc
, nlist
, listsBase
, glyphsBase
);
1398 if (glyphsBase
!= glyphsLocal
)
1400 if (listsBase
!= listsLocal
)
1406 ProcRenderFillRectangles(ClientPtr client
)
1411 REQUEST(xRenderFillRectanglesReq
);
1413 REQUEST_AT_LEAST_SIZE(xRenderFillRectanglesReq
);
1414 if (!PictOpValid(stuff
->op
)) {
1415 client
->errorValue
= stuff
->op
;
1418 VERIFY_PICTURE(pDst
, stuff
->dst
, client
, DixWriteAccess
);
1419 if (!pDst
->pDrawable
)
1422 things
= (client
->req_len
<< 2) - sizeof(xRenderFillRectanglesReq
);
1427 CompositeRects(stuff
->op
,
1428 pDst
, &stuff
->color
, things
, (xRectangle
*) &stuff
[1]);
1434 RenderSetBit(unsigned char *line
, int x
, int bit
)
1438 if (screenInfo
.bitmapBitOrder
== LSBFirst
)
1439 mask
= (1 << (x
& 7));
1441 mask
= (0x80 >> (x
& 7));
1442 /* XXX assumes byte order is host byte order */
1450 #define DITHER_DIM 2
1452 static CARD32 orderedDither
[DITHER_DIM
][DITHER_DIM
] = {
1457 #define DITHER_SIZE ((sizeof orderedDither / sizeof orderedDither[0][0]) + 1)
1460 ProcRenderCreateCursor(ClientPtr client
)
1462 REQUEST(xRenderCreateCursorReq
);
1465 unsigned short width
, height
;
1466 CARD32
*argbbits
, *argb
;
1467 unsigned char *srcbits
, *srcline
;
1468 unsigned char *mskbits
, *mskline
;
1477 REQUEST_SIZE_MATCH(xRenderCreateCursorReq
);
1478 LEGAL_NEW_RESOURCE(stuff
->cid
, client
);
1480 VERIFY_PICTURE(pSrc
, stuff
->src
, client
, DixReadAccess
);
1481 if (!pSrc
->pDrawable
)
1483 pScreen
= pSrc
->pDrawable
->pScreen
;
1484 width
= pSrc
->pDrawable
->width
;
1485 height
= pSrc
->pDrawable
->height
;
1486 if (height
&& width
> UINT32_MAX
/ (height
* sizeof(CARD32
)))
1488 if (stuff
->x
> width
|| stuff
->y
> height
)
1490 argbbits
= malloc(width
* height
* sizeof(CARD32
));
1494 stride
= BitmapBytePad(width
);
1495 nbytes_mono
= stride
* height
;
1496 srcbits
= calloc(1, nbytes_mono
);
1501 mskbits
= calloc(1, nbytes_mono
);
1508 if (pSrc
->format
== PICT_a8r8g8b8
) {
1509 (*pScreen
->GetImage
) (pSrc
->pDrawable
,
1510 0, 0, width
, height
, ZPixmap
,
1511 0xffffffff, (pointer
) argbbits
);
1515 PicturePtr pPicture
;
1516 PictFormatPtr pFormat
;
1519 pFormat
= PictureMatchFormat(pScreen
, 32, PICT_a8r8g8b8
);
1524 return BadImplementation
;
1526 pPixmap
= (*pScreen
->CreatePixmap
) (pScreen
, width
, height
, 32,
1527 CREATE_PIXMAP_USAGE_SCRATCH
);
1534 pPicture
= CreatePicture(0, &pPixmap
->drawable
, pFormat
, 0, 0,
1542 (*pScreen
->DestroyPixmap
) (pPixmap
);
1543 CompositePicture(PictOpSrc
,
1544 pSrc
, 0, pPicture
, 0, 0, 0, 0, 0, 0, width
, height
);
1545 (*pScreen
->GetImage
) (pPicture
->pDrawable
,
1546 0, 0, width
, height
, ZPixmap
,
1547 0xffffffff, (pointer
) argbbits
);
1548 FreePicture(pPicture
, 0);
1551 * Check whether the cursor can be directly supported by
1552 * the core cursor code
1556 for (y
= 0; ncolor
<= 2 && y
< height
; y
++) {
1557 for (x
= 0; ncolor
<= 2 && x
< width
; x
++) {
1559 CARD32 a
= (p
>> 24);
1561 if (a
== 0) /* transparent */
1563 if (a
== 0xff) { /* opaque */
1566 for (n
= 0; n
< ncolor
; n
++)
1567 if (p
== twocolor
[n
])
1570 twocolor
[ncolor
++] = p
;
1578 * Convert argb image to two plane cursor
1583 for (y
= 0; y
< height
; y
++) {
1584 for (x
= 0; x
< width
; x
++) {
1588 CARD32 a
= ((p
>> 24));
1590 RenderSetBit(mskline
, x
, a
!= 0);
1591 RenderSetBit(srcline
, x
, a
!= 0 && p
== twocolor
[0]);
1594 CARD32 a
= ((p
>> 24) * DITHER_SIZE
+ 127) / 255;
1595 CARD32 i
= ((CvtR8G8B8toY15(p
) >> 7) * DITHER_SIZE
+ 127) / 255;
1597 orderedDither
[y
& (DITHER_DIM
- 1)][x
& (DITHER_DIM
- 1)];
1598 /* Set mask from dithered alpha value */
1599 RenderSetBit(mskline
, x
, a
> d
);
1600 /* Set src from dithered intensity value */
1601 RenderSetBit(srcline
, x
, a
> d
&& i
<= d
);
1608 * Dither to white and black if the cursor has more than two colors
1611 twocolor
[0] = 0xff000000;
1612 twocolor
[1] = 0xffffffff;
1619 #define GetByte(p,s) (((p) >> (s)) & 0xff)
1620 #define GetColor(p,s) (GetByte(p,s) | (GetByte(p,s) << 8))
1626 rc
= AllocARGBCursor(srcbits
, mskbits
, argbbits
, &cm
,
1627 GetColor(twocolor
[0], 16),
1628 GetColor(twocolor
[0], 8),
1629 GetColor(twocolor
[0], 0),
1630 GetColor(twocolor
[1], 16),
1631 GetColor(twocolor
[1], 8),
1632 GetColor(twocolor
[1], 0),
1633 &pCursor
, client
, stuff
->cid
);
1636 if (!AddResource(stuff
->cid
, RT_CURSOR
, (pointer
) pCursor
)) {
1649 ProcRenderSetPictureTransform(ClientPtr client
)
1651 REQUEST(xRenderSetPictureTransformReq
);
1652 PicturePtr pPicture
;
1654 REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq
);
1655 VERIFY_PICTURE(pPicture
, stuff
->picture
, client
, DixSetAttrAccess
);
1656 return SetPictureTransform(pPicture
, (PictTransform
*) &stuff
->transform
);
1660 ProcRenderQueryFilters(ClientPtr client
)
1662 REQUEST(xRenderQueryFiltersReq
);
1663 DrawablePtr pDrawable
;
1664 xRenderQueryFiltersReply
*reply
;
1668 PictureScreenPtr ps
;
1669 int i
, j
, len
, total_bytes
, rc
;
1673 REQUEST_SIZE_MATCH(xRenderQueryFiltersReq
);
1674 rc
= dixLookupDrawable(&pDrawable
, stuff
->drawable
, client
, 0,
1679 pScreen
= pDrawable
->pScreen
;
1682 ps
= GetPictureScreenIfSet(pScreen
);
1684 for (i
= 0; i
< ps
->nfilters
; i
++)
1685 nbytesName
+= 1 + strlen(ps
->filters
[i
].name
);
1686 for (i
= 0; i
< ps
->nfilterAliases
; i
++)
1687 nbytesName
+= 1 + strlen(ps
->filterAliases
[i
].alias
);
1688 nnames
= ps
->nfilters
+ ps
->nfilterAliases
;
1690 len
= ((nnames
+ 1) >> 1) + bytes_to_int32(nbytesName
);
1691 total_bytes
= sizeof(xRenderQueryFiltersReply
) + (len
<< 2);
1692 reply
= (xRenderQueryFiltersReply
*) calloc(1, total_bytes
);
1695 aliases
= (INT16
*) (reply
+ 1);
1696 names
= (char *) (aliases
+ ((nnames
+ 1) & ~1));
1698 reply
->type
= X_Reply
;
1699 reply
->sequenceNumber
= client
->sequence
;
1700 reply
->length
= len
;
1701 reply
->numAliases
= nnames
;
1702 reply
->numFilters
= nnames
;
1705 /* fill in alias values */
1706 for (i
= 0; i
< ps
->nfilters
; i
++)
1707 aliases
[i
] = FilterAliasNone
;
1708 for (i
= 0; i
< ps
->nfilterAliases
; i
++) {
1709 for (j
= 0; j
< ps
->nfilters
; j
++)
1710 if (ps
->filterAliases
[i
].filter_id
== ps
->filters
[j
].id
)
1712 if (j
== ps
->nfilters
) {
1713 for (j
= 0; j
< ps
->nfilterAliases
; j
++)
1714 if (ps
->filterAliases
[i
].filter_id
==
1715 ps
->filterAliases
[j
].alias_id
) {
1718 if (j
== ps
->nfilterAliases
)
1719 j
= FilterAliasNone
;
1721 j
= j
+ ps
->nfilters
;
1723 aliases
[i
+ ps
->nfilters
] = j
;
1726 /* fill in filter names */
1727 for (i
= 0; i
< ps
->nfilters
; i
++) {
1728 j
= strlen(ps
->filters
[i
].name
);
1730 memcpy(names
, ps
->filters
[i
].name
, j
);
1734 /* fill in filter alias names */
1735 for (i
= 0; i
< ps
->nfilterAliases
; i
++) {
1736 j
= strlen(ps
->filterAliases
[i
].alias
);
1738 memcpy(names
, ps
->filterAliases
[i
].alias
, j
);
1743 if (client
->swapped
) {
1744 for (i
= 0; i
< reply
->numAliases
; i
++) {
1747 swaps(&reply
->sequenceNumber
);
1748 swapl(&reply
->length
);
1749 swapl(&reply
->numAliases
);
1750 swapl(&reply
->numFilters
);
1752 WriteToClient(client
, total_bytes
, reply
);
1759 ProcRenderSetPictureFilter(ClientPtr client
)
1761 REQUEST(xRenderSetPictureFilterReq
);
1762 PicturePtr pPicture
;
1768 REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq
);
1769 VERIFY_PICTURE(pPicture
, stuff
->picture
, client
, DixSetAttrAccess
);
1770 name
= (char *) (stuff
+ 1);
1771 params
= (xFixed
*) (name
+ pad_to_int32(stuff
->nbytes
));
1772 nparams
= ((xFixed
*) stuff
+ client
->req_len
) - params
;
1773 result
= SetPictureFilter(pPicture
, name
, stuff
->nbytes
, params
, nparams
);
1778 ProcRenderCreateAnimCursor(ClientPtr client
)
1780 REQUEST(xRenderCreateAnimCursorReq
);
1785 xAnimCursorElt
*elt
;
1789 REQUEST_AT_LEAST_SIZE(xRenderCreateAnimCursorReq
);
1790 LEGAL_NEW_RESOURCE(stuff
->cid
, client
);
1791 if (client
->req_len
& 1)
1795 (bytes_to_int32(sizeof(xRenderCreateAnimCursorReq
)))) >> 1;
1796 cursors
= malloc(ncursor
* (sizeof(CursorPtr
) + sizeof(CARD32
)));
1799 deltas
= (CARD32
*) (cursors
+ ncursor
);
1800 elt
= (xAnimCursorElt
*) (stuff
+ 1);
1801 for (i
= 0; i
< ncursor
; i
++) {
1802 ret
= dixLookupResourceByType((pointer
*) (cursors
+ i
), elt
->cursor
,
1803 RT_CURSOR
, client
, DixReadAccess
);
1804 if (ret
!= Success
) {
1808 deltas
[i
] = elt
->delay
;
1811 ret
= AnimCursorCreate(cursors
, deltas
, ncursor
, &pCursor
, client
,
1817 if (AddResource(stuff
->cid
, RT_CURSOR
, (pointer
) pCursor
))
1823 ProcRenderAddTraps(ClientPtr client
)
1826 PicturePtr pPicture
;
1828 REQUEST(xRenderAddTrapsReq
);
1830 REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq
);
1831 VERIFY_PICTURE(pPicture
, stuff
->picture
, client
, DixWriteAccess
);
1832 if (!pPicture
->pDrawable
)
1834 ntraps
= (client
->req_len
<< 2) - sizeof(xRenderAddTrapsReq
);
1835 if (ntraps
% sizeof(xTrap
))
1837 ntraps
/= sizeof(xTrap
);
1840 stuff
->xOff
, stuff
->yOff
, ntraps
, (xTrap
*) &stuff
[1]);
1845 ProcRenderCreateSolidFill(ClientPtr client
)
1847 PicturePtr pPicture
;
1850 REQUEST(xRenderCreateSolidFillReq
);
1852 REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq
);
1854 LEGAL_NEW_RESOURCE(stuff
->pid
, client
);
1856 pPicture
= CreateSolidPicture(stuff
->pid
, &stuff
->color
, &error
);
1859 /* security creation/labeling check */
1860 error
= XaceHook(XACE_RESOURCE_ACCESS
, client
, stuff
->pid
, PictureType
,
1861 pPicture
, RT_NONE
, NULL
, DixCreateAccess
);
1862 if (error
!= Success
)
1864 if (!AddResource(stuff
->pid
, PictureType
, (pointer
) pPicture
))
1870 ProcRenderCreateLinearGradient(ClientPtr client
)
1872 PicturePtr pPicture
;
1876 xRenderColor
*colors
;
1878 REQUEST(xRenderCreateLinearGradientReq
);
1880 REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq
);
1882 LEGAL_NEW_RESOURCE(stuff
->pid
, client
);
1884 len
= (client
->req_len
<< 2) - sizeof(xRenderCreateLinearGradientReq
);
1885 if (stuff
->nStops
> UINT32_MAX
/ (sizeof(xFixed
) + sizeof(xRenderColor
)))
1887 if (len
!= stuff
->nStops
* (sizeof(xFixed
) + sizeof(xRenderColor
)))
1890 stops
= (xFixed
*) (stuff
+ 1);
1891 colors
= (xRenderColor
*) (stops
+ stuff
->nStops
);
1893 pPicture
= CreateLinearGradientPicture(stuff
->pid
, &stuff
->p1
, &stuff
->p2
,
1894 stuff
->nStops
, stops
, colors
,
1898 /* security creation/labeling check */
1899 error
= XaceHook(XACE_RESOURCE_ACCESS
, client
, stuff
->pid
, PictureType
,
1900 pPicture
, RT_NONE
, NULL
, DixCreateAccess
);
1901 if (error
!= Success
)
1903 if (!AddResource(stuff
->pid
, PictureType
, (pointer
) pPicture
))
1909 ProcRenderCreateRadialGradient(ClientPtr client
)
1911 PicturePtr pPicture
;
1915 xRenderColor
*colors
;
1917 REQUEST(xRenderCreateRadialGradientReq
);
1919 REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq
);
1921 LEGAL_NEW_RESOURCE(stuff
->pid
, client
);
1923 len
= (client
->req_len
<< 2) - sizeof(xRenderCreateRadialGradientReq
);
1924 if (len
!= stuff
->nStops
* (sizeof(xFixed
) + sizeof(xRenderColor
)))
1927 stops
= (xFixed
*) (stuff
+ 1);
1928 colors
= (xRenderColor
*) (stops
+ stuff
->nStops
);
1931 CreateRadialGradientPicture(stuff
->pid
, &stuff
->inner
, &stuff
->outer
,
1932 stuff
->inner_radius
, stuff
->outer_radius
,
1933 stuff
->nStops
, stops
, colors
, &error
);
1936 /* security creation/labeling check */
1937 error
= XaceHook(XACE_RESOURCE_ACCESS
, client
, stuff
->pid
, PictureType
,
1938 pPicture
, RT_NONE
, NULL
, DixCreateAccess
);
1939 if (error
!= Success
)
1941 if (!AddResource(stuff
->pid
, PictureType
, (pointer
) pPicture
))
1947 ProcRenderCreateConicalGradient(ClientPtr client
)
1949 PicturePtr pPicture
;
1953 xRenderColor
*colors
;
1955 REQUEST(xRenderCreateConicalGradientReq
);
1957 REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq
);
1959 LEGAL_NEW_RESOURCE(stuff
->pid
, client
);
1961 len
= (client
->req_len
<< 2) - sizeof(xRenderCreateConicalGradientReq
);
1962 if (len
!= stuff
->nStops
* (sizeof(xFixed
) + sizeof(xRenderColor
)))
1965 stops
= (xFixed
*) (stuff
+ 1);
1966 colors
= (xRenderColor
*) (stops
+ stuff
->nStops
);
1969 CreateConicalGradientPicture(stuff
->pid
, &stuff
->center
, stuff
->angle
,
1970 stuff
->nStops
, stops
, colors
, &error
);
1973 /* security creation/labeling check */
1974 error
= XaceHook(XACE_RESOURCE_ACCESS
, client
, stuff
->pid
, PictureType
,
1975 pPicture
, RT_NONE
, NULL
, DixCreateAccess
);
1976 if (error
!= Success
)
1978 if (!AddResource(stuff
->pid
, PictureType
, (pointer
) pPicture
))
1984 ProcRenderDispatch(ClientPtr client
)
1988 if (stuff
->data
< RenderNumberRequests
)
1989 return (*ProcRenderVector
[stuff
->data
]) (client
);
1995 SProcRenderQueryVersion(ClientPtr client
)
1997 REQUEST(xRenderQueryVersionReq
);
1999 swaps(&stuff
->length
);
2000 swapl(&stuff
->majorVersion
);
2001 swapl(&stuff
->minorVersion
);
2002 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2006 SProcRenderQueryPictFormats(ClientPtr client
)
2008 REQUEST(xRenderQueryPictFormatsReq
);
2009 swaps(&stuff
->length
);
2010 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2014 SProcRenderQueryPictIndexValues(ClientPtr client
)
2016 REQUEST(xRenderQueryPictIndexValuesReq
);
2017 swaps(&stuff
->length
);
2018 swapl(&stuff
->format
);
2019 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2023 SProcRenderQueryDithers(ClientPtr client
)
2025 return BadImplementation
;
2029 SProcRenderCreatePicture(ClientPtr client
)
2031 REQUEST(xRenderCreatePictureReq
);
2032 swaps(&stuff
->length
);
2034 swapl(&stuff
->drawable
);
2035 swapl(&stuff
->format
);
2036 swapl(&stuff
->mask
);
2038 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2042 SProcRenderChangePicture(ClientPtr client
)
2044 REQUEST(xRenderChangePictureReq
);
2045 swaps(&stuff
->length
);
2046 swapl(&stuff
->picture
);
2047 swapl(&stuff
->mask
);
2049 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2053 SProcRenderSetPictureClipRectangles(ClientPtr client
)
2055 REQUEST(xRenderSetPictureClipRectanglesReq
);
2056 swaps(&stuff
->length
);
2057 swapl(&stuff
->picture
);
2058 swaps(&stuff
->xOrigin
);
2059 swaps(&stuff
->yOrigin
);
2061 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2065 SProcRenderFreePicture(ClientPtr client
)
2067 REQUEST(xRenderFreePictureReq
);
2068 swaps(&stuff
->length
);
2069 swapl(&stuff
->picture
);
2070 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2074 SProcRenderComposite(ClientPtr client
)
2076 REQUEST(xRenderCompositeReq
);
2077 swaps(&stuff
->length
);
2079 swapl(&stuff
->mask
);
2081 swaps(&stuff
->xSrc
);
2082 swaps(&stuff
->ySrc
);
2083 swaps(&stuff
->xMask
);
2084 swaps(&stuff
->yMask
);
2085 swaps(&stuff
->xDst
);
2086 swaps(&stuff
->yDst
);
2087 swaps(&stuff
->width
);
2088 swaps(&stuff
->height
);
2089 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2093 SProcRenderScale(ClientPtr client
)
2095 REQUEST(xRenderScaleReq
);
2096 swaps(&stuff
->length
);
2099 swapl(&stuff
->colorScale
);
2100 swapl(&stuff
->alphaScale
);
2101 swaps(&stuff
->xSrc
);
2102 swaps(&stuff
->ySrc
);
2103 swaps(&stuff
->xDst
);
2104 swaps(&stuff
->yDst
);
2105 swaps(&stuff
->width
);
2106 swaps(&stuff
->height
);
2107 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2111 SProcRenderTrapezoids(ClientPtr client
)
2113 REQUEST(xRenderTrapezoidsReq
);
2115 REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq
);
2116 swaps(&stuff
->length
);
2119 swapl(&stuff
->maskFormat
);
2120 swaps(&stuff
->xSrc
);
2121 swaps(&stuff
->ySrc
);
2123 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2127 SProcRenderTriangles(ClientPtr client
)
2129 REQUEST(xRenderTrianglesReq
);
2131 REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq
);
2132 swaps(&stuff
->length
);
2135 swapl(&stuff
->maskFormat
);
2136 swaps(&stuff
->xSrc
);
2137 swaps(&stuff
->ySrc
);
2139 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2143 SProcRenderTriStrip(ClientPtr client
)
2145 REQUEST(xRenderTriStripReq
);
2147 REQUEST_AT_LEAST_SIZE(xRenderTriStripReq
);
2148 swaps(&stuff
->length
);
2151 swapl(&stuff
->maskFormat
);
2152 swaps(&stuff
->xSrc
);
2153 swaps(&stuff
->ySrc
);
2155 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2159 SProcRenderTriFan(ClientPtr client
)
2161 REQUEST(xRenderTriFanReq
);
2163 REQUEST_AT_LEAST_SIZE(xRenderTriFanReq
);
2164 swaps(&stuff
->length
);
2167 swapl(&stuff
->maskFormat
);
2168 swaps(&stuff
->xSrc
);
2169 swaps(&stuff
->ySrc
);
2171 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2175 SProcRenderColorTrapezoids(ClientPtr client
)
2177 return BadImplementation
;
2181 SProcRenderColorTriangles(ClientPtr client
)
2183 return BadImplementation
;
2187 SProcRenderTransform(ClientPtr client
)
2189 return BadImplementation
;
2193 SProcRenderCreateGlyphSet(ClientPtr client
)
2195 REQUEST(xRenderCreateGlyphSetReq
);
2196 swaps(&stuff
->length
);
2197 swapl(&stuff
->gsid
);
2198 swapl(&stuff
->format
);
2199 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2203 SProcRenderReferenceGlyphSet(ClientPtr client
)
2205 REQUEST(xRenderReferenceGlyphSetReq
);
2206 swaps(&stuff
->length
);
2207 swapl(&stuff
->gsid
);
2208 swapl(&stuff
->existing
);
2209 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2213 SProcRenderFreeGlyphSet(ClientPtr client
)
2215 REQUEST(xRenderFreeGlyphSetReq
);
2216 swaps(&stuff
->length
);
2217 swapl(&stuff
->glyphset
);
2218 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2222 SProcRenderAddGlyphs(ClientPtr client
)
2229 REQUEST(xRenderAddGlyphsReq
);
2230 swaps(&stuff
->length
);
2231 swapl(&stuff
->glyphset
);
2232 swapl(&stuff
->nglyphs
);
2233 if (stuff
->nglyphs
& 0xe0000000)
2235 end
= (CARD8
*) stuff
+ (client
->req_len
<< 2);
2236 gids
= (CARD32
*) (stuff
+ 1);
2237 gi
= (xGlyphInfo
*) (gids
+ stuff
->nglyphs
);
2238 if ((char *) end
- (char *) (gids
+ stuff
->nglyphs
) < 0)
2240 if ((char *) end
- (char *) (gi
+ stuff
->nglyphs
) < 0)
2242 for (i
= 0; i
< stuff
->nglyphs
; i
++) {
2244 swaps(&gi
[i
].width
);
2245 swaps(&gi
[i
].height
);
2251 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2255 SProcRenderAddGlyphsFromPicture(ClientPtr client
)
2257 return BadImplementation
;
2261 SProcRenderFreeGlyphs(ClientPtr client
)
2263 REQUEST(xRenderFreeGlyphsReq
);
2264 swaps(&stuff
->length
);
2265 swapl(&stuff
->glyphset
);
2267 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2271 SProcRenderCompositeGlyphs(ClientPtr client
)
2280 REQUEST(xRenderCompositeGlyphsReq
);
2282 switch (stuff
->renderReqType
) {
2286 case X_RenderCompositeGlyphs16
:
2289 case X_RenderCompositeGlyphs32
:
2294 swaps(&stuff
->length
);
2297 swapl(&stuff
->maskFormat
);
2298 swapl(&stuff
->glyphset
);
2299 swaps(&stuff
->xSrc
);
2300 swaps(&stuff
->ySrc
);
2301 buffer
= (CARD8
*) (stuff
+ 1);
2302 end
= (CARD8
*) stuff
+ (client
->req_len
<< 2);
2303 while (buffer
+ sizeof(xGlyphElt
) < end
) {
2304 elt
= (xGlyphElt
*) buffer
;
2305 buffer
+= sizeof(xGlyphElt
);
2307 swaps(&elt
->deltax
);
2308 swaps(&elt
->deltay
);
2312 swapl((int *) buffer
);
2323 swaps((short *) buffer
);
2329 swapl((int *) buffer
);
2335 buffer
+= 4 - (space
& 3);
2338 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2342 SProcRenderFillRectangles(ClientPtr client
)
2344 REQUEST(xRenderFillRectanglesReq
);
2346 REQUEST_AT_LEAST_SIZE(xRenderFillRectanglesReq
);
2347 swaps(&stuff
->length
);
2349 swaps(&stuff
->color
.red
);
2350 swaps(&stuff
->color
.green
);
2351 swaps(&stuff
->color
.blue
);
2352 swaps(&stuff
->color
.alpha
);
2354 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2358 SProcRenderCreateCursor(ClientPtr client
)
2360 REQUEST(xRenderCreateCursorReq
);
2361 REQUEST_SIZE_MATCH(xRenderCreateCursorReq
);
2363 swaps(&stuff
->length
);
2368 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2372 SProcRenderSetPictureTransform(ClientPtr client
)
2374 REQUEST(xRenderSetPictureTransformReq
);
2375 REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq
);
2377 swaps(&stuff
->length
);
2378 swapl(&stuff
->picture
);
2379 swapl(&stuff
->transform
.matrix11
);
2380 swapl(&stuff
->transform
.matrix12
);
2381 swapl(&stuff
->transform
.matrix13
);
2382 swapl(&stuff
->transform
.matrix21
);
2383 swapl(&stuff
->transform
.matrix22
);
2384 swapl(&stuff
->transform
.matrix23
);
2385 swapl(&stuff
->transform
.matrix31
);
2386 swapl(&stuff
->transform
.matrix32
);
2387 swapl(&stuff
->transform
.matrix33
);
2388 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2392 SProcRenderQueryFilters(ClientPtr client
)
2394 REQUEST(xRenderQueryFiltersReq
);
2395 REQUEST_SIZE_MATCH(xRenderQueryFiltersReq
);
2397 swaps(&stuff
->length
);
2398 swapl(&stuff
->drawable
);
2399 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2403 SProcRenderSetPictureFilter(ClientPtr client
)
2405 REQUEST(xRenderSetPictureFilterReq
);
2406 REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq
);
2408 swaps(&stuff
->length
);
2409 swapl(&stuff
->picture
);
2410 swaps(&stuff
->nbytes
);
2411 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2415 SProcRenderCreateAnimCursor(ClientPtr client
)
2417 REQUEST(xRenderCreateAnimCursorReq
);
2418 REQUEST_AT_LEAST_SIZE(xRenderCreateAnimCursorReq
);
2420 swaps(&stuff
->length
);
2423 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2427 SProcRenderAddTraps(ClientPtr client
)
2429 REQUEST(xRenderAddTrapsReq
);
2430 REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq
);
2432 swaps(&stuff
->length
);
2433 swapl(&stuff
->picture
);
2434 swaps(&stuff
->xOff
);
2435 swaps(&stuff
->yOff
);
2437 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2441 SProcRenderCreateSolidFill(ClientPtr client
)
2443 REQUEST(xRenderCreateSolidFillReq
);
2444 REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq
);
2446 swaps(&stuff
->length
);
2448 swaps(&stuff
->color
.alpha
);
2449 swaps(&stuff
->color
.red
);
2450 swaps(&stuff
->color
.green
);
2451 swaps(&stuff
->color
.blue
);
2452 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2456 swapStops(void *stuff
, int num
)
2462 stops
= (CARD32
*) (stuff
);
2463 for (i
= 0; i
< num
; ++i
) {
2467 colors
= (CARD16
*) (stops
);
2468 for (i
= 0; i
< 4 * num
; ++i
) {
2475 SProcRenderCreateLinearGradient(ClientPtr client
)
2479 REQUEST(xRenderCreateLinearGradientReq
);
2480 REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq
);
2482 swaps(&stuff
->length
);
2484 swapl(&stuff
->p1
.x
);
2485 swapl(&stuff
->p1
.y
);
2486 swapl(&stuff
->p2
.x
);
2487 swapl(&stuff
->p2
.y
);
2488 swapl(&stuff
->nStops
);
2490 len
= (client
->req_len
<< 2) - sizeof(xRenderCreateLinearGradientReq
);
2491 if (stuff
->nStops
> UINT32_MAX
/ (sizeof(xFixed
) + sizeof(xRenderColor
)))
2493 if (len
!= stuff
->nStops
* (sizeof(xFixed
) + sizeof(xRenderColor
)))
2496 swapStops(stuff
+ 1, stuff
->nStops
);
2498 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2502 SProcRenderCreateRadialGradient(ClientPtr client
)
2506 REQUEST(xRenderCreateRadialGradientReq
);
2507 REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq
);
2509 swaps(&stuff
->length
);
2511 swapl(&stuff
->inner
.x
);
2512 swapl(&stuff
->inner
.y
);
2513 swapl(&stuff
->outer
.x
);
2514 swapl(&stuff
->outer
.y
);
2515 swapl(&stuff
->inner_radius
);
2516 swapl(&stuff
->outer_radius
);
2517 swapl(&stuff
->nStops
);
2519 len
= (client
->req_len
<< 2) - sizeof(xRenderCreateRadialGradientReq
);
2520 if (stuff
->nStops
> UINT32_MAX
/ (sizeof(xFixed
) + sizeof(xRenderColor
)))
2522 if (len
!= stuff
->nStops
* (sizeof(xFixed
) + sizeof(xRenderColor
)))
2525 swapStops(stuff
+ 1, stuff
->nStops
);
2527 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2531 SProcRenderCreateConicalGradient(ClientPtr client
)
2535 REQUEST(xRenderCreateConicalGradientReq
);
2536 REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq
);
2538 swaps(&stuff
->length
);
2540 swapl(&stuff
->center
.x
);
2541 swapl(&stuff
->center
.y
);
2542 swapl(&stuff
->angle
);
2543 swapl(&stuff
->nStops
);
2545 len
= (client
->req_len
<< 2) - sizeof(xRenderCreateConicalGradientReq
);
2546 if (stuff
->nStops
> UINT32_MAX
/ (sizeof(xFixed
) + sizeof(xRenderColor
)))
2548 if (len
!= stuff
->nStops
* (sizeof(xFixed
) + sizeof(xRenderColor
)))
2551 swapStops(stuff
+ 1, stuff
->nStops
);
2553 return (*ProcRenderVector
[stuff
->renderReqType
]) (client
);
2557 SProcRenderDispatch(ClientPtr client
)
2561 if (stuff
->data
< RenderNumberRequests
)
2562 return (*SProcRenderVector
[stuff
->data
]) (client
);
2568 #define VERIFY_XIN_PICTURE(pPicture, pid, client, mode) {\
2569 int rc = dixLookupResourceByType((pointer *)&(pPicture), pid,\
2570 XRT_PICTURE, client, mode);\
2575 #define VERIFY_XIN_ALPHA(pPicture, pid, client, mode) {\
2579 VERIFY_XIN_PICTURE(pPicture, pid, client, mode); \
2583 int (*PanoramiXSaveRenderVector[RenderNumberRequests]) (ClientPtr);
2586 PanoramiXRenderCreatePicture(ClientPtr client
)
2588 REQUEST(xRenderCreatePictureReq
);
2589 PanoramiXRes
*refDraw
, *newPict
;
2592 REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq
);
2593 result
= dixLookupResourceByClass((pointer
*) &refDraw
, stuff
->drawable
,
2594 XRC_DRAWABLE
, client
, DixWriteAccess
);
2595 if (result
!= Success
)
2596 return (result
== BadValue
) ? BadDrawable
: result
;
2597 if (!(newPict
= (PanoramiXRes
*) malloc(sizeof(PanoramiXRes
))))
2599 newPict
->type
= XRT_PICTURE
;
2600 panoramix_setup_ids(newPict
, client
, stuff
->pid
);
2602 if (refDraw
->type
== XRT_WINDOW
&&
2603 stuff
->drawable
== screenInfo
.screens
[0]->root
->drawable
.id
) {
2604 newPict
->u
.pict
.root
= TRUE
;
2607 newPict
->u
.pict
.root
= FALSE
;
2609 FOR_NSCREENS_BACKWARD(j
) {
2610 stuff
->pid
= newPict
->info
[j
].id
;
2611 stuff
->drawable
= refDraw
->info
[j
].id
;
2612 result
= (*PanoramiXSaveRenderVector
[X_RenderCreatePicture
]) (client
);
2613 if (result
!= Success
)
2617 if (result
== Success
)
2618 AddResource(newPict
->info
[0].id
, XRT_PICTURE
, newPict
);
2626 PanoramiXRenderChangePicture(ClientPtr client
)
2629 int result
= Success
, j
;
2631 REQUEST(xRenderChangePictureReq
);
2633 REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq
);
2635 VERIFY_XIN_PICTURE(pict
, stuff
->picture
, client
, DixWriteAccess
);
2637 FOR_NSCREENS_BACKWARD(j
) {
2638 stuff
->picture
= pict
->info
[j
].id
;
2639 result
= (*PanoramiXSaveRenderVector
[X_RenderChangePicture
]) (client
);
2640 if (result
!= Success
)
2648 PanoramiXRenderSetPictureClipRectangles(ClientPtr client
)
2650 REQUEST(xRenderSetPictureClipRectanglesReq
);
2651 int result
= Success
, j
;
2654 REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq
);
2656 VERIFY_XIN_PICTURE(pict
, stuff
->picture
, client
, DixWriteAccess
);
2658 FOR_NSCREENS_BACKWARD(j
) {
2659 stuff
->picture
= pict
->info
[j
].id
;
2661 (*PanoramiXSaveRenderVector
[X_RenderSetPictureClipRectangles
])
2663 if (result
!= Success
)
2671 PanoramiXRenderSetPictureTransform(ClientPtr client
)
2673 REQUEST(xRenderSetPictureTransformReq
);
2674 int result
= Success
, j
;
2677 REQUEST_AT_LEAST_SIZE(xRenderSetPictureTransformReq
);
2679 VERIFY_XIN_PICTURE(pict
, stuff
->picture
, client
, DixWriteAccess
);
2681 FOR_NSCREENS_BACKWARD(j
) {
2682 stuff
->picture
= pict
->info
[j
].id
;
2684 (*PanoramiXSaveRenderVector
[X_RenderSetPictureTransform
]) (client
);
2685 if (result
!= Success
)
2693 PanoramiXRenderSetPictureFilter(ClientPtr client
)
2695 REQUEST(xRenderSetPictureFilterReq
);
2696 int result
= Success
, j
;
2699 REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq
);
2701 VERIFY_XIN_PICTURE(pict
, stuff
->picture
, client
, DixWriteAccess
);
2703 FOR_NSCREENS_BACKWARD(j
) {
2704 stuff
->picture
= pict
->info
[j
].id
;
2706 (*PanoramiXSaveRenderVector
[X_RenderSetPictureFilter
]) (client
);
2707 if (result
!= Success
)
2715 PanoramiXRenderFreePicture(ClientPtr client
)
2718 int result
= Success
, j
;
2720 REQUEST(xRenderFreePictureReq
);
2722 REQUEST_SIZE_MATCH(xRenderFreePictureReq
);
2724 client
->errorValue
= stuff
->picture
;
2726 VERIFY_XIN_PICTURE(pict
, stuff
->picture
, client
, DixDestroyAccess
);
2728 FOR_NSCREENS_BACKWARD(j
) {
2729 stuff
->picture
= pict
->info
[j
].id
;
2730 result
= (*PanoramiXSaveRenderVector
[X_RenderFreePicture
]) (client
);
2731 if (result
!= Success
)
2735 /* Since ProcRenderFreePicture is using FreeResource, it will free
2736 our resource for us on the last pass through the loop above */
2742 PanoramiXRenderComposite(ClientPtr client
)
2744 PanoramiXRes
*src
, *msk
, *dst
;
2745 int result
= Success
, j
;
2746 xRenderCompositeReq orig
;
2748 REQUEST(xRenderCompositeReq
);
2750 REQUEST_SIZE_MATCH(xRenderCompositeReq
);
2752 VERIFY_XIN_PICTURE(src
, stuff
->src
, client
, DixReadAccess
);
2753 VERIFY_XIN_ALPHA(msk
, stuff
->mask
, client
, DixReadAccess
);
2754 VERIFY_XIN_PICTURE(dst
, stuff
->dst
, client
, DixWriteAccess
);
2758 FOR_NSCREENS_FORWARD(j
) {
2759 stuff
->src
= src
->info
[j
].id
;
2760 if (src
->u
.pict
.root
) {
2761 stuff
->xSrc
= orig
.xSrc
- screenInfo
.screens
[j
]->x
;
2762 stuff
->ySrc
= orig
.ySrc
- screenInfo
.screens
[j
]->y
;
2764 stuff
->dst
= dst
->info
[j
].id
;
2765 if (dst
->u
.pict
.root
) {
2766 stuff
->xDst
= orig
.xDst
- screenInfo
.screens
[j
]->x
;
2767 stuff
->yDst
= orig
.yDst
- screenInfo
.screens
[j
]->y
;
2770 stuff
->mask
= msk
->info
[j
].id
;
2771 if (msk
->u
.pict
.root
) {
2772 stuff
->xMask
= orig
.xMask
- screenInfo
.screens
[j
]->x
;
2773 stuff
->yMask
= orig
.yMask
- screenInfo
.screens
[j
]->y
;
2776 result
= (*PanoramiXSaveRenderVector
[X_RenderComposite
]) (client
);
2777 if (result
!= Success
)
2785 PanoramiXRenderCompositeGlyphs(ClientPtr client
)
2787 PanoramiXRes
*src
, *dst
;
2788 int result
= Success
, j
;
2790 REQUEST(xRenderCompositeGlyphsReq
);
2791 xGlyphElt origElt
, *elt
;
2794 REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq
);
2795 VERIFY_XIN_PICTURE(src
, stuff
->src
, client
, DixReadAccess
);
2796 VERIFY_XIN_PICTURE(dst
, stuff
->dst
, client
, DixWriteAccess
);
2798 if (client
->req_len
<< 2 >= (sizeof(xRenderCompositeGlyphsReq
) +
2799 sizeof(xGlyphElt
))) {
2800 elt
= (xGlyphElt
*) (stuff
+ 1);
2804 FOR_NSCREENS_FORWARD(j
) {
2805 stuff
->src
= src
->info
[j
].id
;
2806 if (src
->u
.pict
.root
) {
2807 stuff
->xSrc
= xSrc
- screenInfo
.screens
[j
]->x
;
2808 stuff
->ySrc
= ySrc
- screenInfo
.screens
[j
]->y
;
2810 stuff
->dst
= dst
->info
[j
].id
;
2811 if (dst
->u
.pict
.root
) {
2812 elt
->deltax
= origElt
.deltax
- screenInfo
.screens
[j
]->x
;
2813 elt
->deltay
= origElt
.deltay
- screenInfo
.screens
[j
]->y
;
2816 (*PanoramiXSaveRenderVector
[stuff
->renderReqType
]) (client
);
2817 if (result
!= Success
)
2826 PanoramiXRenderFillRectangles(ClientPtr client
)
2829 int result
= Success
, j
;
2831 REQUEST(xRenderFillRectanglesReq
);
2835 REQUEST_AT_LEAST_SIZE(xRenderFillRectanglesReq
);
2836 VERIFY_XIN_PICTURE(dst
, stuff
->dst
, client
, DixWriteAccess
);
2837 extra_len
= (client
->req_len
<< 2) - sizeof(xRenderFillRectanglesReq
);
2838 if (extra_len
&& (extra
= (char *) malloc(extra_len
))) {
2839 memcpy(extra
, stuff
+ 1, extra_len
);
2840 FOR_NSCREENS_FORWARD(j
) {
2842 memcpy(stuff
+ 1, extra
, extra_len
);
2843 if (dst
->u
.pict
.root
) {
2844 int x_off
= screenInfo
.screens
[j
]->x
;
2845 int y_off
= screenInfo
.screens
[j
]->y
;
2847 if (x_off
|| y_off
) {
2848 xRectangle
*rects
= (xRectangle
*) (stuff
+ 1);
2849 int i
= extra_len
/ sizeof(xRectangle
);
2858 stuff
->dst
= dst
->info
[j
].id
;
2860 (*PanoramiXSaveRenderVector
[X_RenderFillRectangles
]) (client
);
2861 if (result
!= Success
)
2871 PanoramiXRenderTrapezoids(ClientPtr client
)
2873 PanoramiXRes
*src
, *dst
;
2874 int result
= Success
, j
;
2876 REQUEST(xRenderTrapezoidsReq
);
2880 REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq
);
2882 VERIFY_XIN_PICTURE(src
, stuff
->src
, client
, DixReadAccess
);
2883 VERIFY_XIN_PICTURE(dst
, stuff
->dst
, client
, DixWriteAccess
);
2885 extra_len
= (client
->req_len
<< 2) - sizeof(xRenderTrapezoidsReq
);
2887 if (extra_len
&& (extra
= (char *) malloc(extra_len
))) {
2888 memcpy(extra
, stuff
+ 1, extra_len
);
2890 FOR_NSCREENS_FORWARD(j
) {
2892 memcpy(stuff
+ 1, extra
, extra_len
);
2893 if (dst
->u
.pict
.root
) {
2894 int x_off
= screenInfo
.screens
[j
]->x
;
2895 int y_off
= screenInfo
.screens
[j
]->y
;
2897 if (x_off
|| y_off
) {
2898 xTrapezoid
*trap
= (xTrapezoid
*) (stuff
+ 1);
2899 int i
= extra_len
/ sizeof(xTrapezoid
);
2903 trap
->bottom
-= y_off
;
2904 trap
->left
.p1
.x
-= x_off
;
2905 trap
->left
.p1
.y
-= y_off
;
2906 trap
->left
.p2
.x
-= x_off
;
2907 trap
->left
.p2
.y
-= y_off
;
2908 trap
->right
.p1
.x
-= x_off
;
2909 trap
->right
.p1
.y
-= y_off
;
2910 trap
->right
.p2
.x
-= x_off
;
2911 trap
->right
.p2
.y
-= y_off
;
2917 stuff
->src
= src
->info
[j
].id
;
2918 stuff
->dst
= dst
->info
[j
].id
;
2919 result
= (*PanoramiXSaveRenderVector
[X_RenderTrapezoids
]) (client
);
2921 if (result
!= Success
)
2932 PanoramiXRenderTriangles(ClientPtr client
)
2934 PanoramiXRes
*src
, *dst
;
2935 int result
= Success
, j
;
2937 REQUEST(xRenderTrianglesReq
);
2941 REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq
);
2943 VERIFY_XIN_PICTURE(src
, stuff
->src
, client
, DixReadAccess
);
2944 VERIFY_XIN_PICTURE(dst
, stuff
->dst
, client
, DixWriteAccess
);
2946 extra_len
= (client
->req_len
<< 2) - sizeof(xRenderTrianglesReq
);
2948 if (extra_len
&& (extra
= (char *) malloc(extra_len
))) {
2949 memcpy(extra
, stuff
+ 1, extra_len
);
2951 FOR_NSCREENS_FORWARD(j
) {
2953 memcpy(stuff
+ 1, extra
, extra_len
);
2954 if (dst
->u
.pict
.root
) {
2955 int x_off
= screenInfo
.screens
[j
]->x
;
2956 int y_off
= screenInfo
.screens
[j
]->y
;
2958 if (x_off
|| y_off
) {
2959 xTriangle
*tri
= (xTriangle
*) (stuff
+ 1);
2960 int i
= extra_len
/ sizeof(xTriangle
);
2974 stuff
->src
= src
->info
[j
].id
;
2975 stuff
->dst
= dst
->info
[j
].id
;
2976 result
= (*PanoramiXSaveRenderVector
[X_RenderTriangles
]) (client
);
2978 if (result
!= Success
)
2989 PanoramiXRenderTriStrip(ClientPtr client
)
2991 PanoramiXRes
*src
, *dst
;
2992 int result
= Success
, j
;
2994 REQUEST(xRenderTriStripReq
);
2998 REQUEST_AT_LEAST_SIZE(xRenderTriStripReq
);
3000 VERIFY_XIN_PICTURE(src
, stuff
->src
, client
, DixReadAccess
);
3001 VERIFY_XIN_PICTURE(dst
, stuff
->dst
, client
, DixWriteAccess
);
3003 extra_len
= (client
->req_len
<< 2) - sizeof(xRenderTriStripReq
);
3005 if (extra_len
&& (extra
= (char *) malloc(extra_len
))) {
3006 memcpy(extra
, stuff
+ 1, extra_len
);
3008 FOR_NSCREENS_FORWARD(j
) {
3010 memcpy(stuff
+ 1, extra
, extra_len
);
3011 if (dst
->u
.pict
.root
) {
3012 int x_off
= screenInfo
.screens
[j
]->x
;
3013 int y_off
= screenInfo
.screens
[j
]->y
;
3015 if (x_off
|| y_off
) {
3016 xPointFixed
*fixed
= (xPointFixed
*) (stuff
+ 1);
3017 int i
= extra_len
/ sizeof(xPointFixed
);
3027 stuff
->src
= src
->info
[j
].id
;
3028 stuff
->dst
= dst
->info
[j
].id
;
3029 result
= (*PanoramiXSaveRenderVector
[X_RenderTriStrip
]) (client
);
3031 if (result
!= Success
)
3042 PanoramiXRenderTriFan(ClientPtr client
)
3044 PanoramiXRes
*src
, *dst
;
3045 int result
= Success
, j
;
3047 REQUEST(xRenderTriFanReq
);
3051 REQUEST_AT_LEAST_SIZE(xRenderTriFanReq
);
3053 VERIFY_XIN_PICTURE(src
, stuff
->src
, client
, DixReadAccess
);
3054 VERIFY_XIN_PICTURE(dst
, stuff
->dst
, client
, DixWriteAccess
);
3056 extra_len
= (client
->req_len
<< 2) - sizeof(xRenderTriFanReq
);
3058 if (extra_len
&& (extra
= (char *) malloc(extra_len
))) {
3059 memcpy(extra
, stuff
+ 1, extra_len
);
3061 FOR_NSCREENS_FORWARD(j
) {
3063 memcpy(stuff
+ 1, extra
, extra_len
);
3064 if (dst
->u
.pict
.root
) {
3065 int x_off
= screenInfo
.screens
[j
]->x
;
3066 int y_off
= screenInfo
.screens
[j
]->y
;
3068 if (x_off
|| y_off
) {
3069 xPointFixed
*fixed
= (xPointFixed
*) (stuff
+ 1);
3070 int i
= extra_len
/ sizeof(xPointFixed
);
3080 stuff
->src
= src
->info
[j
].id
;
3081 stuff
->dst
= dst
->info
[j
].id
;
3082 result
= (*PanoramiXSaveRenderVector
[X_RenderTriFan
]) (client
);
3084 if (result
!= Success
)
3095 PanoramiXRenderAddTraps(ClientPtr client
)
3097 PanoramiXRes
*picture
;
3098 int result
= Success
, j
;
3100 REQUEST(xRenderAddTrapsReq
);
3105 REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq
);
3106 VERIFY_XIN_PICTURE(picture
, stuff
->picture
, client
, DixWriteAccess
);
3107 extra_len
= (client
->req_len
<< 2) - sizeof(xRenderAddTrapsReq
);
3108 if (extra_len
&& (extra
= (char *) malloc(extra_len
))) {
3109 memcpy(extra
, stuff
+ 1, extra_len
);
3110 x_off
= stuff
->xOff
;
3111 y_off
= stuff
->yOff
;
3112 FOR_NSCREENS_FORWARD(j
) {
3114 memcpy(stuff
+ 1, extra
, extra_len
);
3115 stuff
->picture
= picture
->info
[j
].id
;
3117 if (picture
->u
.pict
.root
) {
3118 stuff
->xOff
= x_off
+ screenInfo
.screens
[j
]->x
;
3119 stuff
->yOff
= y_off
+ screenInfo
.screens
[j
]->y
;
3121 result
= (*PanoramiXSaveRenderVector
[X_RenderAddTraps
]) (client
);
3122 if (result
!= Success
)
3132 PanoramiXRenderCreateSolidFill(ClientPtr client
)
3134 REQUEST(xRenderCreateSolidFillReq
);
3135 PanoramiXRes
*newPict
;
3136 int result
= Success
, j
;
3138 REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq
);
3140 if (!(newPict
= (PanoramiXRes
*) malloc(sizeof(PanoramiXRes
))))
3143 newPict
->type
= XRT_PICTURE
;
3144 panoramix_setup_ids(newPict
, client
, stuff
->pid
);
3145 newPict
->u
.pict
.root
= FALSE
;
3147 FOR_NSCREENS_BACKWARD(j
) {
3148 stuff
->pid
= newPict
->info
[j
].id
;
3149 result
= (*PanoramiXSaveRenderVector
[X_RenderCreateSolidFill
]) (client
);
3150 if (result
!= Success
)
3154 if (result
== Success
)
3155 AddResource(newPict
->info
[0].id
, XRT_PICTURE
, newPict
);
3163 PanoramiXRenderCreateLinearGradient(ClientPtr client
)
3165 REQUEST(xRenderCreateLinearGradientReq
);
3166 PanoramiXRes
*newPict
;
3167 int result
= Success
, j
;
3169 REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq
);
3171 if (!(newPict
= (PanoramiXRes
*) malloc(sizeof(PanoramiXRes
))))
3174 newPict
->type
= XRT_PICTURE
;
3175 panoramix_setup_ids(newPict
, client
, stuff
->pid
);
3176 newPict
->u
.pict
.root
= FALSE
;
3178 FOR_NSCREENS_BACKWARD(j
) {
3179 stuff
->pid
= newPict
->info
[j
].id
;
3181 (*PanoramiXSaveRenderVector
[X_RenderCreateLinearGradient
]) (client
);
3182 if (result
!= Success
)
3186 if (result
== Success
)
3187 AddResource(newPict
->info
[0].id
, XRT_PICTURE
, newPict
);
3195 PanoramiXRenderCreateRadialGradient(ClientPtr client
)
3197 REQUEST(xRenderCreateRadialGradientReq
);
3198 PanoramiXRes
*newPict
;
3199 int result
= Success
, j
;
3201 REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq
);
3203 if (!(newPict
= (PanoramiXRes
*) malloc(sizeof(PanoramiXRes
))))
3206 newPict
->type
= XRT_PICTURE
;
3207 panoramix_setup_ids(newPict
, client
, stuff
->pid
);
3208 newPict
->u
.pict
.root
= FALSE
;
3210 FOR_NSCREENS_BACKWARD(j
) {
3211 stuff
->pid
= newPict
->info
[j
].id
;
3213 (*PanoramiXSaveRenderVector
[X_RenderCreateRadialGradient
]) (client
);
3214 if (result
!= Success
)
3218 if (result
== Success
)
3219 AddResource(newPict
->info
[0].id
, XRT_PICTURE
, newPict
);
3227 PanoramiXRenderCreateConicalGradient(ClientPtr client
)
3229 REQUEST(xRenderCreateConicalGradientReq
);
3230 PanoramiXRes
*newPict
;
3231 int result
= Success
, j
;
3233 REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq
);
3235 if (!(newPict
= (PanoramiXRes
*) malloc(sizeof(PanoramiXRes
))))
3238 newPict
->type
= XRT_PICTURE
;
3239 panoramix_setup_ids(newPict
, client
, stuff
->pid
);
3240 newPict
->u
.pict
.root
= FALSE
;
3242 FOR_NSCREENS_BACKWARD(j
) {
3243 stuff
->pid
= newPict
->info
[j
].id
;
3245 (*PanoramiXSaveRenderVector
[X_RenderCreateConicalGradient
])
3247 if (result
!= Success
)
3251 if (result
== Success
)
3252 AddResource(newPict
->info
[0].id
, XRT_PICTURE
, newPict
);
3260 PanoramiXRenderInit(void)
3264 XRT_PICTURE
= CreateNewResourceType(XineramaDeleteResource
,
3267 SetResourceTypeErrorValue(XRT_PICTURE
, RenderErrBase
+ BadPicture
);
3268 for (i
= 0; i
< RenderNumberRequests
; i
++)
3269 PanoramiXSaveRenderVector
[i
] = ProcRenderVector
[i
];
3271 * Stuff in Xinerama aware request processing hooks
3273 ProcRenderVector
[X_RenderCreatePicture
] = PanoramiXRenderCreatePicture
;
3274 ProcRenderVector
[X_RenderChangePicture
] = PanoramiXRenderChangePicture
;
3275 ProcRenderVector
[X_RenderSetPictureTransform
] =
3276 PanoramiXRenderSetPictureTransform
;
3277 ProcRenderVector
[X_RenderSetPictureFilter
] =
3278 PanoramiXRenderSetPictureFilter
;
3279 ProcRenderVector
[X_RenderSetPictureClipRectangles
] =
3280 PanoramiXRenderSetPictureClipRectangles
;
3281 ProcRenderVector
[X_RenderFreePicture
] = PanoramiXRenderFreePicture
;
3282 ProcRenderVector
[X_RenderComposite
] = PanoramiXRenderComposite
;
3283 ProcRenderVector
[X_RenderCompositeGlyphs8
] = PanoramiXRenderCompositeGlyphs
;
3284 ProcRenderVector
[X_RenderCompositeGlyphs16
] =
3285 PanoramiXRenderCompositeGlyphs
;
3286 ProcRenderVector
[X_RenderCompositeGlyphs32
] =
3287 PanoramiXRenderCompositeGlyphs
;
3288 ProcRenderVector
[X_RenderFillRectangles
] = PanoramiXRenderFillRectangles
;
3290 ProcRenderVector
[X_RenderTrapezoids
] = PanoramiXRenderTrapezoids
;
3291 ProcRenderVector
[X_RenderTriangles
] = PanoramiXRenderTriangles
;
3292 ProcRenderVector
[X_RenderTriStrip
] = PanoramiXRenderTriStrip
;
3293 ProcRenderVector
[X_RenderTriFan
] = PanoramiXRenderTriFan
;
3294 ProcRenderVector
[X_RenderAddTraps
] = PanoramiXRenderAddTraps
;
3296 ProcRenderVector
[X_RenderCreateSolidFill
] = PanoramiXRenderCreateSolidFill
;
3297 ProcRenderVector
[X_RenderCreateLinearGradient
] =
3298 PanoramiXRenderCreateLinearGradient
;
3299 ProcRenderVector
[X_RenderCreateRadialGradient
] =
3300 PanoramiXRenderCreateRadialGradient
;
3301 ProcRenderVector
[X_RenderCreateConicalGradient
] =
3302 PanoramiXRenderCreateConicalGradient
;
3306 PanoramiXRenderReset(void)
3310 for (i
= 0; i
< RenderNumberRequests
; i
++)
3311 ProcRenderVector
[i
] = PanoramiXSaveRenderVector
[i
];
3315 #endif /* PANORAMIX */