The viewport is already scaled to the output coordinates
authorSam Lantinga <slouken@libsdl.org>
Mon, 01 Oct 2012 21:57:09 -0700
changeset 65299094fcfd378d
parent 6528 e978048ced60
child 6530 ba5de88eab60
The viewport is already scaled to the output coordinates
src/render/software/SDL_render_sw.c
     1.1 --- a/src/render/software/SDL_render_sw.c	Mon Oct 01 20:59:33 2012 -0700
     1.2 +++ b/src/render/software/SDL_render_sw.c	Mon Oct 01 21:57:09 2012 -0700
     1.3 @@ -361,8 +361,8 @@
     1.4          return -1;
     1.5      }
     1.6      if (renderer->viewport.x || renderer->viewport.y) {
     1.7 -        float x = renderer->viewport.x * renderer->scale.x;
     1.8 -        float y = renderer->viewport.y * renderer->scale.y;
     1.9 +        int x = renderer->viewport.x;
    1.10 +        int y = renderer->viewport.y;
    1.11  
    1.12          for (i = 0; i < count; ++i) {
    1.13              final_points[i].x = (int)(x + points[i].x);
    1.14 @@ -411,8 +411,8 @@
    1.15          return -1;
    1.16      }
    1.17      if (renderer->viewport.x || renderer->viewport.y) {
    1.18 -        float x = renderer->viewport.x * renderer->scale.x;
    1.19 -        float y = renderer->viewport.y * renderer->scale.y;
    1.20 +        int x = renderer->viewport.x;
    1.21 +        int y = renderer->viewport.y;
    1.22  
    1.23          for (i = 0; i < count; ++i) {
    1.24              final_points[i].x = (int)(x + points[i].x);
    1.25 @@ -460,8 +460,8 @@
    1.26          return -1;
    1.27      }
    1.28      if (renderer->viewport.x || renderer->viewport.y) {
    1.29 -        float x = renderer->viewport.x * renderer->scale.x;
    1.30 -        float y = renderer->viewport.y * renderer->scale.y;
    1.31 +        int x = renderer->viewport.x;
    1.32 +        int y = renderer->viewport.y;
    1.33  
    1.34          for (i = 0; i < count; ++i) {
    1.35              final_rects[i].x = (int)(x + rects[i].x);
    1.36 @@ -507,8 +507,8 @@
    1.37      }
    1.38  
    1.39      if (renderer->viewport.x || renderer->viewport.y) {
    1.40 -        final_rect.x = (int)((renderer->viewport.x * renderer->scale.x) + dstrect->x);
    1.41 -        final_rect.y = (int)((renderer->viewport.y * renderer->scale.y) + dstrect->y);
    1.42 +        final_rect.x = (int)(renderer->viewport.x + dstrect->x);
    1.43 +        final_rect.y = (int)(renderer->viewport.y + dstrect->y);
    1.44      } else {
    1.45          final_rect.x = (int)dstrect->x;
    1.46          final_rect.y = (int)dstrect->y;
    1.47 @@ -553,8 +553,8 @@
    1.48      }
    1.49  
    1.50      if (renderer->viewport.x || renderer->viewport.y) {
    1.51 -        final_rect.x = (int)((renderer->viewport.x * renderer->scale.x) + dstrect->x);
    1.52 -        final_rect.y = (int)((renderer->viewport.y * renderer->scale.y) + dstrect->y);
    1.53 +        final_rect.x = (int)(renderer->viewport.x + dstrect->x);
    1.54 +        final_rect.y = (int)(renderer->viewport.y + dstrect->y);
    1.55      } else {
    1.56          final_rect.x = (int)dstrect->x;
    1.57          final_rect.y = (int)dstrect->y;