@@ -653,10 +653,10 @@ SDL_Surface * SDL::zoomSurface(SDL_Surface *src_surface, SDL_Rect *src_rect_orig
653653
654654 /* Create dst surface */
655655 dst_surface = SDL_CreateRGBSurface (src_surface->flags ,
656- post_cropping_rect->w , post_cropping_rect->h ,
657- src_surface->format ->BitsPerPixel ,
658- src_surface->format ->Rmask , src_surface->format ->Gmask ,
659- src_surface->format ->Bmask , src_surface->format ->Amask );
656+ post_cropping_rect->w , post_cropping_rect->h ,
657+ src_surface->format ->BitsPerPixel ,
658+ src_surface->format ->Rmask , src_surface->format ->Gmask ,
659+ src_surface->format ->Bmask , src_surface->format ->Amask );
660660 if (dst_surface == NULL ){
661661 printf (" ERROR in %s, cannot create dst_surface for post cropping: %s\n " , __func__, SDL_GetError ());
662662 dst_surface = prev_dst_surface;
@@ -668,8 +668,20 @@ SDL_Surface * SDL::zoomSurface(SDL_Surface *src_surface, SDL_Rect *src_rect_orig
668668 post_cropping_rect->x, post_cropping_rect->y, post_cropping_rect->w, post_cropping_rect->h);*/
669669
670670 /* Copy cropped surface */
671- if (SDL_BlitSurface (prev_dst_surface, post_cropping_rect, dst_surface, NULL )){
671+ /* if(SDL_BlitSurface(prev_dst_surface, post_cropping_rect, dst_surface, NULL)){
672672 printf("ERROR in %s, cannot blit previous dst_surface for post cropping: %s\n", __func__, SDL_GetError());
673+ }*/
674+ for (i = 0 ; i < dst_surface->h ; i++)
675+ {
676+
677+ /* Get current lines in src and dst surfaces */
678+ uint8_t * t = ( (uint8_t *) dst_surface->pixels + i*dst_surface->w *dst_surface->format ->BytesPerPixel );
679+ uint8_t * p = ( (uint8_t *) prev_dst_surface->pixels +
680+ (i+post_cropping_rect->y )*prev_dst_surface->w *prev_dst_surface->format ->BytesPerPixel +
681+ post_cropping_rect->x *prev_dst_surface->format ->BytesPerPixel );
682+
683+ /* Copy src pixel in dst surface */
684+ memcpy (t, p, dst_surface->w *dst_surface->format ->BytesPerPixel );
673685 }
674686
675687 /* Free previous surface */
0 commit comments