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.
28 #include "Xrenderint.h"
30 /* precompute the maximum size of batching request allowed */
32 #define size (SIZEOF(xRenderFillRectanglesReq) + FRCTSPERBATCH * SIZEOF(xRectangle))
35 XRenderFillRectangle (Display *dpy,
38 _Xconst XRenderColor *color,
44 XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy);
46 xRenderFillRectanglesReq *req;
49 long len = SIZEOF(xRectangle);
54 RenderSimpleCheckExtension (dpy, info);
57 req = (xRenderFillRectanglesReq *) dpy->last_req;
58 /* if same as previous request, with same drawable, batch requests */
59 if (req->reqType == info->codes->major_opcode &&
60 req->renderReqType == X_RenderFillRectangles &&
63 req->color.red == color->red &&
64 req->color.green == color->green &&
65 req->color.blue == color->blue &&
66 req->color.alpha == color->alpha &&
67 dpy->bufptr + SIZEOF(xRectangle) <= dpy->bufmax &&
68 (char *)dpy->bufptr - (char *)req < size)
70 req->length += SIZEOF(xRectangle) >> 2;
72 rect = (xRectangle *) dpy->bufptr;
73 dpy->bufptr += SIZEOF(xRectangle);
74 #endif /* not MUSTCOPY */
78 GetReqExtra(RenderFillRectangles, SIZEOF(xRectangle), req);
80 req->reqType = info->codes->major_opcode;
81 req->renderReqType = X_RenderFillRectangles;
84 req->color.red = color->red;
85 req->color.green = color->green;
86 req->color.blue = color->blue;
87 req->color.alpha = color->alpha;
90 dpy->bufptr -= SIZEOF(xRectangle);
92 rect = (xRectangle *) NEXTPTR(req,xRenderFillRectanglesReq);
98 rect->height = height;
101 Data (dpy, (char *) rect, len);
102 #endif /* MUSTCOPY */