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).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index 4f9b6b2..556d68d 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -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;
}