mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-26 13:08:29 +00:00
Set an error message if the rect passed to SDL_RenderReadPixels() is entirely outside the viewport
This commit is contained in:
@@ -5019,6 +5019,7 @@ SDL_Surface *SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
|||||||
|
|
||||||
if (rect) {
|
if (rect) {
|
||||||
if (!SDL_GetRectIntersection(rect, &real_rect, &real_rect)) {
|
if (!SDL_GetRectIntersection(rect, &real_rect, &real_rect)) {
|
||||||
|
SDL_SetError("Can't read outside the current viewport");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user