src/video/SDL_blit.c
changeset 526 4314a501d7be
parent 310 c97c1d3b3b5c
child 689 5bb080d35049
     1.1 --- a/src/video/SDL_blit.c	Fri Oct 11 07:55:22 2002 +0000
     1.2 +++ b/src/video/SDL_blit.c	Fri Oct 11 07:56:36 2002 +0000
     1.3 @@ -50,10 +50,8 @@
     1.4  
     1.5  	/* Lock the destination if it's in hardware */
     1.6  	dst_locked = 0;
     1.7 -	if ( dst->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT) ) {
     1.8 -		SDL_VideoDevice *video = current_video;
     1.9 -		SDL_VideoDevice *this  = current_video;
    1.10 -		if ( video->LockHWSurface(this, dst) < 0 ) {
    1.11 +	if ( SDL_MUSTLOCK(dst) ) {
    1.12 +		if ( SDL_LockSurface(dst) < 0 ) {
    1.13  			okay = 0;
    1.14  		} else {
    1.15  			dst_locked = 1;
    1.16 @@ -61,35 +59,27 @@
    1.17  	}
    1.18  	/* Lock the source if it's in hardware */
    1.19  	src_locked = 0;
    1.20 -	if ( src->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT) ) {
    1.21 -		SDL_VideoDevice *video = current_video;
    1.22 -		SDL_VideoDevice *this  = current_video;
    1.23 -		if ( video->LockHWSurface(this, src) < 0 ) {
    1.24 +	if ( SDL_MUSTLOCK(src) ) {
    1.25 +		if ( SDL_LockSurface(src) < 0 ) {
    1.26  			okay = 0;
    1.27  		} else {
    1.28  			src_locked = 1;
    1.29  		}
    1.30  	}
    1.31  
    1.32 -	/* Unencode the destination if it's RLE encoded */
    1.33 -	if ( dst->flags & SDL_RLEACCEL ) {
    1.34 -		SDL_UnRLESurface(dst, 1);
    1.35 -		dst->flags |= SDL_RLEACCEL;	/* save accel'd state */
    1.36 -	}
    1.37 -
    1.38  	/* Set up source and destination buffer pointers, and BLIT! */
    1.39  	if ( okay  && srcrect->w && srcrect->h ) {
    1.40  		SDL_BlitInfo info;
    1.41  		SDL_loblit RunBlit;
    1.42  
    1.43  		/* Set up the blit information */
    1.44 -		info.s_pixels = (Uint8 *)src->pixels + src->offset +
    1.45 +		info.s_pixels = (Uint8 *)src->pixels +
    1.46  				(Uint16)srcrect->y*src->pitch +
    1.47  				(Uint16)srcrect->x*src->format->BytesPerPixel;
    1.48  		info.s_width = srcrect->w;
    1.49  		info.s_height = srcrect->h;
    1.50  		info.s_skip=src->pitch-info.s_width*src->format->BytesPerPixel;
    1.51 -		info.d_pixels = (Uint8 *)dst->pixels + dst->offset +
    1.52 +		info.d_pixels = (Uint8 *)dst->pixels +
    1.53  				(Uint16)dstrect->y*dst->pitch +
    1.54  				(Uint16)dstrect->x*dst->format->BytesPerPixel;
    1.55  		info.d_width = dstrect->w;
    1.56 @@ -105,22 +95,12 @@
    1.57  		RunBlit(&info);
    1.58  	}
    1.59  
    1.60 -	/* Re-encode the destination if it's RLE encoded */
    1.61 -	if ( dst->flags & SDL_RLEACCEL ) {
    1.62 -	        dst->flags &= ~SDL_RLEACCEL; /* stop lying */
    1.63 -		SDL_RLESurface(dst);
    1.64 -	}
    1.65 -
    1.66  	/* We need to unlock the surfaces if they're locked */
    1.67  	if ( dst_locked ) {
    1.68 -		SDL_VideoDevice *video = current_video;
    1.69 -		SDL_VideoDevice *this  = current_video;
    1.70 -		video->UnlockHWSurface(this, dst);
    1.71 +		SDL_UnlockSurface(dst);
    1.72  	}
    1.73  	if ( src_locked ) {
    1.74 -		SDL_VideoDevice *video = current_video;
    1.75 -		SDL_VideoDevice *this  = current_video;
    1.76 -		video->UnlockHWSurface(this, src);
    1.77 +		SDL_UnlockSurface(src);
    1.78  	}
    1.79  	/* Blit is done! */
    1.80  	return(okay ? 0 : -1);