The viewport is already scaled to the output coordinates
authorSam Lantinga <slouken@libsdl.org>
Mon, 01 Oct 2012 21:57:09 -0700
changeset 6529 9094fcfd378d
parent 6528 e978048ced60
child 6530 ba5de88eab60
The viewport is already scaled to the output coordinates
src/render/software/SDL_render_sw.c
--- a/src/render/software/SDL_render_sw.c	Mon Oct 01 20:59:33 2012 -0700
+++ b/src/render/software/SDL_render_sw.c	Mon Oct 01 21:57:09 2012 -0700
@@ -361,8 +361,8 @@
         return -1;
     }
     if (renderer->viewport.x || renderer->viewport.y) {
-        float x = renderer->viewport.x * renderer->scale.x;
-        float y = renderer->viewport.y * renderer->scale.y;
+        int x = renderer->viewport.x;
+        int y = renderer->viewport.y;
 
         for (i = 0; i < count; ++i) {
             final_points[i].x = (int)(x + points[i].x);
@@ -411,8 +411,8 @@
         return -1;
     }
     if (renderer->viewport.x || renderer->viewport.y) {
-        float x = renderer->viewport.x * renderer->scale.x;
-        float y = renderer->viewport.y * renderer->scale.y;
+        int x = renderer->viewport.x;
+        int y = renderer->viewport.y;
 
         for (i = 0; i < count; ++i) {
             final_points[i].x = (int)(x + points[i].x);
@@ -460,8 +460,8 @@
         return -1;
     }
     if (renderer->viewport.x || renderer->viewport.y) {
-        float x = renderer->viewport.x * renderer->scale.x;
-        float y = renderer->viewport.y * renderer->scale.y;
+        int x = renderer->viewport.x;
+        int y = renderer->viewport.y;
 
         for (i = 0; i < count; ++i) {
             final_rects[i].x = (int)(x + rects[i].x);
@@ -507,8 +507,8 @@
     }
 
     if (renderer->viewport.x || renderer->viewport.y) {
-        final_rect.x = (int)((renderer->viewport.x * renderer->scale.x) + dstrect->x);
-        final_rect.y = (int)((renderer->viewport.y * renderer->scale.y) + dstrect->y);
+        final_rect.x = (int)(renderer->viewport.x + dstrect->x);
+        final_rect.y = (int)(renderer->viewport.y + dstrect->y);
     } else {
         final_rect.x = (int)dstrect->x;
         final_rect.y = (int)dstrect->y;
@@ -553,8 +553,8 @@
     }
 
     if (renderer->viewport.x || renderer->viewport.y) {
-        final_rect.x = (int)((renderer->viewport.x * renderer->scale.x) + dstrect->x);
-        final_rect.y = (int)((renderer->viewport.y * renderer->scale.y) + dstrect->y);
+        final_rect.x = (int)(renderer->viewport.x + dstrect->x);
+        final_rect.y = (int)(renderer->viewport.y + dstrect->y);
     } else {
         final_rect.x = (int)dstrect->x;
         final_rect.y = (int)dstrect->y;