Set an error message if the rect passed to SDL_RenderReadPixels() is entirely outside the viewport

This commit is contained in:
Sam Lantinga 2025-02-25 10:27:05 -08:00
parent 29df99ee38
commit 85a302550d

View file

@ -5019,6 +5019,7 @@ SDL_Surface *SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
if (rect) {
if (!SDL_GetRectIntersection(rect, &real_rect, &real_rect)) {
SDL_SetError("Can't read outside the current viewport");
return NULL;
}
}