Set an error message if the rect passed to SDL_RenderReadPixels() is entirely outside the viewport
This commit is contained in:
parent
29df99ee38
commit
85a302550d
1 changed files with 1 additions and 0 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue