Commit 5310d6d9 authored by Sam Lantinga's avatar Sam Lantinga

Fixed offset bug in hardware accelerated fills and blits

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40463
parent fae7d836
...@@ -399,6 +399,8 @@ int SDL_LowerBlit (SDL_Surface *src, SDL_Rect *srcrect, ...@@ -399,6 +399,8 @@ int SDL_LowerBlit (SDL_Surface *src, SDL_Rect *srcrect,
SDL_Surface *dst, SDL_Rect *dstrect) SDL_Surface *dst, SDL_Rect *dstrect)
{ {
SDL_blit do_blit; SDL_blit do_blit;
SDL_Rect hw_srcrect;
SDL_Rect hw_dstrect;
/* Check to make sure the blit mapping is valid */ /* Check to make sure the blit mapping is valid */
if ( (src->map->dst != dst) || if ( (src->map->dst != dst) ||
...@@ -410,6 +412,18 @@ int SDL_LowerBlit (SDL_Surface *src, SDL_Rect *srcrect, ...@@ -410,6 +412,18 @@ int SDL_LowerBlit (SDL_Surface *src, SDL_Rect *srcrect,
/* Figure out which blitter to use */ /* Figure out which blitter to use */
if ( (src->flags & SDL_HWACCEL) == SDL_HWACCEL ) { 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; do_blit = src->map->hw_blit;
} else { } else {
do_blit = src->map->sw_blit; do_blit = src->map->sw_blit;
...@@ -533,6 +547,13 @@ int SDL_FillRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color) ...@@ -533,6 +547,13 @@ int SDL_FillRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color)
/* Check for hardware acceleration */ /* Check for hardware acceleration */
if ( ((dst->flags & SDL_HWSURFACE) == SDL_HWSURFACE) && if ( ((dst->flags & SDL_HWSURFACE) == SDL_HWSURFACE) &&
video->info.blit_fill ) { 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)); return(video->FillHWRect(this, dst, dstrect, color));
} }
......
...@@ -793,10 +793,6 @@ static __inline__ void DGA_dst_to_xy(_THIS, SDL_Surface *dst, int *x, int *y) ...@@ -793,10 +793,6 @@ static __inline__ void DGA_dst_to_xy(_THIS, SDL_Surface *dst, int *x, int *y)
{ {
*x = (long)((Uint8 *)dst->pixels - memory_base)%memory_pitch; *x = (long)((Uint8 *)dst->pixels - memory_base)%memory_pitch;
*y = (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) static int DGA_FillHWRect(_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment