DrArc.c revision 61b2299d
1/* $Xorg: DrArc.c,v 1.4 2001/02/09 02:03:32 xorgcvs Exp $ */ 2/* 3 4Copyright 1986, 1998 The Open Group 5 6Permission to use, copy, modify, distribute, and sell this software and its 7documentation for any purpose is hereby granted without fee, provided that 8the above copyright notice appear in all copies and that both that 9copyright notice and this permission notice appear in supporting 10documentation. 11 12The above copyright notice and this permission notice shall be included in 13all copies or substantial portions of the Software. 14 15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 19AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 22Except as contained in this notice, the name of The Open Group shall not be 23used in advertising or otherwise to promote the sale, use or other dealings 24in this Software without prior written authorization from The Open Group. 25 26*/ 27/* $XFree86: xc/lib/X11/DrArc.c,v 1.3 2001/01/17 19:41:34 dawes Exp $ */ 28 29/* Note to future maintainers: XDrawArc does NOT batch successive PolyArc 30 requests into a single request like XDrawLine, XDrawPoint, etc. 31 We don't do this because X_PolyArc applies the GC's join-style if 32 the last point in one arc coincides with the first point in another. 33 The client wouldn't expect this and would have no easy way to defeat it. */ 34 35#ifdef HAVE_CONFIG_H 36#include <config.h> 37#endif 38#include "Xlibint.h" 39 40int 41XDrawArc( 42 register Display *dpy, 43 Drawable d, 44 GC gc, 45 int x, 46 int y, /* INT16 */ 47 unsigned int width, 48 unsigned int height, /* CARD16 */ 49 int angle1, 50 int angle2) /* INT16 */ 51{ 52 register xPolyArcReq *req; 53 register xArc *arc; 54#ifdef MUSTCOPY 55 xArc arcdata; 56 long len = SIZEOF(xArc); 57 58 arc = &arcdata; 59#endif /* MUSTCOPY */ 60 61 LockDisplay(dpy); 62 FlushGC(dpy, gc); 63 GetReqExtra (PolyArc, SIZEOF(xArc), req); 64 65 req->drawable = d; 66 req->gc = gc->gid; 67 68#ifndef MUSTCOPY 69 arc = (xArc *) NEXTPTR(req,xPolyArcReq); 70#endif /* MUSTCOPY */ 71 72 arc->x = x; 73 arc->y = y; 74 arc->width = width; 75 arc->height = height; 76 arc->angle1 = angle1; 77 arc->angle2 = angle2; 78 79#ifdef MUSTCOPY 80 dpy->bufptr -= SIZEOF(xArc); 81 Data (dpy, (char *) arc, len); 82#endif /* MUSTCOPY */ 83 84 UnlockDisplay(dpy); 85 SyncHandle(); 86 return 1; 87} 88