Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fix regression introducted by added parameter check in SDL_EnclosePoi…
Browse files Browse the repository at this point in the history
…nts. Add special case to speedup when no result was requested.
  • Loading branch information
ferzkopp committed Sep 12, 2011
1 parent d6c7ebe commit 308d1f8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/video/SDL_rect.c
Expand Up @@ -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;
}
Expand All @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 308d1f8

Please sign in to comment.