From fd4e6d29493a06518abb00ca51b3a0e29afa3ffc Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 15 Feb 2025 07:06:43 -0800
Subject: [PATCH] Don't render 0 sized texture rectangles
Fixes https://github.com/libsdl-org/sdl2-compat/issues/355
---
src/render/SDL_render.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index c73d39006e4a7..5744bcd118aaa 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -3888,7 +3888,8 @@ bool SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_F
real_srcrect.w = (float)texture->w;
real_srcrect.h = (float)texture->h;
if (srcrect) {
- if (!SDL_GetRectIntersectionFloat(srcrect, &real_srcrect, &real_srcrect)) {
+ if (!SDL_GetRectIntersectionFloat(srcrect, &real_srcrect, &real_srcrect) ||
+ real_srcrect.w == 0.0f || real_srcrect.h == 0.0f) {
return true;
}
}