src/video/SDL_video.c
changeset 2912 1d50666ed3d5
parent 2910 27d8b12e0e8e
child 2918 bd518fc76f28
     1.1 --- a/src/video/SDL_video.c	Tue Dec 23 02:39:03 2008 +0000
     1.2 +++ b/src/video/SDL_video.c	Tue Dec 23 04:51:36 2008 +0000
     1.3 @@ -2205,6 +2205,19 @@
     1.4          if (!SDL_IntersectRect(dstrect, &real_dstrect, &real_dstrect)) {
     1.5              return 0;
     1.6          }
     1.7 +        /* Clip srcrect by the same amount as dstrect was clipped */
     1.8 +        if (dstrect->w != real_dstrect.w) {
     1.9 +            int deltax = (real_dstrect.x - dstrect->x);
    1.10 +            int deltaw = (real_dstrect.w - dstrect->w);
    1.11 +            real_srcrect.x += (deltax * dstrect->w) / real_srcrect.w;
    1.12 +            real_srcrect.w += (deltaw * dstrect->w) / real_srcrect.w;
    1.13 +        }
    1.14 +        if (dstrect->h != real_dstrect.h) {
    1.15 +            int deltay = (real_dstrect.y - dstrect->y);
    1.16 +            int deltah = (real_dstrect.h - dstrect->h);
    1.17 +            real_srcrect.y += (deltay * dstrect->h) / real_srcrect.h;
    1.18 +            real_srcrect.h += (deltah * dstrect->h) / real_srcrect.h;
    1.19 +        }
    1.20      }
    1.21  
    1.22      return renderer->RenderCopy(renderer, texture, &real_srcrect,