Fixed offset bug in hardware accelerated fills and blits
authorSam Lantinga <slouken@libsdl.org>
Tue, 20 Aug 2002 16:58:49 +0000
changeset 4621be0cdaf8092
parent 461 1d36f593078a
child 463 bf7389310d27
Fixed offset bug in hardware accelerated fills and blits
src/video/SDL_surface.c
src/video/dga/SDL_dgavideo.c
     1.1 --- a/src/video/SDL_surface.c	Tue Aug 20 06:08:42 2002 +0000
     1.2 +++ b/src/video/SDL_surface.c	Tue Aug 20 16:58:49 2002 +0000
     1.3 @@ -399,6 +399,8 @@
     1.4  				SDL_Surface *dst, SDL_Rect *dstrect)
     1.5  {
     1.6  	SDL_blit do_blit;
     1.7 +	SDL_Rect hw_srcrect;
     1.8 +	SDL_Rect hw_dstrect;
     1.9  
    1.10  	/* Check to make sure the blit mapping is valid */
    1.11  	if ( (src->map->dst != dst) ||
    1.12 @@ -410,6 +412,18 @@
    1.13  
    1.14  	/* Figure out which blitter to use */
    1.15  	if ( (src->flags & SDL_HWACCEL) == SDL_HWACCEL ) {
    1.16 +		if ( src == SDL_VideoSurface ) {
    1.17 +			hw_srcrect = *dstrect;
    1.18 +			hw_srcrect.x += current_video->offset_x;
    1.19 +			hw_srcrect.y += current_video->offset_y;
    1.20 +			srcrect = &hw_srcrect;
    1.21 +		}
    1.22 +		if ( dst == SDL_VideoSurface ) {
    1.23 +			hw_dstrect = *dstrect;
    1.24 +			hw_dstrect.x += current_video->offset_x;
    1.25 +			hw_dstrect.y += current_video->offset_y;
    1.26 +			dstrect = &hw_dstrect;
    1.27 +		}
    1.28  		do_blit = src->map->hw_blit;
    1.29  	} else {
    1.30  		do_blit = src->map->sw_blit;
    1.31 @@ -533,6 +547,13 @@
    1.32  	/* Check for hardware acceleration */
    1.33  	if ( ((dst->flags & SDL_HWSURFACE) == SDL_HWSURFACE) &&
    1.34  					video->info.blit_fill ) {
    1.35 +		SDL_Rect hw_rect;
    1.36 +		if ( dst == SDL_VideoSurface ) {
    1.37 +			hw_rect = *dstrect;
    1.38 +			hw_rect.x += current_video->offset_x;
    1.39 +			hw_rect.y += current_video->offset_y;
    1.40 +			dstrect = &hw_rect;
    1.41 +		}
    1.42  		return(video->FillHWRect(this, dst, dstrect, color));
    1.43  	}
    1.44  
     2.1 --- a/src/video/dga/SDL_dgavideo.c	Tue Aug 20 06:08:42 2002 +0000
     2.2 +++ b/src/video/dga/SDL_dgavideo.c	Tue Aug 20 16:58:49 2002 +0000
     2.3 @@ -793,10 +793,6 @@
     2.4  {
     2.5  	*x = (long)((Uint8 *)dst->pixels - memory_base)%memory_pitch;
     2.6  	*y = (long)((Uint8 *)dst->pixels - memory_base)/memory_pitch;
     2.7 -	if ( dst == this->screen ) {
     2.8 -		*x += this->offset_x;
     2.9 -		*y += this->offset_y;
    2.10 -	}
    2.11  }
    2.12  
    2.13  static int DGA_FillHWRect(_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color)