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
2024-09-25 22:15:20 -07:00
parent 1aea43846e
commit 345d9bfe19
3 changed files with 28 additions and 2 deletions

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;

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;
}