FillArcs.c revision 1ab64890
11.127Skre/* $Xorg: FillArcs.c,v 1.4 2001/02/09 02:03:32 xorgcvs Exp $ */
21.48Sitojun/*
31.6Sitojun
41.1SitojunCopyright 1986, 1998  The Open Group
51.1Sitojun
61.1SitojunPermission to use, copy, modify, distribute, and sell this software and its
71.42Sitojundocumentation for any purpose is hereby granted without fee, provided that
81.1Sitojunthe above copyright notice appear in all copies and that both that
91.1Sitojuncopyright notice and this permission notice appear in supporting
101.1Sitojundocumentation.
111.1Sitojun
121.1SitojunThe above copyright notice and this permission notice shall be included in
131.1Sitojunall copies or substantial portions of the Software.
141.1Sitojun
151.1SitojunTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
161.1SitojunIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
171.1SitojunFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
181.1SitojunOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
191.42SitojunAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
201.1SitojunCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
211.1Sitojun
221.1SitojunExcept as contained in this notice, the name of The Open Group shall not be
231.1Sitojunused in advertising or otherwise to promote the sale, use or other dealings
241.1Sitojunin this Software without prior written authorization from The Open Group.
251.1Sitojun
261.1Sitojun*/
271.1Sitojun/* $XFree86: xc/lib/X11/FillArcs.c,v 1.3 2001/01/17 19:41:35 dawes Exp $ */
281.1Sitojun
291.1Sitojun#ifdef HAVE_CONFIG_H
301.1Sitojun#include <config.h>
311.1Sitojun#endif
321.1Sitojun#include "Xlibint.h"
331.1Sitojun
341.1Sitojun#define arc_scale (SIZEOF(xArc) / 4)
351.1Sitojun
361.14Sitojunint
371.1SitojunXFillArcs(
381.27Sitojun    register Display *dpy,
391.122Sriastrad    Drawable d,
401.27Sitojun    GC gc,
411.27Sitojun    XArc *arcs,
421.27Sitojun    int n_arcs)
431.27Sitojun{
441.27Sitojun    register xPolyFillArcReq *req;
451.14Sitojun    long len;
461.14Sitojun    int n;
471.22Sitojun
481.14Sitojun    LockDisplay(dpy);
491.14Sitojun    FlushGC(dpy, gc);
501.30Sitojun    while (n_arcs) {
511.30Sitojun	GetReq(PolyFillArc, req);
521.30Sitojun	req->drawable = d;
531.30Sitojun	req->gc = gc->gid;
541.1Sitojun	n = n_arcs;
551.39Sitojun	len = ((long)n) * arc_scale;
561.39Sitojun	if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) {
571.39Sitojun	    n = (dpy->max_request_size - req->length) / arc_scale;
581.127Skre	    len = ((long)n) * arc_scale;
591.39Sitojun	}
601.1Sitojun	SetReqLen(req, len, len);
611.107Sozaki	len <<= 2; /* watch out for macros... */
621.38Sitojun	Data16 (dpy, (short *) arcs, len);
631.107Sozaki	n_arcs -= n;
641.14Sitojun	arcs += n;
651.1Sitojun    }
661.1Sitojun    UnlockDisplay(dpy);
671.112Schristos    SyncHandle();
681.112Schristos    return 1;
691.14Sitojun}
701.1Sitojun