src/video/SDL_surface.c
changeset 6527 c04879cd3b57
parent 6526 e9c3a540c52f
child 6663 2cbffb5aa19d
equal deleted inserted replaced
6526:e9c3a540c52f 6527:c04879cd3b57
   691     );
   691     );
   692 
   692 
   693     /* Save off the original dst width, height */
   693     /* Save off the original dst width, height */
   694     int dstW = dstrect->w;
   694     int dstW = dstrect->w;
   695     int dstH = dstrect->h;
   695     int dstH = dstrect->h;
       
   696     SDL_Rect full_rect;
   696     SDL_Rect final_dst = *dstrect;
   697     SDL_Rect final_dst = *dstrect;
   697     SDL_Rect final_src = *srcrect;
   698     SDL_Rect final_src = *srcrect;
   698 
   699 
   699     /* Clip the dst surface to the dstrect */
   700     /* Clip the dst surface to the dstrect */
   700     SDL_SetClipRect( dst, &final_dst );
   701     full_rect.x = 0;
       
   702     full_rect.y = 0;
       
   703     full_rect.w = dst->w;
       
   704     full_rect.h = dst->h;
       
   705     if (!SDL_IntersectRect(&final_dst, &full_rect, &final_dst)) {
       
   706         return 0;
       
   707     }
   701 
   708 
   702     /* Did the dst width change? */
   709     /* Did the dst width change? */
   703     if ( dstW != dst->clip_rect.w ) {
   710     if ( dstW != final_dst.w ) {
   704         /* scale the src width appropriately */
   711         /* scale the src width appropriately */
   705         final_src.w = final_src.w * dst->clip_rect.w / dstW;
   712         final_src.w = final_src.w * dst->clip_rect.w / dstW;
   706     }
   713     }
   707 
   714 
   708     /* Did the dst height change? */
   715     /* Did the dst height change? */
   709     if ( dstH != dst->clip_rect.h ) {
   716     if ( dstH != final_dst.h ) {
   710         /* scale the src width appropriately */
   717         /* scale the src width appropriately */
   711         final_src.h = final_src.h * dst->clip_rect.h / dstH;
   718         final_src.h = final_src.h * dst->clip_rect.h / dstH;
   712     }
   719     }
   713 
   720 
   714     /* Clip the src surface to the srcrect */
   721     /* Clip the src surface to the srcrect */
   715     SDL_SetClipRect( src, &final_src );
   722     full_rect.x = 0;
       
   723     full_rect.y = 0;
       
   724     full_rect.w = src->w;
       
   725     full_rect.h = src->h;
       
   726     if (!SDL_IntersectRect(&final_src, &full_rect, &final_src)) {
       
   727         return 0;
       
   728     }
   716 
   729 
   717     src->map->info.flags |= SDL_COPY_NEAREST;
   730     src->map->info.flags |= SDL_COPY_NEAREST;
   718 
   731 
   719     if ( !(src->map->info.flags & complex_copy_flags) &&
   732     if ( !(src->map->info.flags & complex_copy_flags) &&
   720          src->format->format == dst->format->format && 
   733          src->format->format == dst->format->format &&