45 #ifndef __GDK_REGION_GENERIC_H__
46 #define __GDK_REGION_GENERIC_H__
66 #define EXTENTCHECK(r1, r2) \
67 ((r1)->x2 > (r2)->x1 && \
68 (r1)->x1 < (r2)->x2 && \
69 (r1)->y2 > (r2)->y1 && \
75 #define EXTENTS(r,idRect){\
76 if((r)->x1 < (idRect)->extents.x1)\
77 (idRect)->extents.x1 = (r)->x1;\
78 if((r)->y1 < (idRect)->extents.y1)\
79 (idRect)->extents.y1 = (r)->y1;\
80 if((r)->x2 > (idRect)->extents.x2)\
81 (idRect)->extents.x2 = (r)->x2;\
82 if((r)->y2 > (idRect)->extents.y2)\
83 (idRect)->extents.y2 = (r)->y2;\
86 #define GROWREGION(reg, nRects) { \
87 if ((nRects) == 0) { \
88 if ((reg)->rects != &(reg)->extents) { \
89 g_free ((reg)->rects); \
90 (reg)->rects = &(reg)->extents; \
93 else if ((reg)->rects == &(reg)->extents) { \
94 (reg)->rects = g_new (GdkRegionBox, (nRects)); \
95 (reg)->rects[0] = (reg)->extents; \
98 (reg)->rects = g_renew (GdkRegionBox, (reg)->rects, (nRects)); \
99 (reg)->size = (nRects); \
105 #define MEMCHECK(reg, rect, firstrect){ \
106 if ((reg)->numRects >= ((reg)->size - 1)) { \
107 GROWREGION(reg,2*(reg)->size); \
108 (rect) = &(firstrect)[(reg)->numRects]; \
116 #define CHECK_PREVIOUS(Reg, R, Rx1, Ry1, Rx2, Ry2)\
117 (!(((Reg)->numRects > 0)&&\
118 ((R-1)->y1 == (Ry1)) &&\
119 ((R-1)->y2 == (Ry2)) &&\
120 ((R-1)->x1 <= (Rx1)) &&\
121 ((R-1)->x2 >= (Rx2))))
124 #define ADDRECT(reg, r, rx1, ry1, rx2, ry2){\
125 if (((rx1) < (rx2)) && ((ry1) < (ry2)) &&\
126 CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\
131 EXTENTS((r), (reg));\
140 #define ADDRECTNOX(reg, r, rx1, ry1, rx2, ry2){\
141 if ((rx1 < rx2) && (ry1 < ry2) &&\
142 CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\
152 #define EMPTY_REGION(pReg) pReg->numRects = 0
154 #define REGION_NOT_EMPTY(pReg) pReg->numRects
156 #define INBOX(r, x, y) \
157 ( ( ((r).x2 > x)) && \
158 ( ((r).x1 <= x)) && \
166 #define NUMPTSTOBUFFER 200
struct _POINTBLOCK POINTBLOCK
typedefG_BEGIN_DECLS struct _GdkPoint GdkPoint
struct _POINTBLOCK * next