mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-12-21 04:35:23 +08:00
Cleanup add brace (#6545)
* Add braces after if conditions
* More add braces after if conditions
* Add braces after while() conditions
* Fix compilation because of macro being modified
* Add braces to for loop
* Add braces after if/goto
* Move comments up
* Remove extra () in the 'return ...;' statements
* More remove extra () in the 'return ...;' statements
* More remove extra () in the 'return ...;' statements after merge
* Fix inconsistent patterns are xxx == NULL vs !xxx
* More "{}" for "if() break;" and "if() continue;"
* More "{}" after if() short statement
* More "{}" after "if () return;" statement
* More fix inconsistent patterns are xxx == NULL vs !xxx
* Revert some modificaion on SDL_RLEaccel.c
* SDL_RLEaccel: no short statement
* Cleanup 'if' where the bracket is in a new line
* Cleanup 'while' where the bracket is in a new line
* Cleanup 'for' where the bracket is in a new line
* Cleanup 'else' where the bracket is in a new line
This commit is contained in:
@@ -1006,10 +1006,18 @@ int rect_testEnclosePoints(void *arg)
|
||||
miny = newy;
|
||||
maxy = newy;
|
||||
} else {
|
||||
if (newx < minx) minx = newx;
|
||||
if (newx > maxx) maxx = newx;
|
||||
if (newy < miny) miny = newy;
|
||||
if (newy > maxy) maxy = newy;
|
||||
if (newx < minx) {
|
||||
minx = newx;
|
||||
}
|
||||
if (newx > maxx) {
|
||||
maxx = newx;
|
||||
}
|
||||
if (newy < miny) {
|
||||
miny = newy;
|
||||
}
|
||||
if (newy > maxy) {
|
||||
maxy = newy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1082,10 +1090,18 @@ int rect_testEnclosePointsRepeatedInput(void *arg)
|
||||
miny = newy;
|
||||
maxy = newy;
|
||||
} else {
|
||||
if (newx < minx) minx = newx;
|
||||
if (newx > maxx) maxx = newx;
|
||||
if (newy < miny) miny = newy;
|
||||
if (newy > maxy) maxy = newy;
|
||||
if (newx < minx) {
|
||||
minx = newx;
|
||||
}
|
||||
if (newx > maxx) {
|
||||
maxx = newx;
|
||||
}
|
||||
if (newy < miny) {
|
||||
miny = newy;
|
||||
}
|
||||
if (newy > maxy) {
|
||||
maxy = newy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1162,10 +1178,18 @@ int rect_testEnclosePointsWithClipping(void *arg)
|
||||
miny = newy;
|
||||
maxy = newy;
|
||||
} else {
|
||||
if (newx < minx) minx = newx;
|
||||
if (newx > maxx) maxx = newx;
|
||||
if (newy < miny) miny = newy;
|
||||
if (newy > maxy) maxy = newy;
|
||||
if (newx < minx) {
|
||||
minx = newx;
|
||||
}
|
||||
if (newx > maxx) {
|
||||
maxx = newx;
|
||||
}
|
||||
if (newy < miny) {
|
||||
miny = newy;
|
||||
}
|
||||
if (newy > maxy) {
|
||||
maxy = newy;
|
||||
}
|
||||
}
|
||||
expectedEnclosed = SDL_TRUE;
|
||||
}
|
||||
@@ -1302,10 +1326,18 @@ int rect_testUnionRectOutside(void *arg)
|
||||
refRectB.w=refRectA.w - 2;
|
||||
refRectB.h=refRectA.h - 2;
|
||||
expectedResult = refRectA;
|
||||
if (dx == -1) expectedResult.x--;
|
||||
if (dy == -1) expectedResult.y--;
|
||||
if ((dx == 1) || (dx == -1)) expectedResult.w++;
|
||||
if ((dy == 1) || (dy == -1)) expectedResult.h++;
|
||||
if (dx == -1) {
|
||||
expectedResult.x--;
|
||||
}
|
||||
if (dy == -1) {
|
||||
expectedResult.y--;
|
||||
}
|
||||
if ((dx == 1) || (dx == -1)) {
|
||||
expectedResult.w++;
|
||||
}
|
||||
if ((dy == 1) || (dy == -1)) {
|
||||
expectedResult.h++;
|
||||
}
|
||||
rectA = refRectA;
|
||||
rectB = refRectB;
|
||||
SDL_UnionRect(&rectA, &rectB, &result);
|
||||
@@ -1430,10 +1462,18 @@ int rect_testUnionRectInside(void *arg)
|
||||
refRectA.w=SDLTest_RandomIntegerInRange(256, 1024);
|
||||
refRectA.h=SDLTest_RandomIntegerInRange(256, 1024);
|
||||
refRectB = refRectA;
|
||||
if (dx == -1) refRectB.x++;
|
||||
if ((dx == 1) || (dx == -1)) refRectB.w--;
|
||||
if (dy == -1) refRectB.y++;
|
||||
if ((dy == 1) || (dy == -1)) refRectB.h--;
|
||||
if (dx == -1) {
|
||||
refRectB.x++;
|
||||
}
|
||||
if ((dx == 1) || (dx == -1)) {
|
||||
refRectB.w--;
|
||||
}
|
||||
if (dy == -1) {
|
||||
refRectB.y++;
|
||||
}
|
||||
if ((dy == 1) || (dy == -1)) {
|
||||
refRectB.h--;
|
||||
}
|
||||
expectedResult = refRectA;
|
||||
rectA = refRectA;
|
||||
rectB = refRectB;
|
||||
|
||||
Reference in New Issue
Block a user