src/render/SDL_render.c
changeset 5464 bec064e902cf
parent 5423 b69fa50e80d7
child 5528 15c9c03a80cc
--- a/src/render/SDL_render.c	Thu Mar 10 00:58:45 2011 -0800
+++ b/src/render/SDL_render.c	Thu Mar 10 01:00:43 2011 -0800
@@ -1076,8 +1076,8 @@
         format = SDL_GetWindowPixelFormat(window);
     }
 
-    real_rect.x = 0;
-    real_rect.y = 0;
+    real_rect.x = renderer->viewport.x;
+    real_rect.y = renderer->viewport.y;
     real_rect.w = renderer->viewport.w;
     real_rect.h = renderer->viewport.h;
     if (rect) {
@@ -1088,7 +1088,7 @@
             pixels = (Uint8 *)pixels + pitch * (real_rect.y - rect->y);
         }
         if (real_rect.x > rect->x) {
-            int bpp = SDL_BYTESPERPIXEL(SDL_GetWindowPixelFormat(window));
+            int bpp = SDL_BYTESPERPIXEL(format);
             pixels = (Uint8 *)pixels + bpp * (real_rect.x - rect->x);
         }
     }