Annotation of researchv9/X11/src/X.V11R1/server/include/regionstr.h, revision 1.1.1.1

1.1       root        1: /* $Header: regionstr.h,v 1.1 87/09/11 07:50:10 toddb 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 _Region {
                     35:     short      size;
                     36:     short      numRects;
                     37:     BoxPtr     rects;
                     38:     BoxRec     extents;
                     39: } RegionRec;
                     40: 
                     41: /*
                     42:  *   Check to see if there is enough memory in the present region.
                     43:  */
                     44: #define MEMCHECK(reg, rect, firstrect){\
                     45:         if ((reg)->numRects >= ((reg)->size - 1)){\
                     46:           (firstrect) = (BoxPtr) Xrealloc \
                     47:           ((firstrect), (2 * (sizeof(BoxRec)) * ((reg)->size)));\
                     48:           (reg)->size *= 2;\
                     49:           (rect) = &(firstrect)[(reg)->numRects];\
                     50:          }\
                     51:        }
                     52: 
                     53: /*  this routine checks to see if the previous rectangle is the same
                     54:  *  or subsumes the new rectangle to add.
                     55:  */
                     56: 
                     57: #define CHECK_PREVIOUS(Reg, R, Rx1, Ry1, Rx2, Ry2)\
                     58:                (!(((Reg)->numRects > 0)&&\
                     59:                   ((R-1)->y1 == (Ry1)) &&\
                     60:                   ((R-1)->y2 == (Ry2)) &&\
                     61:                   ((R-1)->x1 <= (Rx1)) &&\
                     62:                   ((R-1)->x2 >= (Rx2))))
                     63: 
                     64: /*  add a rectangle to the given Region */
                     65: #define ADDRECT(reg, r, rx1, ry1, rx2, ry2){\
                     66:     if (((rx1) < (rx2)) && ((ry1) < (ry2)) &&\
                     67:         CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\
                     68:               (r)->x1 = (rx1);\
                     69:               (r)->y1 = (ry1);\
                     70:               (r)->x2 = (rx2);\
                     71:               (r)->y2 = (ry2);\
                     72:               EXTENTS((r), (reg));\
                     73:               (reg)->numRects++;\
                     74:               (r)++;\
                     75:             }\
                     76:         }
                     77: 
                     78: 
                     79: /*
                     80:  *  update region extents
                     81:  */
                     82: #define EXTENTS(r,idRect){\
                     83:             if((r)->x1 < (idRect)->extents.x1)\
                     84:               (idRect)->extents.x1 = (r)->x1;\
                     85:             if((r)->y1 < (idRect)->extents.y1)\
                     86:               (idRect)->extents.y1 = (r)->y1;\
                     87:             if((r)->x2 > (idRect)->extents.x2)\
                     88:               (idRect)->extents.x2 = (r)->x2;\
                     89:             if((r)->y2 > (idRect)->extents.y2)\
                     90:               (idRect)->extents.y2 = (r)->y2;\
                     91:         }
                     92: 
                     93: 
                     94: #define EMPTY_REGION(pReg) (pReg->numRects = 0)
                     95: 
                     96: #define REGION_NOT_EMPTY(pReg) (pReg->numRects)
                     97: 
                     98: extern RegionPtr miRegionCreate();
                     99: extern void miprintRects();
                    100: extern void miRegionCopy();
                    101: extern int miInverse();
                    102: extern int miIntersect();
                    103: extern int miUnion();
                    104: extern int miSubtract();
                    105: extern int miRectIn();
                    106: extern void miTranslateRegion();
                    107: extern void miRegionDestroy();
                    108: extern void miRegionReset();
                    109: extern Bool miPointInRegion();
                    110: 
                    111: #endif /* REGIONSTRUCT_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.