Mercurial > sdl-ios-xcode
comparison src/video/gem/SDL_gemvideo.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 | 75e8378103a9 |
children | 5dbcac12f22b |
comparison
equal
deleted
inserted
replaced
1070:75e8378103a9 | 1071:24470ffe8ee4 |
---|---|
775 if (use_shadow1) { | 775 if (use_shadow1) { |
776 current->pixels = GEM_buffer1; | 776 current->pixels = GEM_buffer1; |
777 current->pitch = width * VDI_pixelsize; | 777 current->pitch = width * VDI_pixelsize; |
778 } else { | 778 } else { |
779 current->pixels = VDI_screen; | 779 current->pixels = VDI_screen; |
780 current->pixels += VDI_pitch * ((VDI_h - height) >> 1); | |
781 current->pixels += VDI_pixelsize * ((VDI_w - width) >> 1); | |
782 current->pitch = VDI_pitch; | 780 current->pitch = VDI_pitch; |
783 } | 781 } |
784 | 782 |
785 #ifdef HAVE_OPENGL | 783 #ifdef HAVE_OPENGL |
786 if (flags & SDL_OPENGL) { | 784 if (flags & SDL_OPENGL) { |
842 if (GEM_bufops & (B2S_C2P_1TO2|B2S_C2P_1TOS)) { | 840 if (GEM_bufops & (B2S_C2P_1TO2|B2S_C2P_1TOS)) { |
843 void *destscr; | 841 void *destscr; |
844 int destpitch; | 842 int destpitch; |
845 | 843 |
846 if (GEM_bufops & B2S_C2P_1TOS) { | 844 if (GEM_bufops & B2S_C2P_1TOS) { |
847 int destx; | |
848 | |
849 destscr = VDI_screen; | 845 destscr = VDI_screen; |
850 destscr += VDI_pitch * ((VDI_h - surface->h) >> 1); | |
851 destx = (VDI_w - surf_width) >> 1; | |
852 destx &= ~15; | |
853 destscr += destx; | |
854 destpitch = VDI_pitch; | 846 destpitch = VDI_pitch; |
855 } else { | 847 } else { |
856 destscr = GEM_buffer2; | 848 destscr = GEM_buffer2; |
857 destpitch = surface->pitch; | 849 destpitch = surface->pitch; |
858 } | 850 } |
900 if (GEM_bufops & B2S_VROCPYFM_2TOS) { | 892 if (GEM_bufops & B2S_VROCPYFM_2TOS) { |
901 mfdb_src.fd_addr=GEM_buffer2; | 893 mfdb_src.fd_addr=GEM_buffer2; |
902 } | 894 } |
903 | 895 |
904 for ( i=0; i<numrects; ++i ) { | 896 for ( i=0; i<numrects; ++i ) { |
905 blitcoords[0] = rects[i].x; | 897 blitcoords[0] = blitcoords[4] = rects[i].x; |
906 blitcoords[1] = rects[i].y; | 898 blitcoords[1] = blitcoords[5] = rects[i].y; |
907 blitcoords[2] = blitcoords[0] + rects[i].w - 1; | 899 blitcoords[2] = blitcoords[6] = rects[i].x + rects[i].w - 1; |
908 blitcoords[3] = blitcoords[1] + rects[i].h - 1; | 900 blitcoords[3] = blitcoords[7] = rects[i].y + rects[i].h - 1; |
909 | |
910 blitcoords[4] = rects[i].x + ((VDI_w - surface->w) >> 1); | |
911 blitcoords[5] = rects[i].y + ((VDI_h - surface->h) >> 1); | |
912 blitcoords[6] = blitcoords[4] + rects[i].w - 1; | |
913 blitcoords[7] = blitcoords[5] + rects[i].h - 1; | |
914 | 901 |
915 vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb); | 902 vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb); |
916 } | 903 } |
917 } | 904 } |
918 } | 905 } |
966 if (GEM_bufops & (B2S_C2P_1TO2|B2S_C2P_1TOS)) { | 953 if (GEM_bufops & (B2S_C2P_1TO2|B2S_C2P_1TOS)) { |
967 void *destscr; | 954 void *destscr; |
968 int destpitch; | 955 int destpitch; |
969 | 956 |
970 if (GEM_bufops & B2S_C2P_1TOS) { | 957 if (GEM_bufops & B2S_C2P_1TOS) { |
971 int destx; | |
972 | |
973 destscr = VDI_screen; | 958 destscr = VDI_screen; |
974 destscr += VDI_pitch * ((VDI_h - surface->h) >> 1); | |
975 destx = (VDI_w - surf_width) >> 1; | |
976 destx &= ~15; | |
977 destscr += destx; | |
978 destpitch = VDI_pitch; | 959 destpitch = VDI_pitch; |
979 } else { | 960 } else { |
980 destscr = GEM_buffer2; | 961 destscr = GEM_buffer2; |
981 destpitch = surface->pitch; | 962 destpitch = surface->pitch; |
982 } | 963 } |
1005 mfdb_src.fd_addr=surface->pixels; | 986 mfdb_src.fd_addr=surface->pixels; |
1006 } else { | 987 } else { |
1007 mfdb_src.fd_addr=GEM_buffer2; | 988 mfdb_src.fd_addr=GEM_buffer2; |
1008 } | 989 } |
1009 | 990 |
1010 blitcoords[0] = 0; | 991 blitcoords[0] = blitcoords[4] = 0; |
1011 blitcoords[1] = 0; | 992 blitcoords[1] = blitcoords[5] = 0; |
1012 blitcoords[2] = surface->w - 1; | 993 blitcoords[2] = blitcoords[6] = surface->w - 1; |
1013 blitcoords[3] = surface->h - 1; | 994 blitcoords[3] = blitcoords[7] = surface->h - 1; |
1014 | |
1015 blitcoords[4] = (VDI_w - surface->w) >> 1; | |
1016 blitcoords[5] = (VDI_h - surface->h) >> 1; | |
1017 blitcoords[6] = blitcoords[4] + surface->w - 1; | |
1018 blitcoords[7] = blitcoords[5] + surface->h - 1; | |
1019 | 995 |
1020 vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb); | 996 vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb); |
1021 } | 997 } |
1022 | 998 |
1023 return(0); | 999 return(0); |