From b1185bef03d6bc3e4662224eca56112f0c8ab099 Mon Sep 17 00:00:00 2001 From: Andreas Schiffler Date: Mon, 12 Sep 2011 09:00:01 -0700 Subject: [PATCH] Fix regression introducted by added parameter check in SDL_EnclosePoints. Add special case to speedup when no result was requested. --- src/video/SDL_rect.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/video/SDL_rect.c b/src/video/SDL_rect.c index d47fe109d..afb74e904 100644 --- a/src/video/SDL_rect.c +++ b/src/video/SDL_rect.c @@ -141,7 +141,7 @@ SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip, int maxy = 0; int x, y, i; - if (!points || !clip) { + if (!points) { // TODO error message return SDL_FALSE; } @@ -167,6 +167,12 @@ SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip, continue; } if (!added) { + /* Special case: if no result was requested, we are done */ + if (result == NULL) { + return SDL_TRUE; + } + + /* First point added */ minx = maxx = x; miny = maxy = y; added = SDL_TRUE; @@ -187,6 +193,11 @@ SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip, return SDL_FALSE; } } else { + /* Special case: if no result was requested, we are done */ + if (result == NULL) { + return SDL_TRUE; + } + /* No clipping, always add the first point */ minx = maxx = points[0].x; miny = maxy = points[0].y;