src/video/SDL_RLEaccel.c
changeset 526 4314a501d7be
parent 297 f6ffac90895c
child 689 5bb080d35049
     1.1 --- a/src/video/SDL_RLEaccel.c	Fri Oct 11 07:55:22 2002 +0000
     1.2 +++ b/src/video/SDL_RLEaccel.c	Fri Oct 11 07:56:36 2002 +0000
     1.3 @@ -463,10 +463,8 @@
     1.4  	unsigned alpha;
     1.5  
     1.6  	/* Lock the destination if necessary */
     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  			return(-1);
    1.14  		}
    1.15  	}
    1.16 @@ -474,7 +472,7 @@
    1.17  	/* Set up the source and destination pointers */
    1.18  	x = dstrect->x;
    1.19  	y = dstrect->y;
    1.20 -	dstbuf = (Uint8 *)dst->pixels + dst->offset
    1.21 +	dstbuf = (Uint8 *)dst->pixels
    1.22  	         + y * dst->pitch + x * src->format->BytesPerPixel;
    1.23  	srcbuf = (Uint8 *)src->map->sw_data->aux_data;
    1.24  
    1.25 @@ -553,10 +551,8 @@
    1.26  
    1.27  done:
    1.28  	/* Unlock the destination if necessary */
    1.29 -	if ( dst->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT) ) {
    1.30 -		SDL_VideoDevice *video = current_video;
    1.31 -		SDL_VideoDevice *this  = current_video;
    1.32 -		video->UnlockHWSurface(this, dst);
    1.33 +	if ( SDL_MUSTLOCK(dst) ) {
    1.34 +		SDL_UnlockSurface(dst);
    1.35  	}
    1.36  	return(0);
    1.37  }
    1.38 @@ -733,17 +729,15 @@
    1.39      SDL_PixelFormat *df = dst->format;
    1.40  
    1.41      /* Lock the destination if necessary */
    1.42 -    if(dst->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT)) {
    1.43 -	SDL_VideoDevice *video = current_video;
    1.44 -	SDL_VideoDevice *this  = current_video;
    1.45 -	if(video->LockHWSurface(this, dst) < 0) {
    1.46 +    if ( SDL_MUSTLOCK(dst) ) {
    1.47 +	if ( SDL_LockSurface(dst) < 0 ) {
    1.48  	    return -1;
    1.49  	}
    1.50      }
    1.51  
    1.52      x = dstrect->x;
    1.53      y = dstrect->y;
    1.54 -    dstbuf = (Uint8 *)dst->pixels + dst->offset
    1.55 +    dstbuf = (Uint8 *)dst->pixels
    1.56  	     + y * dst->pitch + x * df->BytesPerPixel;
    1.57      srcbuf = (Uint8 *)src->map->sw_data->aux_data + sizeof(RLEDestFormat);
    1.58  
    1.59 @@ -874,10 +868,8 @@
    1.60  
    1.61   done:
    1.62      /* Unlock the destination if necessary */
    1.63 -    if(dst->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT)) {
    1.64 -	SDL_VideoDevice *video = current_video;
    1.65 -	SDL_VideoDevice *this  = current_video;
    1.66 -	video->UnlockHWSurface(this, dst);
    1.67 +    if ( SDL_MUSTLOCK(dst) ) {
    1.68 +	SDL_UnlockSurface(dst);
    1.69      }
    1.70      return 0;
    1.71  }
    1.72 @@ -1117,7 +1109,7 @@
    1.73  	int x, y;
    1.74  	int h = surface->h, w = surface->w;
    1.75  	SDL_PixelFormat *sf = surface->format;
    1.76 -	Uint32 *src = (Uint32 *)((Uint8 *)surface->pixels + surface->offset);
    1.77 +	Uint32 *src = (Uint32 *)surface->pixels;
    1.78  	Uint8 *lastline = dst;	/* end of last non-blank line */
    1.79  
    1.80  	/* opaque counts are 8 or 16 bits, depending on target depth */
    1.81 @@ -1303,7 +1295,7 @@
    1.82  	}
    1.83  
    1.84  	/* Set up the conversion */
    1.85 -	srcbuf = (Uint8 *)surface->pixels+surface->offset;
    1.86 +	srcbuf = (Uint8 *)surface->pixels;
    1.87  	curbuf = srcbuf;
    1.88  	maxn = bpp == 4 ? 65535 : 255;
    1.89  	skip = run = 0;
    1.90 @@ -1409,10 +1401,8 @@
    1.91  	}
    1.92  
    1.93  	/* Lock the surface if it's in hardware */
    1.94 -	if ( surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT) ) {
    1.95 -		SDL_VideoDevice *video = current_video;
    1.96 -		SDL_VideoDevice *this  = current_video;
    1.97 -		if ( video->LockHWSurface(this, surface) < 0 ) {
    1.98 +	if ( SDL_MUSTLOCK(surface) ) {
    1.99 +		if ( SDL_LockSurface(surface) < 0 ) {
   1.100  			return(-1);
   1.101  		}
   1.102  	}
   1.103 @@ -1429,10 +1419,8 @@
   1.104  	}
   1.105  
   1.106  	/* Unlock the surface if it's in hardware */
   1.107 -	if ( surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT) ) {
   1.108 -		SDL_VideoDevice *video = current_video;
   1.109 -		SDL_VideoDevice *this  = current_video;
   1.110 -		video->UnlockHWSurface(this, surface);
   1.111 +	if ( SDL_MUSTLOCK(surface) ) {
   1.112 +		SDL_UnlockSurface(surface);
   1.113  	}
   1.114  
   1.115  	if(retcode < 0)