fix tab/space style
This commit is contained in:
parent
f94935224c
commit
ce06229499
@ -132,9 +132,9 @@ static RECTANGLE_16 *region16_extents_noconst(REGION16 *region)
|
||||
|
||||
BOOL rectangle_is_empty(const RECTANGLE_16 *rect)
|
||||
{
|
||||
/* An rectangle with width <= 0 or height <= 0 should be regarded
|
||||
* as empty.
|
||||
*/
|
||||
/* A rectangle with width <= 0 or height <= 0 should be regarded
|
||||
* as empty.
|
||||
*/
|
||||
return ((rect->left >= rect->right) || (rect->top >= rect->bottom)) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
@ -773,21 +773,21 @@ BOOL region16_intersect_rect(REGION16 *dst, const REGION16 *src, const RECTANGLE
|
||||
usedRects++;
|
||||
dstPtr++;
|
||||
|
||||
if (rectangle_is_empty(&newExtents))
|
||||
{
|
||||
/* Check if the existing newExtents is empty. If it is empty, use
|
||||
* new common directly. We do not need to check common rectangle
|
||||
* because the rectangles_intersection() ensures that it is not empty.
|
||||
*/
|
||||
newExtents = common;
|
||||
}
|
||||
else
|
||||
{
|
||||
newExtents.top = MIN(common.top, newExtents.top);
|
||||
newExtents.left = MIN(common.left, newExtents.left);
|
||||
newExtents.bottom = MAX(common.bottom, newExtents.bottom);
|
||||
newExtents.right = MAX(common.right, newExtents.right);
|
||||
}
|
||||
if (rectangle_is_empty(&newExtents))
|
||||
{
|
||||
/* Check if the existing newExtents is empty. If it is empty, use
|
||||
* new common directly. We do not need to check common rectangle
|
||||
* because the rectangles_intersection() ensures that it is not empty.
|
||||
*/
|
||||
newExtents = common;
|
||||
}
|
||||
else
|
||||
{
|
||||
newExtents.top = MIN(common.top, newExtents.top);
|
||||
newExtents.left = MIN(common.left, newExtents.left);
|
||||
newExtents.bottom = MAX(common.bottom, newExtents.bottom);
|
||||
newExtents.right = MAX(common.right, newExtents.right);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -669,17 +669,17 @@ static int test_empty_rectangle() {
|
||||
int i;
|
||||
|
||||
RECTANGLE_16 emptyRectangles[4] = {
|
||||
{ 0, 0, 0, 0},
|
||||
{ 10, 10, 10, 11},
|
||||
{ 10, 10, 11, 10},
|
||||
{ 100, 100, 0, 0}
|
||||
{ 0, 0, 0, 0},
|
||||
{ 10, 10, 10, 11},
|
||||
{ 10, 10, 11, 10},
|
||||
{ 100, 100, 0, 0}
|
||||
};
|
||||
|
||||
RECTANGLE_16 firstRect = {
|
||||
0, 0, 100, 100
|
||||
0, 0, 100, 100
|
||||
};
|
||||
RECTANGLE_16 anotherRect = {
|
||||
100, 100, 200, 200
|
||||
100, 100, 200, 200
|
||||
};
|
||||
RECTANGLE_16 expected_inter_extents = {
|
||||
0, 0, 0, 0
|
||||
@ -688,23 +688,23 @@ static int test_empty_rectangle() {
|
||||
region16_init(®ion);
|
||||
region16_init(&intersection);
|
||||
|
||||
/* Check for empty rectangles */
|
||||
/* Check for empty rectangles */
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (!rectangle_is_empty(&emptyRectangles[i]))
|
||||
goto out;
|
||||
if (!rectangle_is_empty(&emptyRectangles[i]))
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Check for non-empty rectangles */
|
||||
if (rectangle_is_empty(&firstRect))
|
||||
goto out;
|
||||
/* Check for non-empty rectangles */
|
||||
if (rectangle_is_empty(&firstRect))
|
||||
goto out;
|
||||
|
||||
/* Intersect 2 non-intersect rectangle, result should be empty */
|
||||
if (!region16_union_rect(®ion, ®ion, &firstRect))
|
||||
goto out;
|
||||
/* Intersect 2 non-intersect rectangle, result should be empty */
|
||||
if (!region16_union_rect(®ion, ®ion, &firstRect))
|
||||
goto out;
|
||||
|
||||
if (!region16_intersect_rect(®ion, ®ion, &anotherRect))
|
||||
goto out;
|
||||
if (!region16_intersect_rect(®ion, ®ion, &anotherRect))
|
||||
goto out;
|
||||
|
||||
if (!compareRectangles(region16_extents(®ion), &expected_inter_extents, 1) )
|
||||
goto out;
|
||||
@ -712,8 +712,8 @@ static int test_empty_rectangle() {
|
||||
if (!region16_is_empty(®ion))
|
||||
goto out;
|
||||
|
||||
if (!rectangle_is_empty(region16_extents(&intersection)))
|
||||
goto out;
|
||||
if (!rectangle_is_empty(region16_extents(&intersection)))
|
||||
goto out;
|
||||
|
||||
retCode = 0;
|
||||
out:
|
||||
@ -741,7 +741,7 @@ struct UnitaryTest tests[] = {
|
||||
{"R1 & R3", test_r1_inter_r3},
|
||||
{"(R1+R3)&R11 (band merge)",test_r1_r3_inter_r11},
|
||||
{"norbert case", test_norbert_case},
|
||||
{"empty rectangle case", test_empty_rectangle},
|
||||
{"empty rectangle case", test_empty_rectangle},
|
||||
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user