* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: region.c,v 1.26 2003/07/11 00:16:47 chorns Exp $ */
+/* $Id: region.c,v 1.27 2003/07/11 09:48:24 gvg Exp $ */
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddk/ntddk.h>
return 1;
}
-#define MEMCHECK(reg, rect, firstrect) xmemcheck(reg,&(rect),&(firstrect))
+#define MEMCHECK(reg, rect, firstrect) xmemcheck(reg,&(rect),(LPRECT *)&(firstrect))
-typedef void (*voidProcp)();
+typedef void FASTCALL (*overlapProcp)(PROSRGNDATA, PRECT, PRECT, PRECT, PRECT, INT, INT);
+typedef void FASTCALL (*nonOverlapProcp)(PROSRGNDATA, PRECT, PRECT, INT, INT);
// Number of points to buffer before sending them off to scanlines() : Must be an even number
#define NUMPTSTOBUFFER 200
/***********************************************************************
* REGION_CropAndOffsetRegion
*/
-static BOOL STDCALL REGION_CropAndOffsetRegion(const PPOINT off, const PRECT rect, PROSRGNDATA rgnSrc, PROSRGNDATA rgnDst)
+static BOOL FASTCALL REGION_CropAndOffsetRegion(const PPOINT off, const PRECT rect, PROSRGNDATA rgnSrc, PROSRGNDATA rgnDst)
{
if(!rect) // just copy and offset
{
* - pReg->numRects will be decreased.
*
*/
-static INT STDCALL REGION_Coalesce (
+static INT FASTCALL REGION_Coalesce (
PROSRGNDATA pReg, /* Region to coalesce */
INT prevStart, /* Index of start of previous band */
INT curStart /* Index of start of current band */
* to reduce the number of rectangles in the region.
*
*/
-static void STDCALL REGION_RegionOp(
+static void FASTCALL REGION_RegionOp(
ROSRGNDATA *newReg, /* Place to store result */
ROSRGNDATA *reg1, /* First region in operation */
- ROSRGNDATA *reg2, /* 2nd region in operation */
- void (*overlapFunc)(), /* Function to call for over-lapping bands */
- void (*nonOverlap1Func)(), /* Function to call for non-overlapping bands in region 1 */
- void (*nonOverlap2Func)() /* Function to call for non-overlapping bands in region 2 */
+ ROSRGNDATA *reg2, /* 2nd region in operation */
+ overlapProcp overlapFunc, /* Function to call for over-lapping bands */
+ nonOverlapProcp nonOverlap1Func, /* Function to call for non-overlapping bands in region 1 */
+ nonOverlapProcp nonOverlap2Func /* Function to call for non-overlapping bands in region 2 */
) {
RECT *r1; /* Pointer into first region */
RECT *r2; /* Pointer into 2d region */
top = max(r1->top,ybot);
bot = min(r1->bottom,r2->top);
- if ((top != bot) && (nonOverlap1Func != (void (*)())NULL))
+ if ((top != bot) && (nonOverlap1Func != NULL))
{
(* nonOverlap1Func) (newReg, r1, r1BandEnd, top, bot);
}
top = max(r2->top,ybot);
bot = min(r2->bottom,r1->top);
- if ((top != bot) && (nonOverlap2Func != (void (*)())NULL))
+ if ((top != bot) && (nonOverlap2Func != NULL))
{
(* nonOverlap2Func) (newReg, r2, r2BandEnd, top, bot);
}
curBand = newReg->rdh.nCount;
if (r1 != r1End)
{
- if (nonOverlap1Func != (void (*)())NULL)
+ if (nonOverlap1Func != NULL)
{
do
{
} while (r1 != r1End);
}
}
- else if ((r2 != r2End) && (nonOverlap2Func != (void (*)())NULL))
+ else if ((r2 != r2End) && (nonOverlap2Func != NULL))
{
do
{
* Only do this stuff if the number of rectangles allocated is more than
* twice the number of rectangles in the region (a simple optimization...).
*/
- if ((newReg->rdh.nCount*sizeof(RECT) < 2*newReg->rdh.nRgnSize && (newReg->rdh.nCount > 2)))
+ if ((2 * newReg->rdh.nCount*sizeof(RECT) < newReg->rdh.nRgnSize && (newReg->rdh.nCount > 2)))
{
if (REGION_NOT_EMPTY(newReg))
{
* Rectangles may be added to the region.
*
*/
-static void STDCALL REGION_IntersectO(ROSRGNDATA *pReg, RECT *r1, RECT *r1End,
+static void FASTCALL REGION_IntersectO(ROSRGNDATA *pReg, RECT *r1, RECT *r1End,
RECT *r2, RECT *r2End, INT top, INT bottom)
{
/***********************************************************************
* REGION_IntersectRegion
*/
-static void STDCALL REGION_IntersectRegion(ROSRGNDATA *newReg, ROSRGNDATA *reg1,
+static void FASTCALL REGION_IntersectRegion(ROSRGNDATA *newReg, ROSRGNDATA *reg1,
ROSRGNDATA *reg2)
{
/* check for trivial reject */
newReg->rdh.nCount = 0;
else
REGION_RegionOp (newReg, reg1, reg2,
- (voidProcp) REGION_IntersectO, (voidProcp) NULL, (voidProcp) NULL);
+ REGION_IntersectO, NULL, NULL);
/*
* Can't alter newReg's extents before we call miRegionOp because
* with the rectangles we're passed.
*
*/
-static void STDCALL REGION_UnionNonO (ROSRGNDATA *pReg, RECT *r, RECT *rEnd,
+static void FASTCALL REGION_UnionNonO (ROSRGNDATA *pReg, RECT *r, RECT *rEnd,
INT top, INT bottom)
{
RECT *pNextRect;
* be changed.
*
*/
-static void STDCALL REGION_UnionO (ROSRGNDATA *pReg, RECT *r1, RECT *r1End,
+static void FASTCALL REGION_UnionO (ROSRGNDATA *pReg, RECT *r1, RECT *r1End,
RECT *r2, RECT *r2End, INT top, INT bottom)
{
RECT *pNextRect;
/***********************************************************************
* REGION_UnionRegion
*/
-static void STDCALL REGION_UnionRegion(ROSRGNDATA *newReg, ROSRGNDATA *reg1,
+static void FASTCALL REGION_UnionRegion(ROSRGNDATA *newReg, ROSRGNDATA *reg1,
ROSRGNDATA *reg2)
{
/* checks all the simple cases */
return;
}
- REGION_RegionOp (newReg, reg1, reg2, (voidProcp) REGION_UnionO,
- (voidProcp) REGION_UnionNonO, (voidProcp) REGION_UnionNonO);
+ REGION_RegionOp (newReg, reg1, reg2, REGION_UnionO,
+ REGION_UnionNonO, REGION_UnionNonO);
newReg->rdh.rcBound.left = min(reg1->rdh.rcBound.left, reg2->rdh.rcBound.left);
newReg->rdh.rcBound.top = min(reg1->rdh.rcBound.top, reg2->rdh.rcBound.top);
newReg->rdh.rcBound.right = max(reg1->rdh.rcBound.right, reg2->rdh.rcBound.right);
* pReg may be affected.
*
*/
-static void STDCALL REGION_SubtractNonO1 (ROSRGNDATA *pReg, RECT *r, RECT *rEnd,
+static void FASTCALL REGION_SubtractNonO1 (ROSRGNDATA *pReg, RECT *r, RECT *rEnd,
INT top, INT bottom)
{
RECT *pNextRect;
* pReg may have rectangles added to it.
*
*/
-static void STDCALL REGION_SubtractO (ROSRGNDATA *pReg, RECT *r1, RECT *r1End,
+static void FASTCALL REGION_SubtractO (ROSRGNDATA *pReg, RECT *r1, RECT *r1End,
RECT *r2, RECT *r2End, INT top, INT bottom)
{
RECT *pNextRect;
* regD is overwritten.
*
*/
-static void STDCALL REGION_SubtractRegion(ROSRGNDATA *regD, ROSRGNDATA *regM,
+static void FASTCALL REGION_SubtractRegion(ROSRGNDATA *regD, ROSRGNDATA *regM,
ROSRGNDATA *regS )
{
/* check for trivial reject */
return;
}
- REGION_RegionOp (regD, regM, regS, (voidProcp) REGION_SubtractO,
- (voidProcp) REGION_SubtractNonO1, (voidProcp) NULL);
+ REGION_RegionOp (regD, regM, regS, REGION_SubtractO,
+ REGION_SubtractNonO1, NULL);
/*
* Can't alter newReg's extents before we call miRegionOp because
/***********************************************************************
* REGION_XorRegion
*/
-static void STDCALL REGION_XorRegion(ROSRGNDATA *dr, ROSRGNDATA *sra,
+static void FASTCALL REGION_XorRegion(ROSRGNDATA *dr, ROSRGNDATA *sra,
ROSRGNDATA *srb)
{
HRGN htra, htrb;