A zero source rect is valid for blitting

A zero sized source rect draws pixels sourced from a 0x0 region on the source surface.

Fixes https://github.com/libsdl-org/SDL/issues/8580
This commit is contained in:
Sam Lantinga committed 2024-09-25 22:36:55 -07:00
1 parent 1aea43846e
commit 345d9bfe19
3 files changed
+28 -2

No files matched your search

+1 -1
View File
@@ -59,7 +59,7 @@ static bool SDLCALL SDL_SoftBlit(SDL_Surface *src, const SDL_Rect *srcrect,
}
// Set up source and destination buffer pointers, and BLIT!
if (okay && !SDL_RectEmpty(srcrect)) {
if (okay) {
SDL_BlitFunc RunBlit;
SDL_BlitInfo *info = &src->internal->map.info;
+1 -1
View File
@@ -1226,7 +1226,7 @@ bool SDL_BlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surfac
SDL_GetRectIntersection(clip_rect, &final_dst, &final_dst);
if (final_dst.w == 0 || final_dst.h == 0 ||
final_src.w <= 0 || final_src.h <= 0) {
final_src.w < 0 || final_src.h < 0) {
// No-op.
return true;
}