1/* 2 3Copyright 1986, 1998 The Open Group 4 5Permission to use, copy, modify, distribute, and sell this software and its 6documentation for any purpose is hereby granted without fee, provided that 7the above copyright notice appear in all copies and that both that 8copyright notice and this permission notice appear in supporting 9documentation. 10 11The above copyright notice and this permission notice shall be included in 12all copies or substantial portions of the Software. 13 14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 21Except as contained in this notice, the name of The Open Group shall not be 22used in advertising or otherwise to promote the sale, use or other dealings 23in this Software without prior written authorization from The Open Group. 24 25*/ 26 27#ifdef HAVE_CONFIG_H 28#include <config.h> 29#endif 30#include "Xlibint.h" 31 32/* can only call when display is locked. */ 33void _XSetClipRectangles ( 34 Display *dpy, 35 GC gc, 36 int clip_x_origin, int clip_y_origin, 37 XRectangle *rectangles, 38 int n, 39 int ordering) 40{ 41 register xSetClipRectanglesReq *req; 42 register long len; 43 unsigned long dirty; 44 register _XExtension *ext; 45 46 GetReq (SetClipRectangles, req); 47 req->gc = (CARD32) gc->gid; 48 req->xOrigin = (INT16) (gc->values.clip_x_origin = clip_x_origin); 49 req->yOrigin = (INT16) (gc->values.clip_y_origin = clip_y_origin); 50 req->ordering = (BYTE) ordering; 51 len = ((long)n) << 1; 52 SetReqLen(req, len, 1); 53 len <<= 2; 54 Data16 (dpy, (short *) rectangles, len); 55 gc->rects = 1; 56 dirty = (gc->dirty & (unsigned long) ~(GCClipMask | GCClipXOrigin | GCClipYOrigin)); 57 gc->dirty = GCClipMask | GCClipXOrigin | GCClipYOrigin; 58 /* call out to any extensions interested */ 59 for (ext = dpy->ext_procs; ext; ext = ext->next) 60 if (ext->flush_GC) (*ext->flush_GC)(dpy, gc, &ext->codes); 61 gc->dirty = dirty; 62} 63 64int 65XSetClipRectangles ( 66 register Display *dpy, 67 GC gc, 68 int clip_x_origin, 69 int clip_y_origin, 70 XRectangle *rectangles, 71 int n, 72 int ordering) 73{ 74 LockDisplay(dpy); 75 _XSetClipRectangles (dpy, gc, clip_x_origin, clip_y_origin, rectangles, n, 76 ordering); 77 UnlockDisplay(dpy); 78 SyncHandle(); 79 return 1; 80} 81 82