Commit b1185bef authored by Andreas Schiffler's avatar Andreas Schiffler

Fix regression introducted by added parameter check in SDL_EnclosePoints. Add...

Fix regression introducted by added parameter check in SDL_EnclosePoints. Add special case to speedup when no result was requested.
parent d7cb5c41
...@@ -141,7 +141,7 @@ SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip, ...@@ -141,7 +141,7 @@ SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip,
int maxy = 0; int maxy = 0;
int x, y, i; int x, y, i;
if (!points || !clip) { if (!points) {
// TODO error message // TODO error message
return SDL_FALSE; return SDL_FALSE;
} }
...@@ -167,6 +167,12 @@ SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip, ...@@ -167,6 +167,12 @@ SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip,
continue; continue;
} }
if (!added) { if (!added) {
/* Special case: if no result was requested, we are done */
if (result == NULL) {
return SDL_TRUE;
}
/* First point added */
minx = maxx = x; minx = maxx = x;
miny = maxy = y; miny = maxy = y;
added = SDL_TRUE; added = SDL_TRUE;
...@@ -187,6 +193,11 @@ SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip, ...@@ -187,6 +193,11 @@ SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip,
return SDL_FALSE; return SDL_FALSE;
} }
} else { } else {
/* Special case: if no result was requested, we are done */
if (result == NULL) {
return SDL_TRUE;
}
/* No clipping, always add the first point */ /* No clipping, always add the first point */
minx = maxx = points[0].x; minx = maxx = points[0].x;
miny = maxy = points[0].y; miny = maxy = points[0].y;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment