equal
deleted
inserted
replaced
845 LockPortBits(thePort); |
845 LockPortBits(thePort); |
846 |
846 |
847 _cocoa_video_data.realpixels = GetPixBaseAddr(GetPortPixMap(thePort)); |
847 _cocoa_video_data.realpixels = GetPixBaseAddr(GetPortPixMap(thePort)); |
848 _cocoa_video_data.pitch = GetPixRowBytes(GetPortPixMap(thePort)); |
848 _cocoa_video_data.pitch = GetPixRowBytes(GetPortPixMap(thePort)); |
849 |
849 |
|
850 if (_cocoa_video_data.realpixels == NULL) { |
|
851 ShowMacErrorDialog("Error: failure to locate screen buffer in the OS"); |
|
852 } |
|
853 |
850 /* _cocoa_video_data.realpixels now points to the window's pixels |
854 /* _cocoa_video_data.realpixels now points to the window's pixels |
851 * We want it to point to the *view's* pixels |
855 * We want it to point to the *view's* pixels |
852 */ |
856 */ |
853 { |
857 { |
854 int vOffset = [ _cocoa_video_data.window frame ].size.height - newViewFrame.size.height - newViewFrame.origin.y; |
858 int vOffset = [ _cocoa_video_data.window frame ].size.height - newViewFrame.size.height - newViewFrame.origin.y; |
860 UnlockPortBits(thePort); |
864 UnlockPortBits(thePort); |
861 |
865 |
862 /* Allocate new buffer */ |
866 /* Allocate new buffer */ |
863 free(_cocoa_video_data.pixels); |
867 free(_cocoa_video_data.pixels); |
864 _cocoa_video_data.pixels = (uint8*)malloc(newViewFrame.size.width * newViewFrame.size.height); |
868 _cocoa_video_data.pixels = (uint8*)malloc(newViewFrame.size.width * newViewFrame.size.height); |
865 assert(_cocoa_video_data.pixels != NULL); |
869 if (_cocoa_video_data.pixels == NULL) { |
|
870 ShowMacErrorDialog("Error: failed to allocate frame buffer"); |
|
871 } |
866 |
872 |
867 |
873 |
868 /* Tell the game that the resolution changed */ |
874 /* Tell the game that the resolution changed */ |
869 _cocoa_video_data.width = newViewFrame.size.width; |
875 _cocoa_video_data.width = newViewFrame.size.width; |
870 _cocoa_video_data.height = newViewFrame.size.height; |
876 _cocoa_video_data.height = newViewFrame.size.height; |
1350 } |
1356 } |
1351 |
1357 |
1352 _cocoa_video_data.realpixels = (uint8*)CGDisplayBaseAddress(_cocoa_video_data.display_id); |
1358 _cocoa_video_data.realpixels = (uint8*)CGDisplayBaseAddress(_cocoa_video_data.display_id); |
1353 _cocoa_video_data.pitch = CGDisplayBytesPerRow(_cocoa_video_data.display_id); |
1359 _cocoa_video_data.pitch = CGDisplayBytesPerRow(_cocoa_video_data.display_id); |
1354 |
1360 |
|
1361 if (_cocoa_video_data.realpixels == NULL ) { |
|
1362 ShowMacErrorDialog("Error: failure to locate screen buffer in the OS for full screen mode"); |
|
1363 } |
|
1364 |
1355 _cocoa_video_data.width = CGDisplayPixelsWide(_cocoa_video_data.display_id); |
1365 _cocoa_video_data.width = CGDisplayPixelsWide(_cocoa_video_data.display_id); |
1356 _cocoa_video_data.height = CGDisplayPixelsHigh(_cocoa_video_data.display_id); |
1366 _cocoa_video_data.height = CGDisplayPixelsHigh(_cocoa_video_data.display_id); |
1357 _cocoa_video_data.fullscreen = true; |
1367 _cocoa_video_data.fullscreen = true; |
1358 |
1368 |
1359 /* Setup double-buffer emulation */ |
1369 /* Setup double-buffer emulation */ |