fix tab/space style

This commit is contained in:
zihao.jiang 2015-03-20 23:40:48 +08:00
parent f94935224c
commit ce06229499
2 changed files with 38 additions and 38 deletions

View File

@ -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);
}
}
}

View File

@ -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(&region);
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(&region, &region, &firstRect))
goto out;
/* Intersect 2 non-intersect rectangle, result should be empty */
if (!region16_union_rect(&region, &region, &firstRect))
goto out;
if (!region16_intersect_rect(&region, &region, &anotherRect))
goto out;
if (!region16_intersect_rect(&region, &region, &anotherRect))
goto out;
if (!compareRectangles(region16_extents(&region), &expected_inter_extents, 1) )
goto out;
@ -712,8 +712,8 @@ static int test_empty_rectangle() {
if (!region16_is_empty(&region))
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}
};