Reverted the experiment, it didn't work.
authorSam Lantinga <slouken@libsdl.org>
Sun, 20 Feb 2011 23:51:31 -0800
changeset 5369e049a7b85fd1
parent 5368 f0ee2c086931
child 5370 cb219a294ebf
Reverted the experiment, it didn't work.
src/render/SDL_render.c
     1.1 --- a/src/render/SDL_render.c	Sun Feb 20 23:16:58 2011 -0800
     1.2 +++ b/src/render/SDL_render.c	Sun Feb 20 23:51:31 2011 -0800
     1.3 @@ -999,7 +999,6 @@
     1.4  {
     1.5      SDL_Window *window;
     1.6      SDL_Rect real_srcrect;
     1.7 -    SDL_Rect clip_dstrect;
     1.8      SDL_Rect real_dstrect;
     1.9  
    1.10      CHECK_RENDERER_MAGIC(renderer, -1);
    1.11 @@ -1011,16 +1010,6 @@
    1.12      }
    1.13      window = renderer->window;
    1.14  
    1.15 -    if (dstrect) {
    1.16 -        clip_dstrect = *dstrect;
    1.17 -    } else {
    1.18 -        clip_dstrect.x = 0;
    1.19 -        clip_dstrect.y = 0;
    1.20 -        clip_dstrect.w = renderer->viewport.w;
    1.21 -        clip_dstrect.h = renderer->viewport.h;
    1.22 -    }
    1.23 -    dstrect = &clip_dstrect;
    1.24 -
    1.25      real_srcrect.x = 0;
    1.26      real_srcrect.y = 0;
    1.27      real_srcrect.w = texture->w;
    1.28 @@ -1029,40 +1018,29 @@
    1.29          if (!SDL_IntersectRect(srcrect, &real_srcrect, &real_srcrect)) {
    1.30              return 0;
    1.31          }
    1.32 -        /* Clip dstrect by the same amount as srcrect was clipped */
    1.33 -        if (srcrect->w != real_srcrect.w) {
    1.34 -            int deltax = (real_srcrect.x - srcrect->x);
    1.35 -            int deltaw = (real_srcrect.w - srcrect->w);
    1.36 -            clip_dstrect.x += (deltax * clip_dstrect.w) / srcrect->w;
    1.37 -            clip_dstrect.w += (deltaw * clip_dstrect.w) / srcrect->w;
    1.38 -        }
    1.39 -        if (srcrect->h != real_srcrect.h) {
    1.40 -            int deltay = (real_srcrect.y - srcrect->y);
    1.41 -            int deltah = (real_srcrect.h - srcrect->h);
    1.42 -            clip_dstrect.y += (deltay * clip_dstrect.h) / srcrect->h;
    1.43 -            clip_dstrect.h += (deltah * clip_dstrect.h) / srcrect->h;
    1.44 -        }
    1.45      }
    1.46  
    1.47      real_dstrect.x = 0;
    1.48      real_dstrect.y = 0;
    1.49      real_dstrect.w = renderer->viewport.w;
    1.50      real_dstrect.h = renderer->viewport.h;
    1.51 -    if (!SDL_IntersectRect(&clip_dstrect, &real_dstrect, &real_dstrect)) {
    1.52 -        return 0;
    1.53 -    }
    1.54 -    /* Clip srcrect by the same amount as dstrect was clipped */
    1.55 -    if (dstrect->w != real_dstrect.w) {
    1.56 -        int deltax = (real_dstrect.x - dstrect->x);
    1.57 -        int deltaw = (real_dstrect.w - dstrect->w);
    1.58 -        real_srcrect.x += (deltax * real_srcrect.w) / dstrect->w;
    1.59 -        real_srcrect.w += (deltaw * real_srcrect.w) / dstrect->w;
    1.60 -    }
    1.61 -    if (dstrect->h != real_dstrect.h) {
    1.62 -        int deltay = (real_dstrect.y - dstrect->y);
    1.63 -        int deltah = (real_dstrect.h - dstrect->h);
    1.64 -        real_srcrect.y += (deltay * real_srcrect.h) / dstrect->h;
    1.65 -        real_srcrect.h += (deltah * real_srcrect.h) / dstrect->h;
    1.66 +    if (dstrect) {
    1.67 +        if (!SDL_IntersectRect(dstrect, &real_dstrect, &real_dstrect)) {
    1.68 +            return 0;
    1.69 +        }
    1.70 +        /* Clip srcrect by the same amount as dstrect was clipped */
    1.71 +        if (dstrect->w != real_dstrect.w) {
    1.72 +            int deltax = (real_dstrect.x - dstrect->x);
    1.73 +            int deltaw = (real_dstrect.w - dstrect->w);
    1.74 +            real_srcrect.x += (deltax * real_srcrect.w) / dstrect->w;
    1.75 +            real_srcrect.w += (deltaw * real_srcrect.w) / dstrect->w;
    1.76 +        }
    1.77 +        if (dstrect->h != real_dstrect.h) {
    1.78 +            int deltay = (real_dstrect.y - dstrect->y);
    1.79 +            int deltah = (real_dstrect.h - dstrect->h);
    1.80 +            real_srcrect.y += (deltay * real_srcrect.h) / dstrect->h;
    1.81 +            real_srcrect.h += (deltah * real_srcrect.h) / dstrect->h;
    1.82 +        }
    1.83      }
    1.84  
    1.85      if (texture->native) {