|
|
1.1 root 1: #include "copyright.h"
2:
3: /* $Header: XDrRect.c,v 11.10 87/09/11 08:10:15 toddb Exp $ */
4: /* Copyright Massachusetts Institute of Technology 1986 */
5:
6: #include "Xlibint.h"
7:
8: /* precompute the maximum size of batching request allowed */
9:
10: static int size = sizeof(xPolyRectangleReq) + EPERBATCH * sizeof(xRectangle);
11:
12: XDrawRectangle(dpy, d, gc, x, y, width, height)
13: register Display *dpy;
14: Drawable d;
15: GC gc;
16: int x, y; /* INT16 */
17: unsigned int width, height; /* CARD16 */
18: {
19: xRectangle *rect;
20:
21: LockDisplay(dpy);
22: FlushGC(dpy, gc);
23: {
24: register xPolyRectangleReq *req = (xPolyRectangleReq *) dpy->last_req;
25: /* if same as previous request, with same drawable, batch requests */
26: if (
27: (req->reqType == X_PolyRectangle)
28: && (req->drawable == d)
29: && (req->gc == gc->gid)
30: && ((dpy->bufptr + sizeof (xRectangle)) <= dpy->bufmax)
31: && (((char *)dpy->bufptr - (char *)req) < size) ) {
32: rect = (xRectangle *) dpy->bufptr;
33: req->length += sizeof (xRectangle) >> 2;
34: dpy->bufptr += sizeof (xRectangle);
35: }
36:
37: else {
38: GetReqExtra(PolyRectangle, sizeof(xRectangle), req);
39: req->drawable = d;
40: req->gc = gc->gid;
41: rect = (xRectangle *) (req + 1);
42: }
43: rect->x = x;
44: rect->y = y;
45: rect->width = width;
46: rect->height = height;
47: }
48: UnlockDisplay(dpy);
49: SyncHandle();
50: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.