pass in the display id to the compositor
[AROS.git] / rom / hyperlayers / intregions.h
blobfb633bbb805297c763b98f39eb3eff773d161c45
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Some common macros for rectangles and regions.
6 Lang: english
7 */
9 #ifndef INTREGIONS_H
10 #define INTREGIONS_H
12 #include <proto/graphics.h>
14 #define MinX(rr) ((rr)->bounds.MinX)
15 #define MaxX(rr) ((rr)->bounds.MaxX)
16 #define MinY(rr) ((rr)->bounds.MinY)
17 #define MaxY(rr) ((rr)->bounds.MaxY)
19 /* CHECKME: Aren't the following candidates for moving into graphics/gfxmacros.h ? */
21 #define _DoRectsOverlap(Rect, Rect2) \
22 ( \
23 (Rect2)->MinY <= (Rect)->MaxY && \
24 (Rect2)->MaxY >= (Rect)->MinY && \
25 (Rect2)->MinX <= (Rect)->MaxX && \
26 (Rect2)->MaxX >= (Rect)->MinX \
29 #define overlap(a, b) _DoRectsOverlap(&(a), &(b))
31 #define _TranslateRect(rect, dx, dy) \
32 do \
33 { \
34 (rect)->MinX += dx; \
35 (rect)->MinY += dy; \
36 (rect)->MaxX += dx; \
37 (rect)->MaxY += dy; \
38 } while(0)
40 #define InitRegion(region) \
41 do \
42 { \
43 (region)->bounds.MinX = 0; \
44 (region)->bounds.MinY = 0; \
45 (region)->bounds.MaxX = 0; \
46 (region)->bounds.MaxY = 0; \
47 (region)->RegionRectangle = NULL; \
48 } while (0)
50 static inline struct Region *_NewRectRegion(WORD MinX, WORD MinY, WORD MaxX, WORD MaxY, struct GfxBase *GfxBase)
52 struct Region *region = NewRegion();
54 if (region)
56 struct Rectangle rect = {MinX, MinY, MaxX, MaxY};
58 if (OrRectRegion(region, &rect))
59 return region;
61 DisposeRegion(region);
64 return NULL;
66 } /* NewRectRegion */
68 #endif /* !INTREGIONS_H */