# HG changeset patch # User Sam Lantinga # Date 1029862729 0 # Node ID 1be0cdaf80928ed8664d8bb2c9dd68461712e2ef # Parent 1d36f593078a5519bd58b91c6b051bd2e99e89e7 Fixed offset bug in hardware accelerated fills and blits diff -r 1d36f593078a -r 1be0cdaf8092 src/video/SDL_surface.c --- a/src/video/SDL_surface.c Tue Aug 20 06:08:42 2002 +0000 +++ b/src/video/SDL_surface.c Tue Aug 20 16:58:49 2002 +0000 @@ -399,6 +399,8 @@ SDL_Surface *dst, SDL_Rect *dstrect) { SDL_blit do_blit; + SDL_Rect hw_srcrect; + SDL_Rect hw_dstrect; /* Check to make sure the blit mapping is valid */ if ( (src->map->dst != dst) || @@ -410,6 +412,18 @@ /* Figure out which blitter to use */ if ( (src->flags & SDL_HWACCEL) == SDL_HWACCEL ) { + if ( src == SDL_VideoSurface ) { + hw_srcrect = *dstrect; + hw_srcrect.x += current_video->offset_x; + hw_srcrect.y += current_video->offset_y; + srcrect = &hw_srcrect; + } + if ( dst == SDL_VideoSurface ) { + hw_dstrect = *dstrect; + hw_dstrect.x += current_video->offset_x; + hw_dstrect.y += current_video->offset_y; + dstrect = &hw_dstrect; + } do_blit = src->map->hw_blit; } else { do_blit = src->map->sw_blit; @@ -533,6 +547,13 @@ /* Check for hardware acceleration */ if ( ((dst->flags & SDL_HWSURFACE) == SDL_HWSURFACE) && video->info.blit_fill ) { + SDL_Rect hw_rect; + if ( dst == SDL_VideoSurface ) { + hw_rect = *dstrect; + hw_rect.x += current_video->offset_x; + hw_rect.y += current_video->offset_y; + dstrect = &hw_rect; + } return(video->FillHWRect(this, dst, dstrect, color)); } diff -r 1d36f593078a -r 1be0cdaf8092 src/video/dga/SDL_dgavideo.c --- a/src/video/dga/SDL_dgavideo.c Tue Aug 20 06:08:42 2002 +0000 +++ b/src/video/dga/SDL_dgavideo.c Tue Aug 20 16:58:49 2002 +0000 @@ -793,10 +793,6 @@ { *x = (long)((Uint8 *)dst->pixels - memory_base)%memory_pitch; *y = (long)((Uint8 *)dst->pixels - memory_base)/memory_pitch; - if ( dst == this->screen ) { - *x += this->offset_x; - *y += this->offset_y; - } } static int DGA_FillHWRect(_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color)