Change region implementation names to eliminate the 'mi' prefix
This prepares the file to be moved from mi to dix. This patch was done mechanically with the included scripts 'fix-miregion' run over the entire X server and 'fix-miregion-private' run over include/regionstr.h and mi/miregion.c. Reviewed-by: Jamey Sharp <jamey@minilop.net> Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
		@@ -195,7 +195,7 @@ PrintChildren(WindowPtr p1, int indent)
 | 
			
		||||
        ErrorF("[dix] ");
 | 
			
		||||
	for (i=0; i<indent; i++) ErrorF(" ");
 | 
			
		||||
	ErrorF("%lx\n", p1->drawable.id);
 | 
			
		||||
	miPrintRegion(&p1->clipList);
 | 
			
		||||
	RegionPrint(&p1->clipList);
 | 
			
		||||
	PrintChildren(p2, indent+4);
 | 
			
		||||
	p1 = p1->nextSib;
 | 
			
		||||
    }
 | 
			
		||||
@@ -211,7 +211,7 @@ PrintWindowTree(void)
 | 
			
		||||
    {
 | 
			
		||||
	ErrorF("[dix] WINDOW %d\n", i);
 | 
			
		||||
	pWin = screenInfo.screens[i]->root;
 | 
			
		||||
	miPrintRegion(&pWin->clipList);
 | 
			
		||||
	RegionPrint(&pWin->clipList);
 | 
			
		||||
	p1 = pWin->firstChild;
 | 
			
		||||
	PrintChildren(p1, 4);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -407,7 +407,7 @@ exaHWCopyNtoN (DrawablePtr    pSrcDrawable,
 | 
			
		||||
	    rects[i].height = pbox[i].y2 - pbox[i].y1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* This must match the miRegionCopy() logic for reversing rect order */
 | 
			
		||||
	/* This must match the RegionCopy() logic for reversing rect order */
 | 
			
		||||
	if (nbox == 1 || (dx > 0 && dy > 0) ||
 | 
			
		||||
	    (pDstDrawable != pSrcDrawable &&
 | 
			
		||||
	     (pDstDrawable->type != DRAWABLE_WINDOW ||
 | 
			
		||||
 
 | 
			
		||||
@@ -115,7 +115,7 @@ if (((rx1) < (rx2)) && ((ry1) < (ry2)) &&			\
 | 
			
		||||
{								\
 | 
			
		||||
    if ((reg)->data->numRects == (reg)->data->size)		\
 | 
			
		||||
    {								\
 | 
			
		||||
	miRectAlloc(reg, 1);					\
 | 
			
		||||
	RegionRectAlloc(reg, 1);					\
 | 
			
		||||
	fr = REGION_BOXPTR(reg);				\
 | 
			
		||||
	r = fr + (reg)->data->numRects;				\
 | 
			
		||||
    }								\
 | 
			
		||||
@@ -315,7 +315,7 @@ fbPixmapToRegion(PixmapPtr pPix)
 | 
			
		||||
 | 
			
		||||
    fbFinishAccess(&pPix->drawable);
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
    if (!miValidRegion(pReg))
 | 
			
		||||
    if (!RegionIsValid(pReg))
 | 
			
		||||
	FatalError("Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__);
 | 
			
		||||
#endif
 | 
			
		||||
    return(pReg);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										29
									
								
								fix-miregion
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										29
									
								
								fix-miregion
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,29 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
sed -i \
 | 
			
		||||
-e 's/miRegionCreate\b/RegionCreate/g' \
 | 
			
		||||
-e 's/miRegionInit\b/RegionInit/g' \
 | 
			
		||||
-e 's/miRegionDestroy\b/RegionDestroy/g' \
 | 
			
		||||
-e 's/miRegionUninit\b/RegionUninit/g' \
 | 
			
		||||
-e 's/miRegionCopy\b/RegionCopy/g' \
 | 
			
		||||
-e 's/miIntersect\b/RegionIntersect/g' \
 | 
			
		||||
-e 's/miUnion\b/RegionUnion/g' \
 | 
			
		||||
-e 's/miRegionAppend\b/RegionAppend/g' \
 | 
			
		||||
-e 's/miRegionValidate\b/RegionValidate/g' \
 | 
			
		||||
-e 's/miRectsToRegion\b/RegionFromRects/g' \
 | 
			
		||||
-e 's/miSubtract\b/RegionSubtract/g' \
 | 
			
		||||
-e 's/miInverse\b/RegionInverse/g' \
 | 
			
		||||
-e 's/miRectIn\b/RegionContainsRect/g' \
 | 
			
		||||
-e 's/miTranslateRegion\b/RegionTranslate/g' \
 | 
			
		||||
-e 's/miRegionReset\b/RegionReset/g' \
 | 
			
		||||
-e 's/miRegionBreak\b/RegionBreak/g' \
 | 
			
		||||
-e 's/miPointInRegion\b/RegionContainsPoint/g' \
 | 
			
		||||
-e 's/miRegionEqual\b/RegionEqual/g' \
 | 
			
		||||
-e 's/miRegionNotEmpty\b/RegionNotEmpty/g' \
 | 
			
		||||
-e 's/miRegionEmpty\b/RegionEmpty/g' \
 | 
			
		||||
-e 's/miRegionExtents\b/RegionExtents/g' \
 | 
			
		||||
-e 's/miPrintRegion\b/RegionPrint/g' \
 | 
			
		||||
-e 's/miRectAlloc\b/RegionRectAlloc/g' \
 | 
			
		||||
-e 's/miValidRegion\b/RegionIsValid/g' \
 | 
			
		||||
-e 's/miRegionBroken\b/RegionBroken/g' \
 | 
			
		||||
-e 's/miClipSpans\b/RegionClipSpans/g' \
 | 
			
		||||
"$@"
 | 
			
		||||
							
								
								
									
										14
									
								
								fix-miregion-private
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										14
									
								
								fix-miregion-private
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
sed -i \
 | 
			
		||||
-e 's/miEmptyBox\b/RegionEmptyBox/g' \
 | 
			
		||||
-e 's/miEmptyData\b/RegionEmptyData/g' \
 | 
			
		||||
-e 's/miBrokenData\b/RegionBrokenData/g' \
 | 
			
		||||
-e 's/miBrokenRegion\b/RegionBrokenRegion/g' \
 | 
			
		||||
-e 's/miCoalesce\b/RegionCoalesce/g' \
 | 
			
		||||
-e 's/miAppendNonO\b/RegionAppendNonO/g' \
 | 
			
		||||
-e 's/miRegionOp\b/RegionOp/g' \
 | 
			
		||||
-e 's/miSetExtents\b/RegionSetExtents/g' \
 | 
			
		||||
-e 's/miIntersectO\b/RegionIntersectO/g' \
 | 
			
		||||
-e 's/miUnionO\b/RegionUnionO/g' \
 | 
			
		||||
-e 's/miSubtractO\b/RegionSubtractO/g' \
 | 
			
		||||
"$@"
 | 
			
		||||
@@ -66,13 +66,13 @@ typedef struct pixman_region16 RegionRec, *RegionPtr;
 | 
			
		||||
 | 
			
		||||
typedef struct pixman_region16_data RegDataRec, *RegDataPtr;
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT BoxRec miEmptyBox;
 | 
			
		||||
extern _X_EXPORT RegDataRec miEmptyData;
 | 
			
		||||
extern _X_EXPORT RegDataRec miBrokenData;
 | 
			
		||||
extern _X_EXPORT BoxRec RegionEmptyBox;
 | 
			
		||||
extern _X_EXPORT RegDataRec RegionEmptyData;
 | 
			
		||||
extern _X_EXPORT RegDataRec RegionBrokenData;
 | 
			
		||||
 | 
			
		||||
#define REGION_NIL(reg) ((reg)->data && !(reg)->data->numRects)
 | 
			
		||||
/* not a region */
 | 
			
		||||
#define REGION_NAR(reg)	((reg)->data == &miBrokenData)
 | 
			
		||||
#define REGION_NAR(reg)	((reg)->data == &RegionBrokenData)
 | 
			
		||||
#define REGION_NUM_RECTS(reg) ((reg)->data ? (reg)->data->numRects : 1)
 | 
			
		||||
#define REGION_SIZE(reg) ((reg)->data ? (reg)->data->size : 0)
 | 
			
		||||
#define REGION_RECTS(reg) ((reg)->data ? (BoxPtr)((reg)->data + 1) \
 | 
			
		||||
@@ -84,52 +84,52 @@ extern _X_EXPORT RegDataRec miBrokenData;
 | 
			
		||||
#define REGION_SZOF(n) (sizeof(RegDataRec) + ((n) * sizeof(BoxRec)))
 | 
			
		||||
 | 
			
		||||
#define REGION_CREATE(_pScreen, _rect, _size) \
 | 
			
		||||
    miRegionCreate(_rect, _size)
 | 
			
		||||
    RegionCreate(_rect, _size)
 | 
			
		||||
 | 
			
		||||
#define REGION_COPY(_pScreen, dst, src) \
 | 
			
		||||
    miRegionCopy(dst, src)
 | 
			
		||||
    RegionCopy(dst, src)
 | 
			
		||||
 | 
			
		||||
#define REGION_DESTROY(_pScreen, _pReg) \
 | 
			
		||||
    miRegionDestroy(_pReg)
 | 
			
		||||
    RegionDestroy(_pReg)
 | 
			
		||||
 | 
			
		||||
#define REGION_INTERSECT(_pScreen, newReg, reg1, reg2) \
 | 
			
		||||
    miIntersect(newReg, reg1, reg2)
 | 
			
		||||
    RegionIntersect(newReg, reg1, reg2)
 | 
			
		||||
 | 
			
		||||
#define REGION_UNION(_pScreen, newReg, reg1, reg2) \
 | 
			
		||||
    miUnion(newReg, reg1, reg2)
 | 
			
		||||
    RegionUnion(newReg, reg1, reg2)
 | 
			
		||||
 | 
			
		||||
#define REGION_SUBTRACT(_pScreen, newReg, reg1, reg2) \
 | 
			
		||||
    miSubtract(newReg, reg1, reg2)
 | 
			
		||||
    RegionSubtract(newReg, reg1, reg2)
 | 
			
		||||
 | 
			
		||||
#define REGION_INVERSE(_pScreen, newReg, reg1, invRect) \
 | 
			
		||||
    miInverse(newReg, reg1, invRect)
 | 
			
		||||
    RegionInverse(newReg, reg1, invRect)
 | 
			
		||||
 | 
			
		||||
#define REGION_TRANSLATE(_pScreen, _pReg, _x, _y) \
 | 
			
		||||
    miTranslateRegion(_pReg, _x, _y)
 | 
			
		||||
    RegionTranslate(_pReg, _x, _y)
 | 
			
		||||
 | 
			
		||||
#define RECT_IN_REGION(_pScreen, _pReg, prect) \
 | 
			
		||||
    miRectIn(_pReg, prect)
 | 
			
		||||
    RegionContainsRect(_pReg, prect)
 | 
			
		||||
 | 
			
		||||
#define POINT_IN_REGION(_pScreen, _pReg, _x, _y, prect) \
 | 
			
		||||
    miPointInRegion(_pReg, _x, _y, prect)
 | 
			
		||||
    RegionContainsPoint(_pReg, _x, _y, prect)
 | 
			
		||||
 | 
			
		||||
#define REGION_APPEND(_pScreen, dstrgn, rgn) \
 | 
			
		||||
    miRegionAppend(dstrgn, rgn)
 | 
			
		||||
    RegionAppend(dstrgn, rgn)
 | 
			
		||||
 | 
			
		||||
#define REGION_VALIDATE(_pScreen, badreg, pOverlap) \
 | 
			
		||||
    miRegionValidate(badreg, pOverlap)
 | 
			
		||||
    RegionValidate(badreg, pOverlap)
 | 
			
		||||
 | 
			
		||||
#define BITMAP_TO_REGION(_pScreen, pPix) \
 | 
			
		||||
    (*(_pScreen)->BitmapToRegion)(pPix) /* no mi version?! */
 | 
			
		||||
 | 
			
		||||
#define RECTS_TO_REGION(_pScreen, nrects, prect, ctype) \
 | 
			
		||||
    miRectsToRegion(nrects, prect, ctype)
 | 
			
		||||
    RegionFromRects(nrects, prect, ctype)
 | 
			
		||||
 | 
			
		||||
#define REGION_EQUAL(_pScreen, _pReg1, _pReg2) \
 | 
			
		||||
    miRegionEqual(_pReg1, _pReg2)
 | 
			
		||||
    RegionEqual(_pReg1, _pReg2)
 | 
			
		||||
 | 
			
		||||
#define REGION_BREAK(_pScreen, _pReg) \
 | 
			
		||||
    miRegionBreak(_pReg)
 | 
			
		||||
    RegionBreak(_pReg)
 | 
			
		||||
 | 
			
		||||
#define REGION_INIT(_pScreen, _pReg, _rect, _size) \
 | 
			
		||||
{ \
 | 
			
		||||
@@ -140,7 +140,7 @@ extern _X_EXPORT RegDataRec miBrokenData;
 | 
			
		||||
    } \
 | 
			
		||||
    else \
 | 
			
		||||
    { \
 | 
			
		||||
        (_pReg)->extents = miEmptyBox; \
 | 
			
		||||
        (_pReg)->extents = RegionEmptyBox; \
 | 
			
		||||
        if (((_size) > 1) && ((_pReg)->data = \
 | 
			
		||||
                             (RegDataPtr)malloc(REGION_SZOF(_size)))) \
 | 
			
		||||
        { \
 | 
			
		||||
@@ -148,7 +148,7 @@ extern _X_EXPORT RegDataRec miBrokenData;
 | 
			
		||||
            (_pReg)->data->numRects = 0; \
 | 
			
		||||
        } \
 | 
			
		||||
        else \
 | 
			
		||||
            (_pReg)->data = &miEmptyData; \
 | 
			
		||||
            (_pReg)->data = &RegionEmptyData; \
 | 
			
		||||
    } \
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
@@ -179,7 +179,7 @@ extern _X_EXPORT RegDataRec miBrokenData;
 | 
			
		||||
    REGION_UNINIT(_pScreen, _pReg); \
 | 
			
		||||
    (_pReg)->extents.x2 = (_pReg)->extents.x1; \
 | 
			
		||||
    (_pReg)->extents.y2 = (_pReg)->extents.y1; \
 | 
			
		||||
    (_pReg)->data = &miEmptyData; \
 | 
			
		||||
    (_pReg)->data = &RegionEmptyData; \
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define REGION_EXTENTS(_pScreen, _pReg) \
 | 
			
		||||
@@ -187,8 +187,8 @@ extern _X_EXPORT RegDataRec miBrokenData;
 | 
			
		||||
 | 
			
		||||
#define REGION_NULL(_pScreen, _pReg) \
 | 
			
		||||
{ \
 | 
			
		||||
    (_pReg)->extents = miEmptyBox; \
 | 
			
		||||
    (_pReg)->data = &miEmptyData; \
 | 
			
		||||
    (_pReg)->extents = RegionEmptyBox; \
 | 
			
		||||
    (_pReg)->data = &RegionEmptyData; \
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifndef REGION_NULL
 | 
			
		||||
@@ -200,94 +200,94 @@ extern _X_EXPORT RegDataRec miBrokenData;
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT void InitRegions (void);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT RegionPtr miRegionCreate(
 | 
			
		||||
extern _X_EXPORT RegionPtr RegionCreate(
 | 
			
		||||
    BoxPtr /*rect*/,
 | 
			
		||||
    int /*size*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT void miRegionInit(
 | 
			
		||||
extern _X_EXPORT void RegionInit(
 | 
			
		||||
    RegionPtr /*pReg*/,
 | 
			
		||||
    BoxPtr /*rect*/,
 | 
			
		||||
    int /*size*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT void miRegionDestroy(
 | 
			
		||||
extern _X_EXPORT void RegionDestroy(
 | 
			
		||||
    RegionPtr /*pReg*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT void miRegionUninit(
 | 
			
		||||
extern _X_EXPORT void RegionUninit(
 | 
			
		||||
    RegionPtr /*pReg*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT Bool miRegionCopy(
 | 
			
		||||
extern _X_EXPORT Bool RegionCopy(
 | 
			
		||||
    RegionPtr /*dst*/,
 | 
			
		||||
    RegionPtr /*src*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT Bool miIntersect(
 | 
			
		||||
extern _X_EXPORT Bool RegionIntersect(
 | 
			
		||||
    RegionPtr /*newReg*/,
 | 
			
		||||
    RegionPtr /*reg1*/,
 | 
			
		||||
    RegionPtr /*reg2*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT Bool miUnion(
 | 
			
		||||
extern _X_EXPORT Bool RegionUnion(
 | 
			
		||||
    RegionPtr /*newReg*/,
 | 
			
		||||
    RegionPtr /*reg1*/,
 | 
			
		||||
    RegionPtr /*reg2*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT Bool miRegionAppend(
 | 
			
		||||
extern _X_EXPORT Bool RegionAppend(
 | 
			
		||||
    RegionPtr /*dstrgn*/,
 | 
			
		||||
    RegionPtr /*rgn*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT Bool miRegionValidate(
 | 
			
		||||
extern _X_EXPORT Bool RegionValidate(
 | 
			
		||||
    RegionPtr /*badreg*/,
 | 
			
		||||
    Bool * /*pOverlap*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT RegionPtr miRectsToRegion(
 | 
			
		||||
extern _X_EXPORT RegionPtr RegionFromRects(
 | 
			
		||||
    int /*nrects*/,
 | 
			
		||||
    xRectanglePtr /*prect*/,
 | 
			
		||||
    int /*ctype*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT Bool miSubtract(
 | 
			
		||||
extern _X_EXPORT Bool RegionSubtract(
 | 
			
		||||
    RegionPtr /*regD*/,
 | 
			
		||||
    RegionPtr /*regM*/,
 | 
			
		||||
    RegionPtr /*regS*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT Bool miInverse(
 | 
			
		||||
extern _X_EXPORT Bool RegionInverse(
 | 
			
		||||
    RegionPtr /*newReg*/,
 | 
			
		||||
    RegionPtr /*reg1*/,
 | 
			
		||||
    BoxPtr /*invRect*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT int miRectIn(
 | 
			
		||||
extern _X_EXPORT int RegionContainsRect(
 | 
			
		||||
    RegionPtr /*region*/,
 | 
			
		||||
    BoxPtr /*prect*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT void miTranslateRegion(
 | 
			
		||||
extern _X_EXPORT void RegionTranslate(
 | 
			
		||||
    RegionPtr /*pReg*/,
 | 
			
		||||
    int /*x*/,
 | 
			
		||||
    int /*y*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT void miRegionReset(
 | 
			
		||||
extern _X_EXPORT void RegionReset(
 | 
			
		||||
    RegionPtr /*pReg*/,
 | 
			
		||||
    BoxPtr /*pBox*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT Bool miRegionBreak(
 | 
			
		||||
extern _X_EXPORT Bool RegionBreak(
 | 
			
		||||
    RegionPtr /*pReg*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT Bool miPointInRegion(
 | 
			
		||||
extern _X_EXPORT Bool RegionContainsPoint(
 | 
			
		||||
    RegionPtr /*pReg*/,
 | 
			
		||||
    int /*x*/,
 | 
			
		||||
    int /*y*/,
 | 
			
		||||
    BoxPtr /*box*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT Bool miRegionEqual(
 | 
			
		||||
extern _X_EXPORT Bool RegionEqual(
 | 
			
		||||
    RegionPtr /*pReg1*/,
 | 
			
		||||
    RegionPtr /*pReg2*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT Bool miRegionNotEmpty(
 | 
			
		||||
extern _X_EXPORT Bool RegionNotEmpty(
 | 
			
		||||
    RegionPtr /*pReg*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT void miRegionEmpty(
 | 
			
		||||
extern _X_EXPORT void RegionEmpty(
 | 
			
		||||
    RegionPtr /*pReg*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT BoxPtr miRegionExtents(
 | 
			
		||||
extern _X_EXPORT BoxPtr RegionExtents(
 | 
			
		||||
    RegionPtr /*pReg*/);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT void miPrintRegion(
 | 
			
		||||
extern _X_EXPORT void RegionPrint(
 | 
			
		||||
    RegionPtr /*pReg*/);
 | 
			
		||||
 | 
			
		||||
#endif /* REGIONSTRUCT_H */
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								mi/mi.h
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								mi/mi.h
									
									
									
									
									
								
							@@ -422,18 +422,18 @@ extern _X_EXPORT void miPushPixels(
 | 
			
		||||
 | 
			
		||||
/* see also region.h */
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT Bool miRectAlloc(
 | 
			
		||||
extern _X_EXPORT Bool RegionRectAlloc(
 | 
			
		||||
    RegionPtr /*pRgn*/,
 | 
			
		||||
    int /*n*/
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
extern _X_EXPORT Bool miValidRegion(
 | 
			
		||||
extern _X_EXPORT Bool RegionIsValid(
 | 
			
		||||
    RegionPtr /*prgn*/
 | 
			
		||||
);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT Bool miRegionBroken(RegionPtr pReg);
 | 
			
		||||
extern _X_EXPORT Bool RegionBroken(RegionPtr pReg);
 | 
			
		||||
 | 
			
		||||
/* miscrinit.c */
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										184
									
								
								mi/miregion.c
									
									
									
									
									
								
							
							
						
						
									
										184
									
								
								mi/miregion.c
									
									
									
									
									
								
							@@ -101,7 +101,7 @@ Equipment Corporation.
 | 
			
		||||
#define assert(expr)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define good(reg) assert(miValidRegion(reg))
 | 
			
		||||
#define good(reg) assert(RegionIsValid(reg))
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * The functions in this file implement the Region abstraction used extensively
 | 
			
		||||
@@ -144,7 +144,7 @@ Equipment Corporation.
 | 
			
		||||
 *
 | 
			
		||||
 * Adam de Boor wrote most of the original region code.  Joel McCormack
 | 
			
		||||
 * substantially modified or rewrote most of the core arithmetic routines,
 | 
			
		||||
 * and added miRegionValidate in order to support several speed improvements
 | 
			
		||||
 * and added RegionValidate in order to support several speed improvements
 | 
			
		||||
 * to miValidateTree.  Bob Scheifler changed the representation to be more
 | 
			
		||||
 * compact when empty or a single rectangle, and did a bunch of gratuitous
 | 
			
		||||
 * reformatting.
 | 
			
		||||
@@ -176,11 +176,11 @@ Equipment Corporation.
 | 
			
		||||
 | 
			
		||||
#define RECTALLOC_BAIL(pReg,n,bail) \
 | 
			
		||||
if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
 | 
			
		||||
    if (!miRectAlloc(pReg, n)) { goto bail; }
 | 
			
		||||
    if (!RegionRectAlloc(pReg, n)) { goto bail; }
 | 
			
		||||
 | 
			
		||||
#define RECTALLOC(pReg,n) \
 | 
			
		||||
if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
 | 
			
		||||
    if (!miRectAlloc(pReg, n)) { return FALSE; }
 | 
			
		||||
    if (!RegionRectAlloc(pReg, n)) { return FALSE; }
 | 
			
		||||
 | 
			
		||||
#define ADDRECT(pNextRect,nx1,ny1,nx2,ny2)	\
 | 
			
		||||
{						\
 | 
			
		||||
@@ -195,7 +195,7 @@ if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
 | 
			
		||||
{									\
 | 
			
		||||
    if (!(pReg)->data || ((pReg)->data->numRects == (pReg)->data->size))\
 | 
			
		||||
    {									\
 | 
			
		||||
	if (!miRectAlloc(pReg, 1))					\
 | 
			
		||||
	if (!RegionRectAlloc(pReg, 1))					\
 | 
			
		||||
	    return FALSE;						\
 | 
			
		||||
	pNextRect = REGION_TOP(pReg);					\
 | 
			
		||||
    }									\
 | 
			
		||||
@@ -218,16 +218,16 @@ if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
BoxRec miEmptyBox = {0, 0, 0, 0};
 | 
			
		||||
RegDataRec miEmptyData = {0, 0};
 | 
			
		||||
BoxRec RegionEmptyBox = {0, 0, 0, 0};
 | 
			
		||||
RegDataRec RegionEmptyData = {0, 0};
 | 
			
		||||
 | 
			
		||||
RegDataRec  miBrokenData = {0, 0};
 | 
			
		||||
static RegionRec   miBrokenRegion = { { 0, 0, 0, 0 }, &miBrokenData };
 | 
			
		||||
RegDataRec  RegionBrokenData = {0, 0};
 | 
			
		||||
static RegionRec   RegionBrokenRegion = { { 0, 0, 0, 0 }, &RegionBrokenData };
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
InitRegions (void)
 | 
			
		||||
{
 | 
			
		||||
    pixman_region_set_static_pointers (&miEmptyBox, &miEmptyData, &miBrokenData);
 | 
			
		||||
    pixman_region_set_static_pointers (&RegionEmptyBox, &RegionEmptyData, &RegionBrokenData);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*****************************************************************
 | 
			
		||||
@@ -237,29 +237,29 @@ InitRegions (void)
 | 
			
		||||
 *****************************************************************/
 | 
			
		||||
 | 
			
		||||
RegionPtr
 | 
			
		||||
miRegionCreate(BoxPtr rect, int size)
 | 
			
		||||
RegionCreate(BoxPtr rect, int size)
 | 
			
		||||
{
 | 
			
		||||
    RegionPtr pReg;
 | 
			
		||||
   
 | 
			
		||||
    pReg = (RegionPtr)malloc(sizeof(RegionRec));
 | 
			
		||||
    if (!pReg)
 | 
			
		||||
	return &miBrokenRegion;
 | 
			
		||||
	return &RegionBrokenRegion;
 | 
			
		||||
 | 
			
		||||
    miRegionInit (pReg, rect, size);
 | 
			
		||||
    RegionInit (pReg, rect, size);
 | 
			
		||||
    
 | 
			
		||||
    return(pReg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
miRegionDestroy(RegionPtr pReg)
 | 
			
		||||
RegionDestroy(RegionPtr pReg)
 | 
			
		||||
{
 | 
			
		||||
    pixman_region_fini (pReg);
 | 
			
		||||
    if (pReg != &miBrokenRegion)
 | 
			
		||||
    if (pReg != &RegionBrokenRegion)
 | 
			
		||||
	free(pReg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
miPrintRegion(RegionPtr rgn)
 | 
			
		||||
RegionPrint(RegionPtr rgn)
 | 
			
		||||
{
 | 
			
		||||
    int num, size;
 | 
			
		||||
    int i;
 | 
			
		||||
@@ -278,14 +278,14 @@ miPrintRegion(RegionPtr rgn)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Bool
 | 
			
		||||
miRegionEqual(RegionPtr reg1, RegionPtr reg2)
 | 
			
		||||
RegionEqual(RegionPtr reg1, RegionPtr reg2)
 | 
			
		||||
{
 | 
			
		||||
    return pixman_region_equal (reg1, reg2);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
Bool
 | 
			
		||||
miValidRegion(RegionPtr reg)
 | 
			
		||||
RegionIsValid(RegionPtr reg)
 | 
			
		||||
{
 | 
			
		||||
    int i, numRects;
 | 
			
		||||
    
 | 
			
		||||
@@ -296,7 +296,7 @@ miValidRegion(RegionPtr reg)
 | 
			
		||||
    if (!numRects)
 | 
			
		||||
	return ((reg->extents.x1 == reg->extents.x2) &&
 | 
			
		||||
		(reg->extents.y1 == reg->extents.y2) &&
 | 
			
		||||
		(reg->data->size || (reg->data == &miEmptyData)));
 | 
			
		||||
		(reg->data->size || (reg->data == &RegionEmptyData)));
 | 
			
		||||
    else if (numRects == 1)
 | 
			
		||||
	return (!reg->data);
 | 
			
		||||
    else
 | 
			
		||||
@@ -336,7 +336,7 @@ miValidRegion(RegionPtr reg)
 | 
			
		||||
 *****************************************************************/
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
miRegionInit(RegionPtr pReg, BoxPtr rect, int size)
 | 
			
		||||
RegionInit(RegionPtr pReg, BoxPtr rect, int size)
 | 
			
		||||
{
 | 
			
		||||
    if (rect)
 | 
			
		||||
	pixman_region_init_with_extents (pReg, rect);
 | 
			
		||||
@@ -345,22 +345,22 @@ miRegionInit(RegionPtr pReg, BoxPtr rect, int size)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
miRegionUninit(RegionPtr pReg)
 | 
			
		||||
RegionUninit(RegionPtr pReg)
 | 
			
		||||
{
 | 
			
		||||
    pixman_region_fini (pReg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Bool
 | 
			
		||||
miRegionBreak (RegionPtr pReg)
 | 
			
		||||
RegionBreak (RegionPtr pReg)
 | 
			
		||||
{
 | 
			
		||||
    xfreeData (pReg);
 | 
			
		||||
    pReg->extents = miEmptyBox;
 | 
			
		||||
    pReg->data = &miBrokenData;
 | 
			
		||||
    pReg->extents = RegionEmptyBox;
 | 
			
		||||
    pReg->data = &RegionBrokenData;
 | 
			
		||||
    return FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Bool
 | 
			
		||||
miRectAlloc(RegionPtr pRgn, int n)
 | 
			
		||||
RegionRectAlloc(RegionPtr pRgn, int n)
 | 
			
		||||
{
 | 
			
		||||
    RegDataPtr	data;
 | 
			
		||||
    
 | 
			
		||||
@@ -369,7 +369,7 @@ miRectAlloc(RegionPtr pRgn, int n)
 | 
			
		||||
	n++;
 | 
			
		||||
	pRgn->data = xallocData(n);
 | 
			
		||||
	if (!pRgn->data)
 | 
			
		||||
	    return miRegionBreak (pRgn);
 | 
			
		||||
	    return RegionBreak (pRgn);
 | 
			
		||||
	pRgn->data->numRects = 1;
 | 
			
		||||
	*REGION_BOXPTR(pRgn) = pRgn->extents;
 | 
			
		||||
    }
 | 
			
		||||
@@ -377,7 +377,7 @@ miRectAlloc(RegionPtr pRgn, int n)
 | 
			
		||||
    {
 | 
			
		||||
	pRgn->data = xallocData(n);
 | 
			
		||||
	if (!pRgn->data)
 | 
			
		||||
	    return miRegionBreak (pRgn);
 | 
			
		||||
	    return RegionBreak (pRgn);
 | 
			
		||||
	pRgn->data->numRects = 0;
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
@@ -391,7 +391,7 @@ miRectAlloc(RegionPtr pRgn, int n)
 | 
			
		||||
	n += pRgn->data->numRects;
 | 
			
		||||
	data = (RegDataPtr)realloc(pRgn->data, REGION_SZOF(n));
 | 
			
		||||
	if (!data)
 | 
			
		||||
	    return miRegionBreak (pRgn);
 | 
			
		||||
	    return RegionBreak (pRgn);
 | 
			
		||||
	pRgn->data = data;
 | 
			
		||||
    }
 | 
			
		||||
    pRgn->data->size = n;
 | 
			
		||||
@@ -399,7 +399,7 @@ miRectAlloc(RegionPtr pRgn, int n)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Bool
 | 
			
		||||
miRegionCopy(RegionPtr dst, RegionPtr src)
 | 
			
		||||
RegionCopy(RegionPtr dst, RegionPtr src)
 | 
			
		||||
{
 | 
			
		||||
    return pixman_region_copy (dst, src);
 | 
			
		||||
}
 | 
			
		||||
@@ -410,10 +410,10 @@ miRegionCopy(RegionPtr dst, RegionPtr src)
 | 
			
		||||
 | 
			
		||||
/*-
 | 
			
		||||
 *-----------------------------------------------------------------------
 | 
			
		||||
 * miCoalesce --
 | 
			
		||||
 * RegionCoalesce --
 | 
			
		||||
 *	Attempt to merge the boxes in the current band with those in the
 | 
			
		||||
 *	previous one.  We are guaranteed that the current band extends to
 | 
			
		||||
 *      the end of the rects array.  Used only by miRegionOp.
 | 
			
		||||
 *      the end of the rects array.  Used only by RegionOp.
 | 
			
		||||
 *
 | 
			
		||||
 * Results:
 | 
			
		||||
 *	The new index for the previous band.
 | 
			
		||||
@@ -427,7 +427,7 @@ miRegionCopy(RegionPtr dst, RegionPtr src)
 | 
			
		||||
 *-----------------------------------------------------------------------
 | 
			
		||||
 */
 | 
			
		||||
_X_INLINE static int
 | 
			
		||||
miCoalesce (
 | 
			
		||||
RegionCoalesce (
 | 
			
		||||
    RegionPtr	pReg,	    	/* Region to coalesce		     */
 | 
			
		||||
    int	    	  	prevStart,  	/* Index of start of previous band   */
 | 
			
		||||
    int	    	  	curStart)   	/* Index of start of current band    */
 | 
			
		||||
@@ -484,18 +484,18 @@ miCoalesce (
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Quicky macro to avoid trivial reject procedure calls to miCoalesce */
 | 
			
		||||
/* Quicky macro to avoid trivial reject procedure calls to RegionCoalesce */
 | 
			
		||||
 | 
			
		||||
#define Coalesce(newReg, prevBand, curBand)				\
 | 
			
		||||
    if (curBand - prevBand == newReg->data->numRects - curBand) {	\
 | 
			
		||||
	prevBand = miCoalesce(newReg, prevBand, curBand);		\
 | 
			
		||||
	prevBand = RegionCoalesce(newReg, prevBand, curBand);		\
 | 
			
		||||
    } else {								\
 | 
			
		||||
	prevBand = curBand;						\
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
/*-
 | 
			
		||||
 *-----------------------------------------------------------------------
 | 
			
		||||
 * miAppendNonO --
 | 
			
		||||
 * RegionAppendNonO --
 | 
			
		||||
 *	Handle a non-overlapping band for the union and subtract operations.
 | 
			
		||||
 *      Just adds the (top/bottom-clipped) rectangles into the region.
 | 
			
		||||
 *      Doesn't have to check for subsumption or anything.
 | 
			
		||||
@@ -511,7 +511,7 @@ miCoalesce (
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
_X_INLINE static Bool
 | 
			
		||||
miAppendNonO (
 | 
			
		||||
RegionAppendNonO (
 | 
			
		||||
    RegionPtr	pReg,
 | 
			
		||||
    BoxPtr	r,
 | 
			
		||||
    BoxPtr  	rEnd,
 | 
			
		||||
@@ -561,9 +561,9 @@ miAppendNonO (
 | 
			
		||||
 | 
			
		||||
/*-
 | 
			
		||||
 *-----------------------------------------------------------------------
 | 
			
		||||
 * miRegionOp --
 | 
			
		||||
 *	Apply an operation to two regions. Called by miUnion, miInverse,
 | 
			
		||||
 *	miSubtract, miIntersect....  Both regions MUST have at least one
 | 
			
		||||
 * RegionOp --
 | 
			
		||||
 *	Apply an operation to two regions. Called by RegionUnion, RegionInverse,
 | 
			
		||||
 *	RegionSubtract, RegionIntersect....  Both regions MUST have at least one
 | 
			
		||||
 *      rectangle, and cannot be the same object.
 | 
			
		||||
 *
 | 
			
		||||
 * Results:
 | 
			
		||||
@@ -599,7 +599,7 @@ typedef Bool (*OverlapProcPtr)(
 | 
			
		||||
    Bool	*pOverlap);
 | 
			
		||||
 | 
			
		||||
static Bool
 | 
			
		||||
miRegionOp(
 | 
			
		||||
RegionOp(
 | 
			
		||||
    RegionPtr       newReg,		    /* Place to store result	     */
 | 
			
		||||
    RegionPtr       reg1,		    /* First region in operation     */
 | 
			
		||||
    RegionPtr       reg2,		    /* 2d region in operation        */
 | 
			
		||||
@@ -635,7 +635,7 @@ miRegionOp(
 | 
			
		||||
     * Break any region computed from a broken region
 | 
			
		||||
     */
 | 
			
		||||
    if (REGION_NAR (reg1) || REGION_NAR(reg2))
 | 
			
		||||
	return miRegionBreak (newReg);
 | 
			
		||||
	return RegionBreak (newReg);
 | 
			
		||||
    
 | 
			
		||||
    /*
 | 
			
		||||
     * Initialization:
 | 
			
		||||
@@ -659,18 +659,18 @@ miRegionOp(
 | 
			
		||||
	((newReg == reg2) && (numRects > 1)))
 | 
			
		||||
    {
 | 
			
		||||
	oldData = newReg->data;
 | 
			
		||||
	newReg->data = &miEmptyData;
 | 
			
		||||
	newReg->data = &RegionEmptyData;
 | 
			
		||||
    }
 | 
			
		||||
    /* guess at new size */
 | 
			
		||||
    if (numRects > newSize)
 | 
			
		||||
	newSize = numRects;
 | 
			
		||||
    newSize <<= 1;
 | 
			
		||||
    if (!newReg->data)
 | 
			
		||||
	newReg->data = &miEmptyData;
 | 
			
		||||
	newReg->data = &RegionEmptyData;
 | 
			
		||||
    else if (newReg->data->size)
 | 
			
		||||
	newReg->data->numRects = 0;
 | 
			
		||||
    if (newSize > newReg->data->size)
 | 
			
		||||
	if (!miRectAlloc(newReg, newSize))
 | 
			
		||||
	if (!RegionRectAlloc(newReg, newSize))
 | 
			
		||||
	    return FALSE;
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
@@ -691,7 +691,7 @@ miRegionOp(
 | 
			
		||||
    
 | 
			
		||||
    /*
 | 
			
		||||
     * prevBand serves to mark the start of the previous band so rectangles
 | 
			
		||||
     * can be coalesced into larger rectangles. qv. miCoalesce, above.
 | 
			
		||||
     * can be coalesced into larger rectangles. qv. RegionCoalesce, above.
 | 
			
		||||
     * In the beginning, there is no previous band, so prevBand == curBand
 | 
			
		||||
     * (curBand is set later on, of course, but the first band will always
 | 
			
		||||
     * start at index 0). prevBand and curBand must be indices because of
 | 
			
		||||
@@ -728,7 +728,7 @@ miRegionOp(
 | 
			
		||||
		bot = min(r1->y2, r2y1);
 | 
			
		||||
		if (top != bot)	{
 | 
			
		||||
		    curBand = newReg->data->numRects;
 | 
			
		||||
		    miAppendNonO(newReg, r1, r1BandEnd, top, bot);
 | 
			
		||||
		    RegionAppendNonO(newReg, r1, r1BandEnd, top, bot);
 | 
			
		||||
		    Coalesce(newReg, prevBand, curBand);
 | 
			
		||||
		}
 | 
			
		||||
	    }
 | 
			
		||||
@@ -739,7 +739,7 @@ miRegionOp(
 | 
			
		||||
		bot = min(r2->y2, r1y1);
 | 
			
		||||
		if (top != bot) {
 | 
			
		||||
		    curBand = newReg->data->numRects;
 | 
			
		||||
		    miAppendNonO(newReg, r2, r2BandEnd, top, bot);
 | 
			
		||||
		    RegionAppendNonO(newReg, r2, r2BandEnd, top, bot);
 | 
			
		||||
		    Coalesce(newReg, prevBand, curBand);
 | 
			
		||||
		}
 | 
			
		||||
	    }
 | 
			
		||||
@@ -781,7 +781,7 @@ miRegionOp(
 | 
			
		||||
	/* Do first nonOverlap1Func call, which may be able to coalesce */
 | 
			
		||||
	FindBand(r1, r1BandEnd, r1End, r1y1);
 | 
			
		||||
	curBand = newReg->data->numRects;
 | 
			
		||||
	miAppendNonO(newReg, r1, r1BandEnd, max(r1y1, ybot), r1->y2);
 | 
			
		||||
	RegionAppendNonO(newReg, r1, r1BandEnd, max(r1y1, ybot), r1->y2);
 | 
			
		||||
	Coalesce(newReg, prevBand, curBand);
 | 
			
		||||
	/* Just append the rest of the boxes  */
 | 
			
		||||
	AppendRegions(newReg, r1BandEnd, r1End);
 | 
			
		||||
@@ -790,7 +790,7 @@ miRegionOp(
 | 
			
		||||
	/* Do first nonOverlap2Func call, which may be able to coalesce */
 | 
			
		||||
	FindBand(r2, r2BandEnd, r2End, r2y1);
 | 
			
		||||
	curBand = newReg->data->numRects;
 | 
			
		||||
	miAppendNonO(newReg, r2, r2BandEnd, max(r2y1, ybot), r2->y2);
 | 
			
		||||
	RegionAppendNonO(newReg, r2, r2BandEnd, max(r2y1, ybot), r2->y2);
 | 
			
		||||
	Coalesce(newReg, prevBand, curBand);
 | 
			
		||||
	/* Append rest of boxes */
 | 
			
		||||
	AppendRegions(newReg, r2BandEnd, r2End);
 | 
			
		||||
@@ -802,7 +802,7 @@ miRegionOp(
 | 
			
		||||
    if (!(numRects = newReg->data->numRects))
 | 
			
		||||
    {
 | 
			
		||||
	xfreeData(newReg);
 | 
			
		||||
	newReg->data = &miEmptyData;
 | 
			
		||||
	newReg->data = &RegionEmptyData;
 | 
			
		||||
    }
 | 
			
		||||
    else if (numRects == 1)
 | 
			
		||||
    {
 | 
			
		||||
@@ -820,10 +820,10 @@ miRegionOp(
 | 
			
		||||
 | 
			
		||||
/*-
 | 
			
		||||
 *-----------------------------------------------------------------------
 | 
			
		||||
 * miSetExtents --
 | 
			
		||||
 * RegionSetExtents --
 | 
			
		||||
 *	Reset the extents of a region to what they should be. Called by
 | 
			
		||||
 *	miSubtract and miIntersect as they can't figure it out along the
 | 
			
		||||
 *	way or do so easily, as miUnion can.
 | 
			
		||||
 *	RegionSubtract and RegionIntersect as they can't figure it out along the
 | 
			
		||||
 *	way or do so easily, as RegionUnion can.
 | 
			
		||||
 *
 | 
			
		||||
 * Results:
 | 
			
		||||
 *	None.
 | 
			
		||||
@@ -834,7 +834,7 @@ miRegionOp(
 | 
			
		||||
 *-----------------------------------------------------------------------
 | 
			
		||||
 */
 | 
			
		||||
static void
 | 
			
		||||
miSetExtents (RegionPtr pReg)
 | 
			
		||||
RegionSetExtents (RegionPtr pReg)
 | 
			
		||||
{
 | 
			
		||||
    BoxPtr pBox, pBoxEnd;
 | 
			
		||||
 | 
			
		||||
@@ -879,8 +879,8 @@ miSetExtents (RegionPtr pReg)
 | 
			
		||||
 *====================================================================*/
 | 
			
		||||
/*-
 | 
			
		||||
 *-----------------------------------------------------------------------
 | 
			
		||||
 * miIntersectO --
 | 
			
		||||
 *	Handle an overlapping band for miIntersect.
 | 
			
		||||
 * RegionIntersectO --
 | 
			
		||||
 *	Handle an overlapping band for RegionIntersect.
 | 
			
		||||
 *
 | 
			
		||||
 * Results:
 | 
			
		||||
 *	TRUE if successful.
 | 
			
		||||
@@ -892,7 +892,7 @@ miSetExtents (RegionPtr pReg)
 | 
			
		||||
 */
 | 
			
		||||
/*ARGSUSED*/
 | 
			
		||||
Bool
 | 
			
		||||
miIntersect(
 | 
			
		||||
RegionIntersect(
 | 
			
		||||
    RegionPtr	newReg,     /* destination Region */
 | 
			
		||||
    RegionPtr	reg1,
 | 
			
		||||
    RegionPtr	reg2        /* source regions     */
 | 
			
		||||
@@ -922,7 +922,7 @@ miIntersect(
 | 
			
		||||
 | 
			
		||||
/*-
 | 
			
		||||
 *-----------------------------------------------------------------------
 | 
			
		||||
 * miUnionO --
 | 
			
		||||
 * RegionUnionO --
 | 
			
		||||
 *	Handle an overlapping band for the union operation. Picks the
 | 
			
		||||
 *	left-most rectangle each time and merges it into the region.
 | 
			
		||||
 *
 | 
			
		||||
@@ -936,7 +936,7 @@ miIntersect(
 | 
			
		||||
 *-----------------------------------------------------------------------
 | 
			
		||||
 */
 | 
			
		||||
static Bool
 | 
			
		||||
miUnionO (
 | 
			
		||||
RegionUnionO (
 | 
			
		||||
    RegionPtr	pReg,
 | 
			
		||||
    BoxPtr	r1,
 | 
			
		||||
    BoxPtr  	r1End,
 | 
			
		||||
@@ -996,7 +996,7 @@ miUnionO (
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Bool
 | 
			
		||||
miUnion(
 | 
			
		||||
RegionUnion(
 | 
			
		||||
    RegionPtr	newReg,          /* destination Region */
 | 
			
		||||
    RegionPtr	reg1,
 | 
			
		||||
    RegionPtr	reg2             /* source regions     */
 | 
			
		||||
@@ -1011,13 +1011,13 @@ miUnion(
 | 
			
		||||
 | 
			
		||||
/*-
 | 
			
		||||
 *-----------------------------------------------------------------------
 | 
			
		||||
 * miRegionAppend --
 | 
			
		||||
 * RegionAppend --
 | 
			
		||||
 * 
 | 
			
		||||
 *      "Append" the rgn rectangles onto the end of dstrgn, maintaining
 | 
			
		||||
 *      knowledge of YX-banding when it's easy.  Otherwise, dstrgn just
 | 
			
		||||
 *      becomes a non-y-x-banded random collection of rectangles, and not
 | 
			
		||||
 *      yet a true region.  After a sequence of appends, the caller must
 | 
			
		||||
 *      call miRegionValidate to ensure that a valid region is constructed.
 | 
			
		||||
 *      call RegionValidate to ensure that a valid region is constructed.
 | 
			
		||||
 *
 | 
			
		||||
 * Results:
 | 
			
		||||
 *	TRUE if successful.
 | 
			
		||||
@@ -1027,16 +1027,16 @@ miUnion(
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
Bool
 | 
			
		||||
miRegionAppend(RegionPtr dstrgn, RegionPtr rgn)
 | 
			
		||||
RegionAppend(RegionPtr dstrgn, RegionPtr rgn)
 | 
			
		||||
{
 | 
			
		||||
    int numRects, dnumRects, size;
 | 
			
		||||
    BoxPtr new, old;
 | 
			
		||||
    Bool prepend;
 | 
			
		||||
 | 
			
		||||
    if (REGION_NAR(rgn))
 | 
			
		||||
	return miRegionBreak (dstrgn);
 | 
			
		||||
	return RegionBreak (dstrgn);
 | 
			
		||||
    
 | 
			
		||||
    if (!rgn->data && (dstrgn->data == &miEmptyData))
 | 
			
		||||
    if (!rgn->data && (dstrgn->data == &RegionEmptyData))
 | 
			
		||||
    {
 | 
			
		||||
	dstrgn->extents = rgn->extents;
 | 
			
		||||
	dstrgn->data = NULL;
 | 
			
		||||
@@ -1180,7 +1180,7 @@ QuickSortRects(
 | 
			
		||||
 | 
			
		||||
/*-
 | 
			
		||||
 *-----------------------------------------------------------------------
 | 
			
		||||
 * miRegionValidate --
 | 
			
		||||
 * RegionValidate --
 | 
			
		||||
 * 
 | 
			
		||||
 *      Take a ``region'' which is a non-y-x-banded random collection of
 | 
			
		||||
 *      rectangles, and compute a nice region which is the union of all the
 | 
			
		||||
@@ -1204,14 +1204,14 @@ QuickSortRects(
 | 
			
		||||
 *		or a coalescing into 1 box (ala Menus).
 | 
			
		||||
 *
 | 
			
		||||
 *	Step 3. Merge the separate regions down to a single region by calling
 | 
			
		||||
 *		miUnion.  Maximize the work each miUnion call does by using
 | 
			
		||||
 *		RegionUnion.  Maximize the work each RegionUnion call does by using
 | 
			
		||||
 *		a binary merge.
 | 
			
		||||
 *
 | 
			
		||||
 *-----------------------------------------------------------------------
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
Bool
 | 
			
		||||
miRegionValidate(RegionPtr badreg, Bool *pOverlap)
 | 
			
		||||
RegionValidate(RegionPtr badreg, Bool *pOverlap)
 | 
			
		||||
{
 | 
			
		||||
    /* Descriptor for regions under construction  in Step 2. */
 | 
			
		||||
    typedef struct {
 | 
			
		||||
@@ -1271,7 +1271,7 @@ miRegionValidate(RegionPtr badreg, Bool *pOverlap)
 | 
			
		||||
    /* Note that step 2 code will never overflow the ri[0].reg rects array */
 | 
			
		||||
    ri = (RegionInfo *) malloc(4 * sizeof(RegionInfo));
 | 
			
		||||
    if (!ri)
 | 
			
		||||
	return miRegionBreak (badreg);
 | 
			
		||||
	return RegionBreak (badreg);
 | 
			
		||||
    sizeRI = 4;
 | 
			
		||||
    numRI = 1;
 | 
			
		||||
    ri[0].prevBand = 0;
 | 
			
		||||
@@ -1344,7 +1344,7 @@ miRegionValidate(RegionPtr badreg, Bool *pOverlap)
 | 
			
		||||
	rit->curBand = 0;
 | 
			
		||||
	rit->reg.extents = *box;
 | 
			
		||||
	rit->reg.data = NULL;
 | 
			
		||||
	if (!miRectAlloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */
 | 
			
		||||
	if (!RegionRectAlloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */
 | 
			
		||||
	    goto bail;
 | 
			
		||||
NextRect: ;
 | 
			
		||||
    } /* for i */
 | 
			
		||||
@@ -1374,7 +1374,7 @@ NextRect: ;
 | 
			
		||||
	{
 | 
			
		||||
	    reg = &ri[j].reg;
 | 
			
		||||
	    hreg = &ri[j+half].reg;
 | 
			
		||||
	    if (!miRegionOp(reg, reg, hreg, miUnionO, TRUE, TRUE, pOverlap))
 | 
			
		||||
	    if (!RegionOp(reg, reg, hreg, RegionUnionO, TRUE, TRUE, pOverlap))
 | 
			
		||||
		ret = FALSE;
 | 
			
		||||
	    if (hreg->extents.x1 < reg->extents.x1)
 | 
			
		||||
		reg->extents.x1 = hreg->extents.x1;
 | 
			
		||||
@@ -1396,11 +1396,11 @@ bail:
 | 
			
		||||
    for (i = 0; i < numRI; i++)
 | 
			
		||||
	xfreeData(&ri[i].reg);
 | 
			
		||||
    free(ri);
 | 
			
		||||
    return miRegionBreak (badreg);
 | 
			
		||||
    return RegionBreak (badreg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RegionPtr
 | 
			
		||||
miRectsToRegion(int nrects, xRectangle *prect, int ctype)
 | 
			
		||||
RegionFromRects(int nrects, xRectangle *prect, int ctype)
 | 
			
		||||
{
 | 
			
		||||
    
 | 
			
		||||
    RegionPtr		pRgn;
 | 
			
		||||
@@ -1409,7 +1409,7 @@ miRectsToRegion(int nrects, xRectangle *prect, int ctype)
 | 
			
		||||
    int        		i;
 | 
			
		||||
    int			x1, y1, x2, y2;
 | 
			
		||||
 | 
			
		||||
    pRgn = miRegionCreate(NullBox, 0);
 | 
			
		||||
    pRgn = RegionCreate(NullBox, 0);
 | 
			
		||||
    if (REGION_NAR (pRgn))
 | 
			
		||||
	return pRgn;
 | 
			
		||||
    if (!nrects)
 | 
			
		||||
@@ -1435,7 +1435,7 @@ miRectsToRegion(int nrects, xRectangle *prect, int ctype)
 | 
			
		||||
    pData = xallocData(nrects);
 | 
			
		||||
    if (!pData)
 | 
			
		||||
    {
 | 
			
		||||
	miRegionBreak (pRgn);
 | 
			
		||||
	RegionBreak (pRgn);
 | 
			
		||||
	return pRgn;
 | 
			
		||||
    }
 | 
			
		||||
    pBox = (BoxPtr) (pData + 1);
 | 
			
		||||
@@ -1465,10 +1465,10 @@ miRectsToRegion(int nrects, xRectangle *prect, int ctype)
 | 
			
		||||
    	{
 | 
			
		||||
	    Bool overlap; /* result ignored */
 | 
			
		||||
	    pRgn->extents.x1 = pRgn->extents.x2 = 0;
 | 
			
		||||
	    miRegionValidate(pRgn, &overlap);
 | 
			
		||||
	    RegionValidate(pRgn, &overlap);
 | 
			
		||||
    	}
 | 
			
		||||
    	else
 | 
			
		||||
	    miSetExtents(pRgn);
 | 
			
		||||
	    RegionSetExtents(pRgn);
 | 
			
		||||
    	good(pRgn);
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
@@ -1485,7 +1485,7 @@ miRectsToRegion(int nrects, xRectangle *prect, int ctype)
 | 
			
		||||
 | 
			
		||||
/*-
 | 
			
		||||
 *-----------------------------------------------------------------------
 | 
			
		||||
 * miSubtractO --
 | 
			
		||||
 * RegionSubtractO --
 | 
			
		||||
 *	Overlapping band subtraction. x1 is the left-most point not yet
 | 
			
		||||
 *	checked.
 | 
			
		||||
 *
 | 
			
		||||
@@ -1501,7 +1501,7 @@ miRectsToRegion(int nrects, xRectangle *prect, int ctype)
 | 
			
		||||
 | 
			
		||||
/*-
 | 
			
		||||
 *-----------------------------------------------------------------------
 | 
			
		||||
 * miSubtract --
 | 
			
		||||
 * RegionSubtract --
 | 
			
		||||
 *	Subtract regS from regM and leave the result in regD.
 | 
			
		||||
 *	S stands for subtrahend, M for minuend and D for difference.
 | 
			
		||||
 *
 | 
			
		||||
@@ -1514,7 +1514,7 @@ miRectsToRegion(int nrects, xRectangle *prect, int ctype)
 | 
			
		||||
 *-----------------------------------------------------------------------
 | 
			
		||||
 */
 | 
			
		||||
Bool
 | 
			
		||||
miSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS)
 | 
			
		||||
RegionSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS)
 | 
			
		||||
{
 | 
			
		||||
    return pixman_region_subtract (regD, regM, regS);
 | 
			
		||||
}
 | 
			
		||||
@@ -1525,7 +1525,7 @@ miSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS)
 | 
			
		||||
 | 
			
		||||
/*-
 | 
			
		||||
 *-----------------------------------------------------------------------
 | 
			
		||||
 * miInverse --
 | 
			
		||||
 * RegionInverse --
 | 
			
		||||
 *	Take a region and a box and return a region that is everything
 | 
			
		||||
 *	in the box but not in the region. The careful reader will note
 | 
			
		||||
 *	that this is the same as subtracting the region from the box...
 | 
			
		||||
@@ -1539,7 +1539,7 @@ miSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS)
 | 
			
		||||
 *-----------------------------------------------------------------------
 | 
			
		||||
 */
 | 
			
		||||
Bool
 | 
			
		||||
miInverse(
 | 
			
		||||
RegionInverse(
 | 
			
		||||
    RegionPtr	  newReg,       /* Destination region */
 | 
			
		||||
    RegionPtr	  reg1,         /* Region to invert */
 | 
			
		||||
    BoxPtr	  invRect	/* Bounding box for inversion */
 | 
			
		||||
@@ -1548,7 +1548,7 @@ miInverse(
 | 
			
		||||
    return pixman_region_inverse (newReg, reg1, invRect);
 | 
			
		||||
}
 | 
			
		||||
int
 | 
			
		||||
miRectIn(RegionPtr region, BoxPtr prect)
 | 
			
		||||
RegionContainsRect(RegionPtr region, BoxPtr prect)
 | 
			
		||||
{
 | 
			
		||||
    return pixman_region_contains_rectangle (region, prect);
 | 
			
		||||
}
 | 
			
		||||
@@ -1558,19 +1558,19 @@ miRectIn(RegionPtr region, BoxPtr prect)
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
miTranslateRegion(RegionPtr pReg, int x, int y)
 | 
			
		||||
RegionTranslate(RegionPtr pReg, int x, int y)
 | 
			
		||||
{
 | 
			
		||||
    pixman_region_translate (pReg, x, y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
miRegionReset(RegionPtr pReg, BoxPtr pBox)
 | 
			
		||||
RegionReset(RegionPtr pReg, BoxPtr pBox)
 | 
			
		||||
{
 | 
			
		||||
    pixman_region_reset (pReg, pBox);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Bool
 | 
			
		||||
miPointInRegion(
 | 
			
		||||
RegionContainsPoint(
 | 
			
		||||
    RegionPtr pReg,
 | 
			
		||||
    int x,
 | 
			
		||||
    int y,
 | 
			
		||||
@@ -1581,30 +1581,30 @@ miPointInRegion(
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Bool
 | 
			
		||||
miRegionNotEmpty(RegionPtr pReg)
 | 
			
		||||
RegionNotEmpty(RegionPtr pReg)
 | 
			
		||||
{
 | 
			
		||||
    return pixman_region_not_empty (pReg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Bool
 | 
			
		||||
miRegionBroken(RegionPtr pReg)
 | 
			
		||||
RegionBroken(RegionPtr pReg)
 | 
			
		||||
{
 | 
			
		||||
    good(pReg);
 | 
			
		||||
    return (REGION_NAR(pReg));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
miRegionEmpty(RegionPtr pReg)
 | 
			
		||||
RegionEmpty(RegionPtr pReg)
 | 
			
		||||
{
 | 
			
		||||
    good(pReg);
 | 
			
		||||
    xfreeData(pReg);
 | 
			
		||||
    pReg->extents.x2 = pReg->extents.x1;
 | 
			
		||||
    pReg->extents.y2 = pReg->extents.y1;
 | 
			
		||||
    pReg->data = &miEmptyData;
 | 
			
		||||
    pReg->data = &RegionEmptyData;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BoxPtr
 | 
			
		||||
miRegionExtents(RegionPtr pReg)
 | 
			
		||||
RegionExtents(RegionPtr pReg)
 | 
			
		||||
{
 | 
			
		||||
    good(pReg);
 | 
			
		||||
    return(&pReg->extents);
 | 
			
		||||
@@ -1729,7 +1729,7 @@ static void QuickSortSpans(
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
miClipSpans(
 | 
			
		||||
RegionClipSpans(
 | 
			
		||||
    RegionPtr	prgnDst,
 | 
			
		||||
    DDXPointPtr ppt,
 | 
			
		||||
    int	    	*pwidth,
 | 
			
		||||
 
 | 
			
		||||
@@ -85,7 +85,7 @@ extern _X_EXPORT void miFreeSpanGroup(
 | 
			
		||||
    SpanGroup * /*spanGroup*/
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
extern _X_EXPORT int miClipSpans(
 | 
			
		||||
extern _X_EXPORT int RegionClipSpans(
 | 
			
		||||
    RegionPtr /*prgnDst*/,
 | 
			
		||||
    DDXPointPtr /*ppt*/,
 | 
			
		||||
    int * /*pwidth*/,
 | 
			
		||||
 
 | 
			
		||||
@@ -268,7 +268,7 @@ miSpriteReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
 | 
			
		||||
 | 
			
		||||
            if (pCursorInfo->isUp &&
 | 
			
		||||
                pCursorInfo->pScreen == pScreen &&
 | 
			
		||||
                miRectIn(pRegion, &pCursorInfo->saved) != rgnOUT)
 | 
			
		||||
                RegionContainsRect(pRegion, &pCursorInfo->saved) != rgnOUT)
 | 
			
		||||
            {
 | 
			
		||||
                SPRITE_DEBUG(("Damage remove\n"));
 | 
			
		||||
                miSpriteRemoveCursor (pDev, pScreen);
 | 
			
		||||
@@ -523,7 +523,7 @@ miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
 | 
			
		||||
             * Damage will take care of destination check
 | 
			
		||||
             */
 | 
			
		||||
            if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen &&
 | 
			
		||||
                    miRectIn(prgnSrc, &pCursorInfo->saved) != rgnOUT)
 | 
			
		||||
                    RegionContainsRect(prgnSrc, &pCursorInfo->saved) != rgnOUT)
 | 
			
		||||
            {
 | 
			
		||||
                SPRITE_DEBUG (("CopyWindow remove\n"));
 | 
			
		||||
                miSpriteRemoveCursor (pDev, pScreen);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user