Mercurial > sdl-ios-xcode
comparison src/video/SDL_surface.c @ 462:1be0cdaf8092
Fixed offset bug in hardware accelerated fills and blits
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 20 Aug 2002 16:58:49 +0000 |
parents | 598b25b9bffe |
children | c7da0cd5ae5e |
comparison
equal
deleted
inserted
replaced
461:1d36f593078a | 462:1be0cdaf8092 |
---|---|
397 */ | 397 */ |
398 int SDL_LowerBlit (SDL_Surface *src, SDL_Rect *srcrect, | 398 int SDL_LowerBlit (SDL_Surface *src, SDL_Rect *srcrect, |
399 SDL_Surface *dst, SDL_Rect *dstrect) | 399 SDL_Surface *dst, SDL_Rect *dstrect) |
400 { | 400 { |
401 SDL_blit do_blit; | 401 SDL_blit do_blit; |
402 SDL_Rect hw_srcrect; | |
403 SDL_Rect hw_dstrect; | |
402 | 404 |
403 /* Check to make sure the blit mapping is valid */ | 405 /* Check to make sure the blit mapping is valid */ |
404 if ( (src->map->dst != dst) || | 406 if ( (src->map->dst != dst) || |
405 (src->map->dst->format_version != src->map->format_version) ) { | 407 (src->map->dst->format_version != src->map->format_version) ) { |
406 if ( SDL_MapSurface(src, dst) < 0 ) { | 408 if ( SDL_MapSurface(src, dst) < 0 ) { |
408 } | 410 } |
409 } | 411 } |
410 | 412 |
411 /* Figure out which blitter to use */ | 413 /* Figure out which blitter to use */ |
412 if ( (src->flags & SDL_HWACCEL) == SDL_HWACCEL ) { | 414 if ( (src->flags & SDL_HWACCEL) == SDL_HWACCEL ) { |
415 if ( src == SDL_VideoSurface ) { | |
416 hw_srcrect = *dstrect; | |
417 hw_srcrect.x += current_video->offset_x; | |
418 hw_srcrect.y += current_video->offset_y; | |
419 srcrect = &hw_srcrect; | |
420 } | |
421 if ( dst == SDL_VideoSurface ) { | |
422 hw_dstrect = *dstrect; | |
423 hw_dstrect.x += current_video->offset_x; | |
424 hw_dstrect.y += current_video->offset_y; | |
425 dstrect = &hw_dstrect; | |
426 } | |
413 do_blit = src->map->hw_blit; | 427 do_blit = src->map->hw_blit; |
414 } else { | 428 } else { |
415 do_blit = src->map->sw_blit; | 429 do_blit = src->map->sw_blit; |
416 } | 430 } |
417 return(do_blit(src, srcrect, dst, dstrect)); | 431 return(do_blit(src, srcrect, dst, dstrect)); |
531 } | 545 } |
532 | 546 |
533 /* Check for hardware acceleration */ | 547 /* Check for hardware acceleration */ |
534 if ( ((dst->flags & SDL_HWSURFACE) == SDL_HWSURFACE) && | 548 if ( ((dst->flags & SDL_HWSURFACE) == SDL_HWSURFACE) && |
535 video->info.blit_fill ) { | 549 video->info.blit_fill ) { |
550 SDL_Rect hw_rect; | |
551 if ( dst == SDL_VideoSurface ) { | |
552 hw_rect = *dstrect; | |
553 hw_rect.x += current_video->offset_x; | |
554 hw_rect.y += current_video->offset_y; | |
555 dstrect = &hw_rect; | |
556 } | |
536 return(video->FillHWRect(this, dst, dstrect, color)); | 557 return(video->FillHWRect(this, dst, dstrect, color)); |
537 } | 558 } |
538 | 559 |
539 /* Perform software fill */ | 560 /* Perform software fill */ |
540 if ( SDL_LockSurface(dst) != 0 ) { | 561 if ( SDL_LockSurface(dst) != 0 ) { |