diff options
author | Pierre Ossman <ossman@cendio.se> | 2016-05-13 15:53:25 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2016-05-13 15:53:25 +0200 |
commit | 88903f22050de4879b01a0814a680d1d4d1d7ee4 (patch) | |
tree | d434d7ba988336d1906454b34ad1d099889b6acf | |
parent | 4e7d05c99258fe9968dfff7c77b82328bf6d2d2d (diff) | |
download | tigervnc-88903f22050de4879b01a0814a680d1d4d1d7ee4.tar.gz tigervnc-88903f22050de4879b01a0814a680d1d4d1d7ee4.zip |
Split Xregion headers according to upstream
We've stolen the Xregion code from libX11, so let's keep the same
header naming so that it is easier to keep things in sync.
-rw-r--r-- | common/Xregion/Region.c | 5 | ||||
-rw-r--r-- | common/Xregion/Xlib.h | 50 | ||||
-rw-r--r-- | common/Xregion/Xlibint.h | 48 | ||||
-rw-r--r-- | common/Xregion/Xregion.h | 276 | ||||
-rw-r--r-- | common/Xregion/Xutil.h | 184 | ||||
-rw-r--r-- | common/Xregion/region.h | 190 | ||||
-rw-r--r-- | common/rfb/Region.cxx | 8 |
7 files changed, 419 insertions, 342 deletions
diff --git a/common/Xregion/Region.c b/common/Xregion/Region.c index 604ecded..e51bcb3f 100644 --- a/common/Xregion/Region.c +++ b/common/Xregion/Region.c @@ -72,8 +72,11 @@ SOFTWARE. * the y-x-banding that's so nice to have... */ +#include <string.h> + +#include "Xlibint.h" +#include "Xutil.h" #include "Xregion.h" -#include "region.h" #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) diff --git a/common/Xregion/Xlib.h b/common/Xregion/Xlib.h new file mode 100644 index 00000000..ba6f2818 --- /dev/null +++ b/common/Xregion/Xlib.h @@ -0,0 +1,50 @@ +/* + +Copyright 1985, 1986, 1987, 1991, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + + +/* + * Xlib.h - Header definition and support file for the C subroutine + * interface library (Xlib) to the X Window System Protocol (V11). + * Structures and symbols starting with "_" are private to the library. + */ +#ifndef _X11_XLIB_H_ +#define _X11_XLIB_H_ + +#define NeedFunctionPrototypes 1 + +#define Bool int + +typedef struct { + short x, y; +} XPoint; + +typedef struct { + short x, y; + unsigned short width, height; +} XRectangle; + + +#endif /* _X11_XLIB_H_ */ diff --git a/common/Xregion/Xlibint.h b/common/Xregion/Xlibint.h new file mode 100644 index 00000000..9b9ae288 --- /dev/null +++ b/common/Xregion/Xlibint.h @@ -0,0 +1,48 @@ + +/* + +Copyright 1984, 1985, 1987, 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifndef _X11_XLIBINT_H_ +#define _X11_XLIBINT_H_ 1 + +/* + * Xlibint.h - Header definition and support file for the internal + * support routines used by the C subroutine interface + * library (Xlib) to the X Window System. + * + * Warning, there be dragons here.... + */ + +#include <stdlib.h> + +#define Xfree(ptr) free((ptr)) +#define Xmalloc(size) malloc((size)) +#define Xrealloc(ptr, size) realloc((ptr), (size)) +#define Xcalloc(nelem, elsize) calloc((nelem), (elsize)) + +#endif /* _X11_XLIBINT_H_ */ diff --git a/common/Xregion/Xregion.h b/common/Xregion/Xregion.h index 28cfa0ad..a9c977d0 100644 --- a/common/Xregion/Xregion.h +++ b/common/Xregion/Xregion.h @@ -1,6 +1,5 @@ -/* $Xorg: Xutil.h,v 1.8 2001/02/09 02:03:39 xorgcvs Exp $ */ - -/*********************************************************** +/* $Xorg: region.h,v 1.4 2001/02/09 02:03:40 xorgcvs Exp $ */ +/************************************************************************ Copyright 1987, 1998 The Open Group @@ -45,168 +44,147 @@ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -******************************************************************/ -/* $XFree86: xc/lib/X11/Xutil.h,v 3.4 2001/12/14 19:54:10 dawes Exp $ */ - -#ifndef _XREGION_H_ -#define _XREGION_H_ - -/* - Faked defines to fool the X11 region code */ - -#include <stdlib.h> -#include <string.h> - -#define Bool int -#define Xmalloc malloc -#define Xfree free -#define Xrealloc realloc - -#define NeedFunctionPrototypes 1 +************************************************************************/ -/* - Cribbed from Xlib.h */ +#ifndef _X11_XREGION_H_ +#define _X11_XREGION_H_ typedef struct { - short x, y; -} XPoint; + short x1, x2, y1, y2; +} Box, BOX, BoxRec, *BoxPtr; typedef struct { - short x, y; - unsigned short width, height; -} XRectangle; + short x, y, width, height; +}RECTANGLE, RectangleRec, *RectanglePtr; -/* - * opaque reference to Region data type - */ -typedef struct _XRegion *Region; - -/* Return values from XRectInRegion() */ - -#define RectangleOut 0 -#define RectangleIn 1 -#define RectanglePart 2 - -#ifdef __cplusplus -extern "C" { +#define TRUE 1 +#define FALSE 0 +#define MAXSHORT 32767 +#define MINSHORT -MAXSHORT +#ifndef MAX +#define MAX(a,b) (((a) > (b)) ? (a) : (b)) #endif - -extern int XClipBox( -#if NeedFunctionPrototypes - Region /* r */, - XRectangle* /* rect_return */ +#ifndef MIN +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif -); -extern Region XCreateRegion( -#if NeedFunctionPrototypes - void -#endif -); - -extern const char *XDefaultString (void); - -extern int XDestroyRegion( -#if NeedFunctionPrototypes - Region /* r */ -#endif -); - -extern int XEmptyRegion( -#if NeedFunctionPrototypes - Region /* r */ -#endif -); - -extern int XEqualRegion( -#if NeedFunctionPrototypes - Region /* r1 */, - Region /* r2 */ -#endif -); - -extern int XIntersectRegion( -#if NeedFunctionPrototypes - Region /* sra */, - Region /* srb */, - Region /* dr_return */ -#endif -); -extern int XOffsetRegion( -#if NeedFunctionPrototypes - Region /* r */, - int /* dx */, - int /* dy */ -#endif -); +/* + * clip region + */ -extern Bool XPointInRegion( -#if NeedFunctionPrototypes - Region /* r */, - int /* x */, - int /* y */ -#endif -); +typedef struct _XRegion { + long size; + long numRects; + BOX *rects; + BOX extents; +} REGION; -extern Region XPolygonRegion( -#if NeedFunctionPrototypes - XPoint* /* points */, - int /* n */, - int /* fill_rule */ -#endif -); - -extern int XRectInRegion( -#if NeedFunctionPrototypes - Region /* r */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */ -#endif -); +/* Xutil.h contains the declaration: + * typedef struct _XRegion *Region; + */ -extern int XShrinkRegion( -#if NeedFunctionPrototypes - Region /* r */, - int /* dx */, - int /* dy */ -#endif -); +/* 1 if two BOXs overlap. + * 0 if two BOXs do not overlap. + * Remember, x2 and y2 are not in the region + */ +#define EXTENTCHECK(r1, r2) \ + ((r1)->x2 > (r2)->x1 && \ + (r1)->x1 < (r2)->x2 && \ + (r1)->y2 > (r2)->y1 && \ + (r1)->y1 < (r2)->y2) -extern int XSubtractRegion( -#if NeedFunctionPrototypes - Region /* sra */, - Region /* srb */, - Region /* dr_return */ -#endif -); +/* + * update region extents + */ +#define EXTENTS(r,idRect){\ + if((r)->x1 < (idRect)->extents.x1)\ + (idRect)->extents.x1 = (r)->x1;\ + if((r)->y1 < (idRect)->extents.y1)\ + (idRect)->extents.y1 = (r)->y1;\ + if((r)->x2 > (idRect)->extents.x2)\ + (idRect)->extents.x2 = (r)->x2;\ + if((r)->y2 > (idRect)->extents.y2)\ + (idRect)->extents.y2 = (r)->y2;\ + } -extern int XUnionRectWithRegion( -#if NeedFunctionPrototypes - XRectangle* /* rectangle */, - Region /* src_region */, - Region /* dest_region_return */ -#endif -); +/* + * Check to see if there is enough memory in the present region. + */ +#define MEMCHECK(reg, rect, firstrect){\ + if ((reg)->numRects >= ((reg)->size - 1)){\ + (firstrect) = (BOX *) Xrealloc \ + ((char *)(firstrect), (unsigned) (2 * (sizeof(BOX)) * ((reg)->size)));\ + if ((firstrect) == 0)\ + return(0);\ + (reg)->size *= 2;\ + (rect) = &(firstrect)[(reg)->numRects];\ + }\ + } + +/* this routine checks to see if the previous rectangle is the same + * or subsumes the new rectangle to add. + */ -extern int XUnionRegion( -#if NeedFunctionPrototypes - Region /* sra */, - Region /* srb */, - Region /* dr_return */ -#endif -); +#define CHECK_PREVIOUS(Reg, R, Rx1, Ry1, Rx2, Ry2)\ + (!(((Reg)->numRects > 0)&&\ + ((R-1)->y1 == (Ry1)) &&\ + ((R-1)->y2 == (Ry2)) &&\ + ((R-1)->x1 <= (Rx1)) &&\ + ((R-1)->x2 >= (Rx2)))) + +/* add a rectangle to the given Region */ +#define ADDRECT(reg, r, rx1, ry1, rx2, ry2){\ + if (((rx1) < (rx2)) && ((ry1) < (ry2)) &&\ + CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\ + (r)->x1 = (rx1);\ + (r)->y1 = (ry1);\ + (r)->x2 = (rx2);\ + (r)->y2 = (ry2);\ + EXTENTS((r), (reg));\ + (reg)->numRects++;\ + (r)++;\ + }\ + } + + + +/* add a rectangle to the given Region */ +#define ADDRECTNOX(reg, r, rx1, ry1, rx2, ry2){\ + if ((rx1 < rx2) && (ry1 < ry2) &&\ + CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\ + (r)->x1 = (rx1);\ + (r)->y1 = (ry1);\ + (r)->x2 = (rx2);\ + (r)->y2 = (ry2);\ + (reg)->numRects++;\ + (r)++;\ + }\ + } + +#define EMPTY_REGION(pReg) pReg->numRects = 0 + +#define REGION_NOT_EMPTY(pReg) pReg->numRects + +#define INBOX(r, x, y) \ + ( ( ((r).x2 > x)) && \ + ( ((r).x1 <= x)) && \ + ( ((r).y2 > y)) && \ + ( ((r).y1 <= y)) ) -extern int XXorRegion( -#if NeedFunctionPrototypes - Region /* sra */, - Region /* srb */, - Region /* dr_return */ -#endif -); +/* + * number of points to buffer before sending them off + * to scanlines() : Must be an even number + */ +#define NUMPTSTOBUFFER 200 -#ifdef __cplusplus -}; -#endif +/* + * used to allocate buffers for points and link + * the buffers together + */ +typedef struct _POINTBLOCK { + XPoint pts[NUMPTSTOBUFFER]; + struct _POINTBLOCK *next; +} POINTBLOCK; -#endif /* _XUTIL_H_ */ +#endif /* _X11_XREGION_H_ */ diff --git a/common/Xregion/Xutil.h b/common/Xregion/Xutil.h new file mode 100644 index 00000000..7e07c9bb --- /dev/null +++ b/common/Xregion/Xutil.h @@ -0,0 +1,184 @@ +/* $Xorg: Xutil.h,v 1.8 2001/02/09 02:03:39 xorgcvs Exp $ */ + +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ +/* $XFree86: xc/lib/X11/Xutil.h,v 3.4 2001/12/14 19:54:10 dawes Exp $ */ + +#ifndef _X11_XUTIL_H_ +#define _X11_XUTIL_H_ + +/* You must include <X11/Xlib.h> before including this file */ +#include "Xlib.h" + +/* + * opaque reference to Region data type + */ +typedef struct _XRegion *Region; + +/* Return values from XRectInRegion() */ + +#define RectangleOut 0 +#define RectangleIn 1 +#define RectanglePart 2 + +extern int XClipBox( +#if NeedFunctionPrototypes + Region /* r */, + XRectangle* /* rect_return */ +#endif +); + +extern Region XCreateRegion( +#if NeedFunctionPrototypes + void +#endif +); + +extern const char *XDefaultString (void); + +extern int XDestroyRegion( +#if NeedFunctionPrototypes + Region /* r */ +#endif +); + +extern int XEmptyRegion( +#if NeedFunctionPrototypes + Region /* r */ +#endif +); + +extern int XEqualRegion( +#if NeedFunctionPrototypes + Region /* r1 */, + Region /* r2 */ +#endif +); + +extern int XIntersectRegion( +#if NeedFunctionPrototypes + Region /* sra */, + Region /* srb */, + Region /* dr_return */ +#endif +); + +extern int XOffsetRegion( +#if NeedFunctionPrototypes + Region /* r */, + int /* dx */, + int /* dy */ +#endif +); + +extern Bool XPointInRegion( +#if NeedFunctionPrototypes + Region /* r */, + int /* x */, + int /* y */ +#endif +); + +extern Region XPolygonRegion( +#if NeedFunctionPrototypes + XPoint* /* points */, + int /* n */, + int /* fill_rule */ +#endif +); + +extern int XRectInRegion( +#if NeedFunctionPrototypes + Region /* r */, + int /* x */, + int /* y */, + unsigned int /* width */, + unsigned int /* height */ +#endif +); + +extern int XShrinkRegion( +#if NeedFunctionPrototypes + Region /* r */, + int /* dx */, + int /* dy */ +#endif +); + +extern int XSubtractRegion( +#if NeedFunctionPrototypes + Region /* sra */, + Region /* srb */, + Region /* dr_return */ +#endif +); + +extern int XUnionRectWithRegion( +#if NeedFunctionPrototypes + XRectangle* /* rectangle */, + Region /* src_region */, + Region /* dest_region_return */ +#endif +); + +extern int XUnionRegion( +#if NeedFunctionPrototypes + Region /* sra */, + Region /* srb */, + Region /* dr_return */ +#endif +); + +extern int XXorRegion( +#if NeedFunctionPrototypes + Region /* sra */, + Region /* srb */, + Region /* dr_return */ +#endif +); + +#endif /* _XUTIL_H_ */ diff --git a/common/Xregion/region.h b/common/Xregion/region.h deleted file mode 100644 index 2ddf12ca..00000000 --- a/common/Xregion/region.h +++ /dev/null @@ -1,190 +0,0 @@ -/* $Xorg: region.h,v 1.4 2001/02/09 02:03:40 xorgcvs Exp $ */ -/************************************************************************ - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -************************************************************************/ - -#ifndef _XREGION_H -#define _XREGION_H - -typedef struct { - short x1, x2, y1, y2; -} Box, BOX, BoxRec, *BoxPtr; - -typedef struct { - short x, y, width, height; -}RECTANGLE, RectangleRec, *RectanglePtr; - -#define TRUE 1 -#define FALSE 0 -#define MAXSHORT 32767 -#define MINSHORT -MAXSHORT -#ifndef MAX -#define MAX(a,b) (((a) > (b)) ? (a) : (b)) -#endif -#ifndef MIN -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) -#endif - - -/* - * clip region - */ - -typedef struct _XRegion { - long size; - long numRects; - BOX *rects; - BOX extents; -} REGION; - -/* Xutil.h contains the declaration: - * typedef struct _XRegion *Region; - */ - -/* 1 if two BOXs overlap. - * 0 if two BOXs do not overlap. - * Remember, x2 and y2 are not in the region - */ -#define EXTENTCHECK(r1, r2) \ - ((r1)->x2 > (r2)->x1 && \ - (r1)->x1 < (r2)->x2 && \ - (r1)->y2 > (r2)->y1 && \ - (r1)->y1 < (r2)->y2) - -/* - * update region extents - */ -#define EXTENTS(r,idRect){\ - if((r)->x1 < (idRect)->extents.x1)\ - (idRect)->extents.x1 = (r)->x1;\ - if((r)->y1 < (idRect)->extents.y1)\ - (idRect)->extents.y1 = (r)->y1;\ - if((r)->x2 > (idRect)->extents.x2)\ - (idRect)->extents.x2 = (r)->x2;\ - if((r)->y2 > (idRect)->extents.y2)\ - (idRect)->extents.y2 = (r)->y2;\ - } - -/* - * Check to see if there is enough memory in the present region. - */ -#define MEMCHECK(reg, rect, firstrect){\ - if ((reg)->numRects >= ((reg)->size - 1)){\ - (firstrect) = (BOX *) Xrealloc \ - ((char *)(firstrect), (unsigned) (2 * (sizeof(BOX)) * ((reg)->size)));\ - if ((firstrect) == 0)\ - return(0);\ - (reg)->size *= 2;\ - (rect) = &(firstrect)[(reg)->numRects];\ - }\ - } - -/* this routine checks to see if the previous rectangle is the same - * or subsumes the new rectangle to add. - */ - -#define CHECK_PREVIOUS(Reg, R, Rx1, Ry1, Rx2, Ry2)\ - (!(((Reg)->numRects > 0)&&\ - ((R-1)->y1 == (Ry1)) &&\ - ((R-1)->y2 == (Ry2)) &&\ - ((R-1)->x1 <= (Rx1)) &&\ - ((R-1)->x2 >= (Rx2)))) - -/* add a rectangle to the given Region */ -#define ADDRECT(reg, r, rx1, ry1, rx2, ry2){\ - if (((rx1) < (rx2)) && ((ry1) < (ry2)) &&\ - CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\ - (r)->x1 = (rx1);\ - (r)->y1 = (ry1);\ - (r)->x2 = (rx2);\ - (r)->y2 = (ry2);\ - EXTENTS((r), (reg));\ - (reg)->numRects++;\ - (r)++;\ - }\ - } - - - -/* add a rectangle to the given Region */ -#define ADDRECTNOX(reg, r, rx1, ry1, rx2, ry2){\ - if ((rx1 < rx2) && (ry1 < ry2) &&\ - CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\ - (r)->x1 = (rx1);\ - (r)->y1 = (ry1);\ - (r)->x2 = (rx2);\ - (r)->y2 = (ry2);\ - (reg)->numRects++;\ - (r)++;\ - }\ - } - -#define EMPTY_REGION(pReg) pReg->numRects = 0 - -#define REGION_NOT_EMPTY(pReg) pReg->numRects - -#define INBOX(r, x, y) \ - ( ( ((r).x2 > x)) && \ - ( ((r).x1 <= x)) && \ - ( ((r).y2 > y)) && \ - ( ((r).y1 <= y)) ) - -/* - * number of points to buffer before sending them off - * to scanlines() : Must be an even number - */ -#define NUMPTSTOBUFFER 200 - -/* - * used to allocate buffers for points and link - * the buffers together - */ -typedef struct _POINTBLOCK { - XPoint pts[NUMPTSTOBUFFER]; - struct _POINTBLOCK *next; -} POINTBLOCK; - -#endif diff --git a/common/rfb/Region.cxx b/common/rfb/Region.cxx index 7965a6c4..995f8c5b 100644 --- a/common/rfb/Region.cxx +++ b/common/rfb/Region.cxx @@ -24,11 +24,15 @@ // #include <rfb/Region.h> -#include <Xregion/Xregion.h> -#include <Xregion/region.h> #include <assert.h> #include <stdio.h> +extern "C" { +#include <Xregion/Xlibint.h> +#include <Xregion/Xutil.h> +#include <Xregion/Xregion.h> +} + // A _RectRegion must never be passed as a return parameter to the Xlib region // operations. This is because for efficiency its "rects" member has not been // allocated with Xmalloc. It is however safe to pass it as an input |