Mercurial > sdl-ios-xcode
comparison src/video/xbios/SDL_xbios.c @ 1071:24470ffe8ee4
SDL will center surface on screen for us
author | Patrice Mandin <patmandin@gmail.com> |
---|---|
date | Mon, 06 Jun 2005 16:36:18 +0000 |
parents | fba6b67b4d60 |
children | b0887c870403 |
comparison
equal
deleted
inserted
replaced
1070:75e8378103a9 | 1071:24470ffe8ee4 |
---|---|
725 SDL_Surface *surface; | 725 SDL_Surface *surface; |
726 | 726 |
727 surface = this->screen; | 727 surface = this->screen; |
728 | 728 |
729 if ((surface->format->BitsPerPixel) == 8) { | 729 if ((surface->format->BitsPerPixel) == 8) { |
730 void *destscr; | |
731 int destx; | |
732 int i; | 730 int i; |
733 | |
734 /* Center on destination screen */ | |
735 destscr = XBIOS_screens[XBIOS_fbnum]; | |
736 destscr += XBIOS_pitch * ((XBIOS_height - surface->h) >> 1); | |
737 destx = (XBIOS_width - surface->w) >> 1; | |
738 destx &= ~15; | |
739 destscr += destx; | |
740 | 731 |
741 for (i=0;i<numrects;i++) { | 732 for (i=0;i<numrects;i++) { |
742 void *source,*destination; | 733 void *source,*destination; |
743 int x1,x2; | 734 int x1,x2; |
744 | 735 |
750 | 741 |
751 source = surface->pixels; | 742 source = surface->pixels; |
752 source += surface->pitch * rects[i].y; | 743 source += surface->pitch * rects[i].y; |
753 source += x1; | 744 source += x1; |
754 | 745 |
755 destination = destscr; | 746 destination = XBIOS_screens[XBIOS_fbnum]; |
756 destination += XBIOS_pitch * rects[i].y; | 747 destination += XBIOS_pitch * rects[i].y; |
757 destination += x1; | 748 destination += x1; |
758 | 749 |
759 /* Convert chunky to planar screen */ | 750 /* Convert chunky to planar screen */ |
760 SDL_Atari_C2pConvert( | 751 SDL_Atari_C2pConvert( |
761 source, | 752 source, destination, |
762 destination, | 753 x2-x1, rects[i].h, |
763 x2-x1, | |
764 rects[i].h, | |
765 XBIOS_doubleline, | 754 XBIOS_doubleline, |
766 surface->pitch, | 755 surface->pitch, XBIOS_pitch |
767 XBIOS_pitch | |
768 ); | 756 ); |
769 } | 757 } |
770 } | 758 } |
771 | 759 |
772 #ifndef DEBUG_VIDEO_XBIOS | 760 #ifndef DEBUG_VIDEO_XBIOS |
783 } | 771 } |
784 | 772 |
785 static int XBIOS_FlipHWSurface(_THIS, SDL_Surface *surface) | 773 static int XBIOS_FlipHWSurface(_THIS, SDL_Surface *surface) |
786 { | 774 { |
787 if ((surface->format->BitsPerPixel) == 8) { | 775 if ((surface->format->BitsPerPixel) == 8) { |
788 void *destscr; | |
789 int destx; | |
790 | |
791 /* Center on destination screen */ | |
792 destscr = XBIOS_screens[XBIOS_fbnum]; | |
793 destscr += XBIOS_pitch * ((XBIOS_height - surface->h) >> 1); | |
794 destx = (XBIOS_width - surface->w) >> 1; | |
795 destx &= ~15; | |
796 destscr += destx; | |
797 | |
798 /* Convert chunky to planar screen */ | 776 /* Convert chunky to planar screen */ |
799 SDL_Atari_C2pConvert( | 777 SDL_Atari_C2pConvert( |
800 surface->pixels, | 778 surface->pixels, XBIOS_screens[XBIOS_fbnum], |
801 destscr, | 779 surface->w, surface->h, |
802 surface->w, | |
803 surface->h, | |
804 XBIOS_doubleline, | 780 XBIOS_doubleline, |
805 surface->pitch, | 781 surface->pitch, XBIOS_pitch |
806 XBIOS_pitch | |
807 ); | 782 ); |
808 } | 783 } |
809 | 784 |
810 #ifndef DEBUG_VIDEO_XBIOS | 785 #ifndef DEBUG_VIDEO_XBIOS |
811 Setscreen(-1,XBIOS_screens[XBIOS_fbnum],-1); | 786 Setscreen(-1,XBIOS_screens[XBIOS_fbnum],-1); |