xref: /386bsd/usr/X386/lib/Server/include/regionstr.h (revision a2142627)
1 /* $XConsortium: regionstr.h,v 1.5 89/07/09 15:34:24 rws Exp $ */
2 /***********************************************************
3 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
4 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
5 
6                         All Rights Reserved
7 
8 Permission to use, copy, modify, and distribute this software and its
9 documentation for any purpose and without fee is hereby granted,
10 provided that the above copyright notice appear in all copies and that
11 both that copyright notice and this permission notice appear in
12 supporting documentation, and that the names of Digital or MIT not be
13 used in advertising or publicity pertaining to distribution of the
14 software without specific, written prior permission.
15 
16 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
17 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
18 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
19 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
21 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
22 SOFTWARE.
23 
24 ******************************************************************/
25 #ifndef REGIONSTRUCT_H
26 #define REGIONSTRUCT_H
27 
28 #include "region.h"
29 #include "miscstruct.h"
30 /*
31  *   clip region
32  */
33 
34 typedef struct _RegData {
35     long	size;
36     long 	numRects;
37 /*  BoxRec	rects[size];   in memory but not explicitly declared */
38 } RegDataRec, *RegDataPtr;
39 
40 typedef struct _Region {
41     BoxRec 	extents;
42     RegDataPtr	data;
43 } RegionRec;
44 
45 #define REGION_NIL(reg) ((reg)->data && !(reg)->data->numRects)
46 #define REGION_NUM_RECTS(reg) ((reg)->data ? (reg)->data->numRects : 1)
47 #define REGION_SIZE(reg) ((reg)->data ? (reg)->data->size : 0)
48 #define REGION_RECTS(reg) ((reg)->data ? (BoxPtr)((reg)->data + 1) \
49 			               : &(reg)->extents)
50 #define REGION_BOXPTR(reg) ((BoxPtr)((reg)->data + 1))
51 #define REGION_BOX(reg,i) (&REGION_BOXPTR(reg)[i])
52 #define REGION_TOP(reg) REGION_BOX(reg, (reg)->data->numRects)
53 #define REGION_END(reg) REGION_BOX(reg, (reg)->data->numRects - 1)
54 #define REGION_SZOF(n) (sizeof(RegDataRec) + ((n) * sizeof(BoxRec)))
55 
56 #endif /* REGIONSTRUCT_H */
57