| 1 |
/* |
| 2 |
* |
| 3 |
* Copyright © 2002 Keith Packard |
| 4 |
* |
| 5 |
* Permission to use, copy, modify, distribute, and sell this software and its |
| 6 |
* documentation for any purpose is hereby granted without fee, provided that |
| 7 |
* the above copyright notice appear in all copies and that both that |
| 8 |
* copyright notice and this permission notice appear in supporting |
| 9 |
* documentation, and that the name of Keith Packard not be used in |
| 10 |
* advertising or publicity pertaining to distribution of the software without |
| 11 |
* specific, written prior permission. Keith Packard makes no |
| 12 |
* representations about the suitability of this software for any purpose. It |
| 13 |
* is provided "as is" without express or implied warranty. |
| 14 |
* |
| 15 |
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
| 16 |
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO |
| 17 |
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
| 18 |
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, |
| 19 |
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 20 |
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 21 |
* PERFORMANCE OF THIS SOFTWARE. |
| 22 |
*/ |
| 23 |
|
| 24 |
#ifdef HAVE_CONFIG_H |
| 25 |
#include <config.h> |
| 26 |
#endif |
| 27 |
#include "Xrenderint.h" |
| 28 |
|
| 29 |
void |
| 30 |
XRenderCompositeTrapezoids (Display *dpy, |
| 31 |
int op, |
| 32 |
Picture src, |
| 33 |
Picture dst, |
| 34 |
_Xconst XRenderPictFormat *maskFormat, |
| 35 |
int xSrc, |
| 36 |
int ySrc, |
| 37 |
_Xconst XTrapezoid *traps, |
| 38 |
int ntrap) |
| 39 |
{ |
| 40 |
XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy); |
| 41 |
unsigned long max_req = dpy->bigreq_size ? dpy->bigreq_size : dpy->max_request_size; |
| 42 |
|
| 43 |
RenderSimpleCheckExtension (dpy, info); |
| 44 |
LockDisplay(dpy); |
| 45 |
while (ntrap) |
| 46 |
{ |
| 47 |
xRenderTrapezoidsReq *req; |
| 48 |
int n; |
| 49 |
unsigned long len; |
| 50 |
|
| 51 |
GetReq(RenderTrapezoids, req); |
| 52 |
req->reqType = (CARD8) info->codes->major_opcode; |
| 53 |
req->renderReqType = X_RenderTrapezoids; |
| 54 |
req->op = (CARD8) op; |
| 55 |
req->src = (CARD32) src; |
| 56 |
req->dst = (CARD32) dst; |
| 57 |
req->maskFormat = (CARD32) (maskFormat ? maskFormat->id : 0); |
| 58 |
req->xSrc = (INT16) xSrc; |
| 59 |
req->ySrc = (INT16) ySrc; |
| 60 |
n = ntrap; |
| 61 |
len = ((unsigned long) n) * (SIZEOF (xTrapezoid) >> 2); |
| 62 |
if (len > (max_req - req->length)) { |
| 63 |
n = (int) ((max_req - req->length) / (SIZEOF (xTrapezoid) >> 2)); |
| 64 |
len = ((unsigned long) n) * (SIZEOF (xTrapezoid) >> 2); |
| 65 |
} |
| 66 |
SetReqLen (req, len, len); |
| 67 |
len <<= 2; |
| 68 |
DataInt32 (dpy, (_Xconst int *) traps, len); |
| 69 |
ntrap -= n; |
| 70 |
traps += n; |
| 71 |
} |
| 72 |
UnlockDisplay(dpy); |
| 73 |
SyncHandle(); |
| 74 |
} |
| 75 |
|