File indexing completed on 2025-01-18 10:14:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 #ifndef _X11_XREGION_H_
0049 #define _X11_XREGION_H_
0050
0051 typedef struct {
0052 short x1, x2, y1, y2;
0053 } Box, BOX, BoxRec, *BoxPtr;
0054
0055 typedef struct {
0056 short x, y, width, height;
0057 }RECTANGLE, RectangleRec, *RectanglePtr;
0058
0059 #define TRUE 1
0060 #define FALSE 0
0061 #define MAXSHORT 32767
0062 #define MINSHORT -MAXSHORT
0063 #ifndef MAX
0064 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
0065 #endif
0066 #ifndef MIN
0067 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
0068 #endif
0069
0070
0071
0072
0073
0074
0075 typedef struct _XRegion {
0076 long size;
0077 long numRects;
0078 BOX *rects;
0079 BOX extents;
0080 } REGION;
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090 #define EXTENTCHECK(r1, r2) \
0091 ((r1)->x2 > (r2)->x1 && \
0092 (r1)->x1 < (r2)->x2 && \
0093 (r1)->y2 > (r2)->y1 && \
0094 (r1)->y1 < (r2)->y2)
0095
0096
0097
0098
0099 #define EXTENTS(r,idRect){\
0100 if((r)->x1 < (idRect)->extents.x1)\
0101 (idRect)->extents.x1 = (r)->x1;\
0102 if((r)->y1 < (idRect)->extents.y1)\
0103 (idRect)->extents.y1 = (r)->y1;\
0104 if((r)->x2 > (idRect)->extents.x2)\
0105 (idRect)->extents.x2 = (r)->x2;\
0106 if((r)->y2 > (idRect)->extents.y2)\
0107 (idRect)->extents.y2 = (r)->y2;\
0108 }
0109
0110
0111
0112
0113 #define MEMCHECK(reg, rect, firstrect){\
0114 if ((reg)->numRects >= ((reg)->size - 1)){\
0115 BoxPtr tmpRect = Xrealloc ((firstrect), \
0116 (2 * (sizeof(BOX)) * ((reg)->size))); \
0117 if (tmpRect == NULL) \
0118 return(0);\
0119 (firstrect) = tmpRect; \
0120 (reg)->size *= 2;\
0121 (rect) = &(firstrect)[(reg)->numRects];\
0122 }\
0123 }
0124
0125
0126
0127
0128
0129 #define CHECK_PREVIOUS(Reg, R, Rx1, Ry1, Rx2, Ry2)\
0130 (!(((Reg)->numRects > 0)&&\
0131 ((R-1)->y1 == (Ry1)) &&\
0132 ((R-1)->y2 == (Ry2)) &&\
0133 ((R-1)->x1 <= (Rx1)) &&\
0134 ((R-1)->x2 >= (Rx2))))
0135
0136
0137 #define ADDRECT(reg, r, rx1, ry1, rx2, ry2){\
0138 if (((rx1) < (rx2)) && ((ry1) < (ry2)) &&\
0139 CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\
0140 (r)->x1 = (rx1);\
0141 (r)->y1 = (ry1);\
0142 (r)->x2 = (rx2);\
0143 (r)->y2 = (ry2);\
0144 EXTENTS((r), (reg));\
0145 (reg)->numRects++;\
0146 (r)++;\
0147 }\
0148 }
0149
0150
0151
0152
0153 #define ADDRECTNOX(reg, r, rx1, ry1, rx2, ry2){\
0154 if ((rx1 < rx2) && (ry1 < ry2) &&\
0155 CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\
0156 (r)->x1 = (rx1);\
0157 (r)->y1 = (ry1);\
0158 (r)->x2 = (rx2);\
0159 (r)->y2 = (ry2);\
0160 (reg)->numRects++;\
0161 (r)++;\
0162 }\
0163 }
0164
0165 #define EMPTY_REGION(pReg) pReg->numRects = 0
0166
0167 #define REGION_NOT_EMPTY(pReg) pReg->numRects
0168
0169 #define INBOX(r, x, y) \
0170 ( ( ((r).x2 > x)) && \
0171 ( ((r).x1 <= x)) && \
0172 ( ((r).y2 > y)) && \
0173 ( ((r).y1 <= y)) )
0174
0175
0176
0177
0178
0179 #define NUMPTSTOBUFFER 200
0180
0181
0182
0183
0184
0185 typedef struct _POINTBLOCK {
0186 XPoint pts[NUMPTSTOBUFFER];
0187 struct _POINTBLOCK *next;
0188 } POINTBLOCK;
0189
0190 #endif