interface: Fix -Wuninitialized in RegionSupport.
Also trim trailing spaces...
This commit is contained in:
@@ -28,13 +28,13 @@ Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
|
|||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
Permission to use, copy, modify, and distribute this software and its
|
Permission to use, copy, modify, and distribute this software and its
|
||||||
documentation for any purpose and without fee is hereby granted,
|
documentation for any purpose and without fee is hereby granted,
|
||||||
provided that the above copyright notice appear in all copies and that
|
provided that the above copyright notice appear in all copies and that
|
||||||
both that copyright notice and this permission notice appear in
|
both that copyright notice and this permission notice appear in
|
||||||
supporting documentation, and that the name of Digital not be
|
supporting documentation, and that the name of Digital not be
|
||||||
used in advertising or publicity pertaining to distribution of the
|
used in advertising or publicity pertaining to distribution of the
|
||||||
software without specific, written prior permission.
|
software without specific, written prior permission.
|
||||||
|
|
||||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||||
@@ -93,7 +93,7 @@ using std::nothrow;
|
|||||||
|
|
||||||
/* 1 if two clipping_rects overlap.
|
/* 1 if two clipping_rects overlap.
|
||||||
* 0 if two clipping_rects do not overlap.
|
* 0 if two clipping_rects do not overlap.
|
||||||
* Remember, right and bottom are not in the region
|
* Remember, right and bottom are not in the region
|
||||||
*/
|
*/
|
||||||
#define EXTENTCHECK(r1, r2) \
|
#define EXTENTCHECK(r1, r2) \
|
||||||
((r1)->right > (r2)->left && \
|
((r1)->right > (r2)->left && \
|
||||||
@@ -289,9 +289,9 @@ BRegion::Support::XOffsetRegion(
|
|||||||
pRegion->fBounds.bottom += y;
|
pRegion->fBounds.bottom += y;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Utility procedure Compress:
|
Utility procedure Compress:
|
||||||
Replace r by the region r', where
|
Replace r by the region r', where
|
||||||
p in r' iff (Quantifer m <= dx) (p + m in r), and
|
p in r' iff (Quantifer m <= dx) (p + m in r), and
|
||||||
Quantifier is Exists if grow is true, For all if grow is false, and
|
Quantifier is Exists if grow is true, For all if grow is false, and
|
||||||
(x,y) + m = (x+m,y) if xdir is true; (x,y+m) if xdir is false.
|
(x,y) + m = (x+m,y) if xdir is true; (x,y+m) if xdir is false.
|
||||||
@@ -474,9 +474,9 @@ BRegion::Support::XIntersectRegion(
|
|||||||
(!EXTENTCHECK(®1->fBounds, ®2->fBounds)))
|
(!EXTENTCHECK(®1->fBounds, ®2->fBounds)))
|
||||||
newReg->fCount = 0;
|
newReg->fCount = 0;
|
||||||
else
|
else
|
||||||
miRegionOp (newReg, reg1, reg2,
|
miRegionOp (newReg, reg1, reg2,
|
||||||
miIntersectO, NULL, NULL);
|
miIntersectO, NULL, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Can't alter newReg's fBounds before we call miRegionOp because
|
* Can't alter newReg's fBounds before we call miRegionOp because
|
||||||
* it might be one of the source regions and miRegionOp depends
|
* it might be one of the source regions and miRegionOp depends
|
||||||
@@ -503,7 +503,7 @@ BRegion::Support::miRegionCopy(
|
|||||||
/*
|
/*
|
||||||
* combinRegs(newReg, reg1, reg2)
|
* combinRegs(newReg, reg1, reg2)
|
||||||
* if one region is above or below the other.
|
* if one region is above or below the other.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
combineRegs(
|
combineRegs(
|
||||||
@@ -553,7 +553,7 @@ combineRegs(
|
|||||||
* QuickCheck checks to see if it does not have to go through all the
|
* QuickCheck checks to see if it does not have to go through all the
|
||||||
* the ugly code for the region call. It returns 1 if it did all
|
* the ugly code for the region call. It returns 1 if it did all
|
||||||
* the work for Union, otherwise 0 - still work to be done.
|
* the work for Union, otherwise 0 - still work to be done.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
QuickCheck(BRegion* newReg, BRegion* reg1, BRegion* reg2)
|
QuickCheck(BRegion* newReg, BRegion* reg1, BRegion* reg2)
|
||||||
@@ -587,8 +587,8 @@ QuickCheck(BRegion* newReg, BRegion* reg1, BRegion* reg2)
|
|||||||
/* TopRects(fData, reg1, reg2)
|
/* TopRects(fData, reg1, reg2)
|
||||||
* N.B. We now assume that reg1 and reg2 intersect. Therefore we are
|
* N.B. We now assume that reg1 and reg2 intersect. Therefore we are
|
||||||
* NOT checking in the two while loops for stepping off the end of the
|
* NOT checking in the two while loops for stepping off the end of the
|
||||||
* region.
|
* region.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
TopRects(
|
TopRects(
|
||||||
@@ -607,7 +607,7 @@ TopRects(
|
|||||||
while(tempRects->top < reg2->fBounds.top)
|
while(tempRects->top < reg2->fBounds.top)
|
||||||
{
|
{
|
||||||
MEMCHECK(newReg, rects_, FirstRect);
|
MEMCHECK(newReg, rects_, FirstRect);
|
||||||
ADDRECTNOX(newReg,rects_, tempRects->left, tempRects->top,
|
ADDRECTNOX(newReg,rects_, tempRects->left, tempRects->top,
|
||||||
tempRects->right, min_c(tempRects->bottom, reg2->fBounds.top));
|
tempRects->right, min_c(tempRects->bottom, reg2->fBounds.top));
|
||||||
tempRects++;
|
tempRects++;
|
||||||
}
|
}
|
||||||
@@ -619,7 +619,7 @@ TopRects(
|
|||||||
while (tempRects->top < reg1->fBounds.top)
|
while (tempRects->top < reg1->fBounds.top)
|
||||||
{
|
{
|
||||||
MEMCHECK(newReg, rects_, FirstRect);
|
MEMCHECK(newReg, rects_, FirstRect);
|
||||||
ADDRECTNOX(newReg, rects_, tempRects->left,tempRects->top,
|
ADDRECTNOX(newReg, rects_, tempRects->left,tempRects->top,
|
||||||
tempRects->right, min_c(tempRects->bottom, reg1->fBounds.top));
|
tempRects->right, min_c(tempRects->bottom, reg1->fBounds.top));
|
||||||
tempRects++;
|
tempRects++;
|
||||||
}
|
}
|
||||||
@@ -683,7 +683,7 @@ BRegion::Support::miCoalesce(
|
|||||||
{
|
{
|
||||||
pCurBox++;
|
pCurBox++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pCurBox != pRegEnd)
|
if (pCurBox != pRegEnd)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -700,7 +700,7 @@ BRegion::Support::miCoalesce(
|
|||||||
curStart = pRegEnd - pReg->fData;
|
curStart = pRegEnd - pReg->fData;
|
||||||
pRegEnd = pReg->fData + pReg->fCount;
|
pRegEnd = pReg->fData + pReg->fCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((curNumRects == prevNumRects) && (curNumRects != 0)) {
|
if ((curNumRects == prevNumRects) && (curNumRects != 0)) {
|
||||||
pCurBox -= curNumRects;
|
pCurBox -= curNumRects;
|
||||||
/*
|
/*
|
||||||
@@ -768,7 +768,7 @@ BRegion::Support::miCoalesce(
|
|||||||
*pPrevBox++ = *pCurBox++;
|
*pPrevBox++ = *pCurBox++;
|
||||||
} while (pCurBox != pRegEnd);
|
} while (pCurBox != pRegEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (curStart);
|
return (curStart);
|
||||||
@@ -848,7 +848,7 @@ BRegion::Support::miRegionOp(
|
|||||||
* band */
|
* band */
|
||||||
int bot; /* Bottom of non-overlapping
|
int bot; /* Bottom of non-overlapping
|
||||||
* band */
|
* band */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialization:
|
* Initialization:
|
||||||
* set r1, r2, r1End and r2End appropriately, preserve the important
|
* set r1, r2, r1End and r2End appropriately, preserve the important
|
||||||
@@ -860,9 +860,9 @@ BRegion::Support::miRegionOp(
|
|||||||
r2 = reg2->fData;
|
r2 = reg2->fData;
|
||||||
r1End = r1 + reg1->fCount;
|
r1End = r1 + reg1->fCount;
|
||||||
r2End = r2 + reg2->fCount;
|
r2End = r2 + reg2->fCount;
|
||||||
|
|
||||||
// oldRects = newReg->fData;
|
// oldRects = newReg->fData;
|
||||||
|
|
||||||
EMPTY_REGION(newReg);
|
EMPTY_REGION(newReg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -875,7 +875,7 @@ BRegion::Support::miRegionOp(
|
|||||||
if (!newReg->_SetSize(max_c(reg1->fCount,reg2->fCount) * 2)) {
|
if (!newReg->_SetSize(max_c(reg1->fCount,reg2->fCount) * 2)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize ybot and ytop.
|
* Initialize ybot and ytop.
|
||||||
* In the upcoming loop, ybot and ytop serve different functions depending
|
* In the upcoming loop, ybot and ytop serve different functions depending
|
||||||
@@ -893,7 +893,7 @@ BRegion::Support::miRegionOp(
|
|||||||
ybot = reg1->fBounds.top;
|
ybot = reg1->fBounds.top;
|
||||||
else
|
else
|
||||||
ybot = reg2->fBounds.top;
|
ybot = reg2->fBounds.top;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* prevBand serves to mark the start of the previous band so rectangles
|
* 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. miCoalesce, above.
|
||||||
@@ -904,7 +904,7 @@ BRegion::Support::miRegionOp(
|
|||||||
* array of rectangles.
|
* array of rectangles.
|
||||||
*/
|
*/
|
||||||
prevBand = 0;
|
prevBand = 0;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
curBand = newReg->fCount;
|
curBand = newReg->fCount;
|
||||||
@@ -921,13 +921,13 @@ BRegion::Support::miRegionOp(
|
|||||||
{
|
{
|
||||||
r1BandEnd++;
|
r1BandEnd++;
|
||||||
}
|
}
|
||||||
|
|
||||||
r2BandEnd = r2;
|
r2BandEnd = r2;
|
||||||
while ((r2BandEnd != r2End) && (r2BandEnd->top == r2->top))
|
while ((r2BandEnd != r2End) && (r2BandEnd->top == r2->top))
|
||||||
{
|
{
|
||||||
r2BandEnd++;
|
r2BandEnd++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First handle the band that doesn't intersect, if any.
|
* First handle the band that doesn't intersect, if any.
|
||||||
*
|
*
|
||||||
@@ -987,7 +987,7 @@ BRegion::Support::miRegionOp(
|
|||||||
(* overlapFunc) (newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot);
|
(* overlapFunc) (newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newReg->fCount != curBand)
|
if (newReg->fCount != curBand)
|
||||||
{
|
{
|
||||||
prevBand = miCoalesce (newReg, prevBand, curBand);
|
prevBand = miCoalesce (newReg, prevBand, curBand);
|
||||||
@@ -1156,7 +1156,7 @@ BRegion::Support::miUnionO (
|
|||||||
register int bottom)
|
register int bottom)
|
||||||
{
|
{
|
||||||
register clipping_rect* pNextRect;
|
register clipping_rect* pNextRect;
|
||||||
|
|
||||||
pNextRect = &pReg->fData[pReg->fCount];
|
pNextRect = &pReg->fData[pReg->fCount];
|
||||||
|
|
||||||
#define MERGERECT(r) \
|
#define MERGERECT(r) \
|
||||||
@@ -1183,7 +1183,7 @@ BRegion::Support::miUnionO (
|
|||||||
} \
|
} \
|
||||||
assert(pReg->fCount<=pReg->fDataSize);\
|
assert(pReg->fCount<=pReg->fDataSize);\
|
||||||
r++;
|
r++;
|
||||||
|
|
||||||
assert (top<bottom);
|
assert (top<bottom);
|
||||||
while ((r1 != r1End) && (r2 != r2End))
|
while ((r1 != r1End) && (r2 != r2End))
|
||||||
{
|
{
|
||||||
@@ -1196,7 +1196,7 @@ BRegion::Support::miUnionO (
|
|||||||
MERGERECT(r2);
|
MERGERECT(r2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r1 != r1End)
|
if (r1 != r1End)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
@@ -1242,7 +1242,7 @@ BRegion::Support::XUnionRegion(
|
|||||||
/*
|
/*
|
||||||
* BRegion* 1 completely subsumes region 2
|
* BRegion* 1 completely subsumes region 2
|
||||||
*/
|
*/
|
||||||
if ((reg1->fCount == 1) &&
|
if ((reg1->fCount == 1) &&
|
||||||
(reg1->fBounds.left <= reg2->fBounds.left) &&
|
(reg1->fBounds.left <= reg2->fBounds.left) &&
|
||||||
(reg1->fBounds.top <= reg2->fBounds.top) &&
|
(reg1->fBounds.top <= reg2->fBounds.top) &&
|
||||||
(reg1->fBounds.right >= reg2->fBounds.right) &&
|
(reg1->fBounds.right >= reg2->fBounds.right) &&
|
||||||
@@ -1256,7 +1256,7 @@ BRegion::Support::XUnionRegion(
|
|||||||
/*
|
/*
|
||||||
* BRegion* 2 completely subsumes region 1
|
* BRegion* 2 completely subsumes region 1
|
||||||
*/
|
*/
|
||||||
if ((reg2->fCount == 1) &&
|
if ((reg2->fCount == 1) &&
|
||||||
(reg2->fBounds.left <= reg1->fBounds.left) &&
|
(reg2->fBounds.left <= reg1->fBounds.left) &&
|
||||||
(reg2->fBounds.top <= reg1->fBounds.top) &&
|
(reg2->fBounds.top <= reg1->fBounds.top) &&
|
||||||
(reg2->fBounds.right >= reg1->fBounds.right) &&
|
(reg2->fBounds.right >= reg1->fBounds.right) &&
|
||||||
@@ -1267,7 +1267,7 @@ BRegion::Support::XUnionRegion(
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
miRegionOp (newReg, reg1, reg2, miUnionO,
|
miRegionOp (newReg, reg1, reg2, miUnionO,
|
||||||
miUnionNonO, miUnionNonO);
|
miUnionNonO, miUnionNonO);
|
||||||
|
|
||||||
newReg->fBounds.left = min_c(reg1->fBounds.left, reg2->fBounds.left);
|
newReg->fBounds.left = min_c(reg1->fBounds.left, reg2->fBounds.left);
|
||||||
@@ -1306,9 +1306,9 @@ BRegion::Support::miSubtractNonO1 (
|
|||||||
register int bottom)
|
register int bottom)
|
||||||
{
|
{
|
||||||
register clipping_rect* pNextRect;
|
register clipping_rect* pNextRect;
|
||||||
|
|
||||||
pNextRect = &pReg->fData[pReg->fCount];
|
pNextRect = &pReg->fData[pReg->fCount];
|
||||||
|
|
||||||
assert(top<bottom);
|
assert(top<bottom);
|
||||||
|
|
||||||
while (r != rEnd)
|
while (r != rEnd)
|
||||||
@@ -1355,9 +1355,9 @@ BRegion::Support::miSubtractO(
|
|||||||
{
|
{
|
||||||
register clipping_rect* pNextRect;
|
register clipping_rect* pNextRect;
|
||||||
register int left;
|
register int left;
|
||||||
|
|
||||||
left = r1->left;
|
left = r1->left;
|
||||||
|
|
||||||
assert(top<bottom);
|
assert(top<bottom);
|
||||||
pNextRect = &pReg->fData[pReg->fCount];
|
pNextRect = &pReg->fData[pReg->fCount];
|
||||||
|
|
||||||
@@ -1476,7 +1476,7 @@ BRegion::Support::miSubtractO(
|
|||||||
}
|
}
|
||||||
return 0; /* lint */
|
return 0; /* lint */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
*-----------------------------------------------------------------------
|
*-----------------------------------------------------------------------
|
||||||
* miSubtract --
|
* miSubtract --
|
||||||
@@ -1495,7 +1495,7 @@ BRegion::Support::miSubtractO(
|
|||||||
int
|
int
|
||||||
BRegion::Support::XSubtractRegion(
|
BRegion::Support::XSubtractRegion(
|
||||||
const BRegion* regM,
|
const BRegion* regM,
|
||||||
const BRegion* regS,
|
const BRegion* regS,
|
||||||
register BRegion* regD)
|
register BRegion* regD)
|
||||||
{
|
{
|
||||||
/* check for trivial reject */
|
/* check for trivial reject */
|
||||||
@@ -1505,8 +1505,8 @@ BRegion::Support::XSubtractRegion(
|
|||||||
miRegionCopy(regD, regM);
|
miRegionCopy(regD, regM);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
miRegionOp (regD, regM, regS, miSubtractO,
|
miRegionOp (regD, regM, regS, miSubtractO,
|
||||||
miSubtractNonO1, NULL);
|
miSubtractNonO1, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1524,14 +1524,14 @@ int
|
|||||||
BRegion::Support::XXorRegion(const BRegion* sra, const BRegion* srb,
|
BRegion::Support::XXorRegion(const BRegion* sra, const BRegion* srb,
|
||||||
BRegion* dr)
|
BRegion* dr)
|
||||||
{
|
{
|
||||||
BRegion* tra;
|
BRegion* tra = NULL;
|
||||||
BRegion* trb;
|
BRegion* trb = NULL;
|
||||||
|
|
||||||
if ((! (tra = CreateRegion())) || (! (trb = CreateRegion())))
|
if ((! (tra = CreateRegion())) || (! (trb = CreateRegion())))
|
||||||
{
|
{
|
||||||
DestroyRegion(tra);
|
DestroyRegion(tra);
|
||||||
DestroyRegion(trb);
|
DestroyRegion(trb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
(void) XSubtractRegion(sra,srb,tra);
|
(void) XSubtractRegion(sra,srb,tra);
|
||||||
(void) XSubtractRegion(srb,sra,trb);
|
(void) XSubtractRegion(srb,sra,trb);
|
||||||
@@ -1542,7 +1542,7 @@ BRegion::Support::XXorRegion(const BRegion* sra, const BRegion* srb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
BRegion::Support::XPointInRegion(
|
BRegion::Support::XPointInRegion(
|
||||||
const BRegion* pRegion,
|
const BRegion* pRegion,
|
||||||
int x, int y)
|
int x, int y)
|
||||||
@@ -1562,7 +1562,7 @@ BRegion::Support::XPointInRegion(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BRegion::Support::XRectInRegion(
|
BRegion::Support::XRectInRegion(
|
||||||
register const BRegion* region,
|
register const BRegion* region,
|
||||||
const clipping_rect& rect)
|
const clipping_rect& rect)
|
||||||
@@ -1574,7 +1574,7 @@ BRegion::Support::XRectInRegion(
|
|||||||
|
|
||||||
int rx = prect->left;
|
int rx = prect->left;
|
||||||
int ry = prect->top;
|
int ry = prect->top;
|
||||||
|
|
||||||
/* this is (just) a useful optimization */
|
/* this is (just) a useful optimization */
|
||||||
if ((region->fCount == 0) || !EXTENTCHECK(®ion->fBounds, prect))
|
if ((region->fCount == 0) || !EXTENTCHECK(®ion->fBounds, prect))
|
||||||
return(RectangleOut);
|
return(RectangleOut);
|
||||||
@@ -1636,6 +1636,6 @@ BRegion::Support::XRectInRegion(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(partIn ? ((ry < prect->bottom) ? RectanglePart : RectangleIn) :
|
return(partIn ? ((ry < prect->bottom) ? RectanglePart : RectangleIn) :
|
||||||
RectangleOut);
|
RectangleOut);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user