Fixed a bug resetting the viewport with a render target.
authorSam Lantinga <slouken@libsdl.org>
Fri, 12 Oct 2012 02:30:03 -0700
changeset 6579 2390a7403b77
parent 6578 77d70ec131bc
child 6580 a7d6106f1715
Fixed a bug resetting the viewport with a render target.
src/render/SDL_render.c
--- a/src/render/SDL_render.c	Fri Oct 12 02:20:10 2012 -0700
+++ b/src/render/SDL_render.c	Fri Oct 12 02:30:03 2012 -0700
@@ -1057,7 +1057,10 @@
     } else {
         renderer->viewport.x = 0;
         renderer->viewport.y = 0;
-        if (renderer->window) {
+        if (renderer->target) {
+            SDL_QueryTexture(renderer->target, NULL, NULL,
+                              &renderer->viewport.w, &renderer->viewport.h);
+        } else if (renderer->window) {
             SDL_GetWindowSize(renderer->window,
                               &renderer->viewport.w, &renderer->viewport.h);
         } else {