src/video/SDL_video.c
changeset 2908 aa6ba38c1714
parent 2901 133601e3b255
child 2909 3da0bb421d83
     1.1 --- a/src/video/SDL_video.c	Mon Dec 22 05:29:55 2008 +0000
     1.2 +++ b/src/video/SDL_video.c	Tue Dec 23 01:28:06 2008 +0000
     1.3 @@ -2155,6 +2155,7 @@
     1.4          return -1;
     1.5      }
     1.6      window = SDL_GetWindowFromID(renderer->window);
     1.7 +
     1.8      real_rect.x = 0;
     1.9      real_rect.y = 0;
    1.10      real_rect.w = window->w;
    1.11 @@ -2189,21 +2190,25 @@
    1.12          return -1;
    1.13      }
    1.14      window = SDL_GetWindowFromID(renderer->window);
    1.15 +
    1.16 +    real_srcrect.x = 0;
    1.17 +    real_srcrect.y = 0;
    1.18 +    real_srcrect.w = texture->w;
    1.19 +    real_srcrect.h = texture->h;
    1.20      if (srcrect) {
    1.21 -        real_srcrect = *srcrect;
    1.22 -    } else {
    1.23 -        real_srcrect.x = 0;
    1.24 -        real_srcrect.y = 0;
    1.25 -        real_srcrect.w = texture->w;
    1.26 -        real_srcrect.h = texture->h;
    1.27 +        if (!SDL_IntersectRect(srcrect, &real_srcrect, &real_srcrect)) {
    1.28 +            return 0;
    1.29 +        }
    1.30      }
    1.31 +
    1.32 +    real_dstrect.x = 0;
    1.33 +    real_dstrect.y = 0;
    1.34 +    real_dstrect.w = window->w;
    1.35 +    real_dstrect.h = window->h;
    1.36      if (dstrect) {
    1.37 -        real_dstrect = *dstrect;
    1.38 -    } else {
    1.39 -        real_dstrect.x = 0;
    1.40 -        real_dstrect.y = 0;
    1.41 -        real_dstrect.w = window->w;
    1.42 -        real_dstrect.h = window->h;
    1.43 +        if (!SDL_IntersectRect(dstrect, &real_dstrect, &real_dstrect)) {
    1.44 +            return 0;
    1.45 +        }
    1.46      }
    1.47  
    1.48      return renderer->RenderCopy(renderer, texture, &real_srcrect,