From 1c19bee0007729e4e05fb627ade0b1be0f414241 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 25 Oct 2025 13:47:11 -0700 Subject: [PATCH] Perform full rectangle intersection for empty rects If we don't do that, we leave the x and y values uninitialized. Fixes https://github.com/libsdl-org/sdl12-compat/issues/365 (cherry picked from commit ffd0ca4391dc012d11d7cbe22279ecc25400621b) --- src/video/SDL_rect_impl.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/video/SDL_rect_impl.h b/src/video/SDL_rect_impl.h index ffc3d853c9..31f2a23c92 100644 --- a/src/video/SDL_rect_impl.h +++ b/src/video/SDL_rect_impl.h @@ -31,8 +31,6 @@ SDL_bool SDL_HASINTERSECTION(const RECTTYPE *A, const RECTTYPE *B) } else if (!B) { SDL_InvalidParamError("B"); return SDL_FALSE; - } else if (SDL_RECTEMPTY(A) || SDL_RECTEMPTY(B)) { - return SDL_FALSE; /* Special cases for empty rects */ } /* Horizontal intersection */ @@ -79,10 +77,6 @@ SDL_bool SDL_INTERSECTRECT(const RECTTYPE *A, const RECTTYPE *B, RECTTYPE *resul } else if (!result) { SDL_InvalidParamError("result"); return SDL_FALSE; - } else if (SDL_RECTEMPTY(A) || SDL_RECTEMPTY(B)) { /* Special cases for empty rects */ - result->w = 0; - result->h = 0; - return SDL_FALSE; } /* Horizontal intersection */