Trap.c revision 1f0ac6a5
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 29void 30XRenderCompositeTrapezoids (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 xRenderTrapezoidsReq *req; 42 int n; 43 long len; 44 unsigned long max_req = dpy->bigreq_size ? dpy->bigreq_size : dpy->max_request_size; 45 46 RenderSimpleCheckExtension (dpy, info); 47 LockDisplay(dpy); 48 while (ntrap) 49 { 50 GetReq(RenderTrapezoids, req); 51 req->reqType = info->codes->major_opcode; 52 req->renderReqType = X_RenderTrapezoids; 53 req->op = (CARD8) op; 54 req->src = src; 55 req->dst = dst; 56 req->maskFormat = maskFormat ? maskFormat->id : 0; 57 req->xSrc = xSrc; 58 req->ySrc = ySrc; 59 n = ntrap; 60 len = ((long) n) * (SIZEOF (xTrapezoid) >> 2); 61 if (len > (max_req - req->length)) { 62 n = (max_req - req->length) / (SIZEOF (xTrapezoid) >> 2); 63 len = ((long)n) * (SIZEOF (xTrapezoid) >> 2); 64 } 65 SetReqLen (req, len, len); 66 len <<= 2; 67 DataInt32 (dpy, (int *) traps, len); 68 ntrap -= n; 69 traps += n; 70 } 71 UnlockDisplay(dpy); 72 SyncHandle(); 73} 74 75