From 494bf8e41317fed189ffe4eaaaaf555480cd8525 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 11 Dec 2009 09:57:54 +0000 Subject: [PATCH] Make sure we fully clip the first point before starting to adjust the second point. --- src/video/SDL_rect.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/video/SDL_rect.c b/src/video/SDL_rect.c index 52948f079..30c1e0f3c 100644 --- a/src/video/SDL_rect.c +++ b/src/video/SDL_rect.c @@ -311,9 +311,7 @@ SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, int *Y1, int *X2, x1 = x; y1 = y; outcode1 = ComputeOutCode(rect, x, y); - } - - if (outcode2) { + } else { if (outcode2 & CODE_TOP) { y = recty1; x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1);