From ffd0ca4391dc012d11d7cbe22279ecc25400621b Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
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
---
src/video/SDL_rect_impl.h | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/src/video/SDL_rect_impl.h b/src/video/SDL_rect_impl.h
index 1045a97edb88d..73e76384bb828 100644
--- a/src/video/SDL_rect_impl.h
+++ b/src/video/SDL_rect_impl.h
@@ -51,10 +51,6 @@ bool SDL_HASINTERSECTION(const RECTTYPE *A, const RECTTYPE *B)
return false;
}
- if (SDL_RECTEMPTY(A) || SDL_RECTEMPTY(B)) {
- return false; // Special cases for empty rects
- }
-
// Horizontal intersection
Amin = A->x;
Amax = Amin + A->w;
@@ -107,12 +103,6 @@ bool SDL_INTERSECTRECT(const RECTTYPE *A, const RECTTYPE *B, RECTTYPE *result)
return false;
}
- if (SDL_RECTEMPTY(A) || SDL_RECTEMPTY(B)) { // Special cases for empty rects
- result->w = 0;
- result->h = 0;
- return false;
- }
-
// Horizontal intersection
Amin = A->x;
Amax = Amin + A->w;