Ticket #9019: 16bit_step1_r3.patch
File 16bit_step1_r3.patch, 7.9 KB (added by , 15 years ago) |
---|
-
backends/platform/sdl/graphics.cpp
407 407 } 408 408 } 409 409 410 #ifdef ENABLE_16BIT 410 411 // 412 // Create the surface that contains the 16 bit game data 413 // 414 _screen16 = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth, _videoMode.screenHeight, 415 16, 416 0x7C00, 417 0x3E0, 418 0x1F, 419 0); //555, not 565 420 if (_screen16 == NULL) 421 error("allocating _screen16 failed"); 422 #endif 423 424 // 411 425 // Create the surface used for the graphics in 16 bit before scaling, and also the overlay 412 426 // 413 427 … … 484 498 } 485 499 486 500 void OSystem_SDL::unloadGFXMode() { 501 #ifdef ENABLE_16BIT 502 if (_screen16) { 503 SDL_FreeSurface(_screen16); 504 _screen16 = NULL; 505 } 506 #else 487 507 if (_screen) { 488 508 SDL_FreeSurface(_screen); 489 509 _screen = NULL; 490 510 } 511 #endif 491 512 492 513 if (_hwscreen) { 493 514 SDL_FreeSurface(_hwscreen); … … 519 540 } 520 541 521 542 bool OSystem_SDL::hotswapGFXMode() { 543 #ifdef ENABLE_16BIT 544 if (!_screen16) 545 #else 522 546 if (!_screen) 547 #endif 523 548 return false; 524 549 525 550 // Keep around the old _screen & _overlayscreen so we can restore the screen data 526 551 // after the mode switch. 552 #ifdef ENABLE_16BIT 553 SDL_Surface *old_screen = _screen16; 554 _screen16 = NULL; 555 #else 527 556 SDL_Surface *old_screen = _screen; 557 _screen = NULL; 558 #endif 528 559 SDL_Surface *old_overlayscreen = _overlayscreen; 529 _screen = NULL;530 560 _overlayscreen = NULL; 531 561 532 562 // Release the HW screen surface … … 544 574 if (!loadGFXMode()) { 545 575 unloadGFXMode(); 546 576 577 #ifdef ENABLE_16BIT 578 _screen16 = old_screen; 579 #else 547 580 _screen = old_screen; 581 #endif 548 582 _overlayscreen = old_overlayscreen; 549 583 550 584 return false; … … 554 588 SDL_SetColors(_screen, _currentPalette, 0, 256); 555 589 556 590 // Restore old screen content 591 #ifdef ENABLE_16BIT 592 SDL_BlitSurface(old_screen, NULL, _screen16, NULL); 593 #else 557 594 SDL_BlitSurface(old_screen, NULL, _screen, NULL); 595 #endif 558 596 SDL_BlitSurface(old_overlayscreen, NULL, _overlayscreen, NULL); 559 597 560 598 // Free the old surfaces … … 636 674 #endif 637 675 638 676 if (!_overlayVisible) { 677 #ifdef ENABLE_16BIT 678 origSurf = _screen16; 679 #else 639 680 origSurf = _screen; 681 #endif 640 682 srcSurf = _tmpscreen; 641 683 width = _videoMode.screenWidth; 642 684 height = _videoMode.screenHeight; … … 781 823 assert (_transactionMode == kTransactionNone); 782 824 assert(src); 783 825 826 #ifdef ENABLE_16BIT 827 if (_screen16 == NULL) { 828 warning("OSystem_SDL::copyRectToScreen: _screen16 == NULL"); 829 return; 830 } 831 #endif 784 832 if (_screen == NULL) { 785 833 warning("OSystem_SDL::copyRectToScreen: _screen == NULL"); 786 834 return; … … 829 877 } 830 878 831 879 // Try to lock the screen surface 880 #ifdef ENABLE_16BIT 881 if (SDL_LockSurface(_screen16) == -1) 882 #else 832 883 if (SDL_LockSurface(_screen) == -1) 884 #endif 833 885 error("SDL_LockSurface failed: %s", SDL_GetError()); 834 886 887 #ifdef ENABLE_16BIT 888 byte *dst = (byte *)_screen16->pixels + y * _videoMode.screenWidth * 2 + x * 2; 889 if (_videoMode.screenWidth == w && pitch == w * 2) { 890 memcpy(dst, src, h*w*2); 891 } else { 892 do { 893 memcpy(dst, src, w * 2); 894 src += pitch; 895 dst += _videoMode.screenWidth * 2; 896 } while (--h); 897 } 898 899 // Unlock the screen surface 900 SDL_UnlockSurface(_screen16); 901 #else 835 902 byte *dst = (byte *)_screen->pixels + y * _videoMode.screenWidth + x; 836 837 903 if (_videoMode.screenWidth == pitch && pitch == w) { 838 904 memcpy(dst, src, h*w); 839 905 } else { … … 846 912 847 913 // Unlock the screen surface 848 914 SDL_UnlockSurface(_screen); 915 #endif 849 916 } 850 917 851 918 Graphics::Surface *OSystem_SDL::lockScreen() { … … 859 926 _screenIsLocked = true; 860 927 861 928 // Try to lock the screen surface 929 #ifdef ENABLE_16BIT 930 if (SDL_LockSurface(_screen16) == -1) 931 #else 862 932 if (SDL_LockSurface(_screen) == -1) 933 #endif 863 934 error("SDL_LockSurface failed: %s", SDL_GetError()); 864 935 936 #ifdef ENABLE_16BIT 937 _framebuffer.pixels = _screen16->pixels; 938 _framebuffer.w = _screen16->w; 939 _framebuffer.h = _screen16->h; 940 _framebuffer.pitch = _screen16->pitch; 941 _framebuffer.bytesPerPixel = 2; 942 #else 865 943 _framebuffer.pixels = _screen->pixels; 866 944 _framebuffer.w = _screen->w; 867 945 _framebuffer.h = _screen->h; 868 946 _framebuffer.pitch = _screen->pitch; 869 947 _framebuffer.bytesPerPixel = 1; 948 #endif 870 949 871 950 return &_framebuffer; 872 951 } … … 879 958 _screenIsLocked = false; 880 959 881 960 // Unlock the screen surface 961 #ifdef ENABLE_16BIT 962 SDL_UnlockSurface(_screen16); 963 #else 882 964 SDL_UnlockSurface(_screen); 965 #endif 883 966 884 967 // Trigger a full screen update 885 968 _forceFull = true; … … 1054 1137 // since we don't actually set the palette until the screen is updated. 1055 1138 // But it could indicate a programming error, so let's warn about it. 1056 1139 1140 #ifdef ENABLE_16BIT 1141 if (!_screen16) 1142 warning("OSystem_SDL::setPalette: _screen16 == NULL"); 1143 #else 1057 1144 if (!_screen) 1058 1145 warning("OSystem_SDL::setPalette: _screen == NULL"); 1146 #endif 1059 1147 1060 1148 const byte *b = colors; 1061 1149 uint i; … … 1179 1267 dst.x = dst.y = 1; 1180 1268 src.w = dst.w = _videoMode.screenWidth; 1181 1269 src.h = dst.h = _videoMode.screenHeight; 1270 #ifdef ENABLE_16BIT 1271 if (SDL_BlitSurface(_screen16, &src, _tmpscreen, &dst) != 0) 1272 #else 1182 1273 if (SDL_BlitSurface(_screen, &src, _tmpscreen, &dst) != 0) 1274 #endif 1183 1275 error("SDL_BlitSurface failed: %s", SDL_GetError()); 1184 1276 1185 1277 SDL_LockSurface(_tmpscreen); -
backends/platform/sdl/sdl.cpp
196 196 _osdSurface(0), _osdAlpha(SDL_ALPHA_TRANSPARENT), _osdFadeStartTime(0), 197 197 #endif 198 198 _hwscreen(0), _screen(0), _tmpscreen(0), 199 #ifdef ENABLE_16BIT 200 _screen16(0), 201 #endif 199 202 _overlayVisible(false), 200 203 _overlayscreen(0), _tmpscreen2(0), 201 204 _samplesPerSec(0), -
backends/platform/sdl/sdl.h
227 227 228 228 // unseen game screen 229 229 SDL_Surface *_screen; 230 #ifdef ENABLE_16BIT 231 SDL_Surface *_screen16; 232 #endif 230 233 231 234 // temporary screen (for scalers) 232 235 SDL_Surface *_tmpscreen; -
dists/msvc8/scummvm.vcproj
1 1 <?xml version="1.0" encoding="windows-1252"?> 2 2 <VisualStudioProject 3 3 ProjectType="Visual C++" 4 Version="8 ,00"4 Version="8.00" 5 5 Name="scummvm" 6 6 ProjectGUID="{8434CB15-D08F-427D-9E6D-581AE5B28440}" 7 7 RootNamespace="scummvm" … … 43 43 Optimization="0" 44 44 InlineFunctionExpansion="0" 45 45 AdditionalIncludeDirectories="../../;../../engines" 46 PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_NASM;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE "46 PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_NASM;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE; ENABLE_16BIT" 47 47 MinimalRebuild="true" 48 48 ExceptionHandling="1" 49 49 BasicRuntimeChecks="3" … … 100 100 Name="VCAppVerifierTool" 101 101 /> 102 102 <Tool 103 Name="VCWebDeploymentTool" 104 /> 105 <Tool 103 106 Name="VCPostBuildEventTool" 104 107 /> 105 108 </Configuration> … … 192 195 Name="VCAppVerifierTool" 193 196 /> 194 197 <Tool 198 Name="VCWebDeploymentTool" 199 /> 200 <Tool 195 201 Name="VCPostBuildEventTool" 196 202 /> 197 203 </Configuration>