Fixed bug 3116 - renderer->hidden in SDL_RenderCopy(Ex)

Daniel

Seems like check of the visibility of renderer (renderer->hidden) is missing in SDL_RenderCopyEx.

In SDL_RenderCopy it should be done much earlier (after checking support for RenderCopyEx, line 1750).
This commit is contained in:
Sam Lantinga 2016-10-01 14:31:00 -07:00
parent 359f59aef5
commit c8cfccc2f1
1 changed files with 17 additions and 7 deletions

View File

@ -1457,6 +1457,7 @@ SDL_RenderDrawPoints(SDL_Renderer * renderer,
if (count < 1) {
return 0;
}
/* Don't draw while we're hidden */
if (renderer->hidden) {
return 0;
@ -1566,6 +1567,7 @@ SDL_RenderDrawLines(SDL_Renderer * renderer,
if (count < 2) {
return 0;
}
/* Don't draw while we're hidden */
if (renderer->hidden) {
return 0;
@ -1639,6 +1641,7 @@ SDL_RenderDrawRects(SDL_Renderer * renderer,
if (renderer->hidden) {
return 0;
}
for (i = 0; i < count; ++i) {
if (SDL_RenderDrawRect(renderer, &rects[i]) < 0) {
return -1;
@ -1680,6 +1683,7 @@ SDL_RenderFillRects(SDL_Renderer * renderer,
if (count < 1) {
return 0;
}
/* Don't draw while we're hidden */
if (renderer->hidden) {
return 0;
@ -1718,6 +1722,11 @@ SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
return SDL_SetError("Texture was not created with this renderer");
}
/* Don't draw while we're hidden */
if (renderer->hidden) {
return 0;
}
real_srcrect.x = 0;
real_srcrect.y = 0;
real_srcrect.w = texture->w;
@ -1742,11 +1751,6 @@ SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
texture = texture->native;
}
/* Don't draw while we're hidden */
if (renderer->hidden) {
return 0;
}
frect.x = real_dstrect.x * renderer->scale.x;
frect.y = real_dstrect.y * renderer->scale.y;
frect.w = real_dstrect.w * renderer->scale.x;
@ -1781,6 +1785,11 @@ SDL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
return SDL_SetError("Renderer does not support RenderCopyEx");
}
/* Don't draw while we're hidden */
if (renderer->hidden) {
return 0;
}
real_srcrect.x = 0;
real_srcrect.y = 0;
real_srcrect.w = texture->w;
@ -1804,8 +1813,9 @@ SDL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
texture = texture->native;
}
if(center) real_center = *center;
else {
if (center) {
real_center = *center;
} else {
real_center.x = real_dstrect.w/2;
real_center.y = real_dstrect.h/2;
}