summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-03-02 22:21:27 +0000
committerbjarni <bjarni@openttd.org>2006-03-02 22:21:27 +0000
commitdcdfa496d5dbc7b6af8d2fb86fb266ab3f191e6c (patch)
tree63bc5ea15b8a6c91cad3a67d862dd119979def82
parente29a4352260b3aba075be615fd6a73bd961ec2d5 (diff)
downloadopenttd-dcdfa496d5dbc7b6af8d2fb86fb266ab3f191e6c.tar.xz
(svn r3742) -codechange: [OSX] changed an assert to use the new error window and added another two to show if the screen buffer fails for some reason in cocoa driver (instead of just crashing)
-rw-r--r--video/cocoa_v.m12
1 files changed, 11 insertions, 1 deletions
diff --git a/video/cocoa_v.m b/video/cocoa_v.m
index 71065cd25..e8c18895c 100644
--- a/video/cocoa_v.m
+++ b/video/cocoa_v.m
@@ -847,6 +847,10 @@ static void QZ_SetPortAlphaOpaque(void)
_cocoa_video_data.realpixels = GetPixBaseAddr(GetPortPixMap(thePort));
_cocoa_video_data.pitch = GetPixRowBytes(GetPortPixMap(thePort));
+ if (_cocoa_video_data.realpixels == NULL) {
+ ShowMacErrorDialog("Error: failure to locate screen buffer in the OS");
+ }
+
/* _cocoa_video_data.realpixels now points to the window's pixels
* We want it to point to the *view's* pixels
*/
@@ -862,7 +866,9 @@ static void QZ_SetPortAlphaOpaque(void)
/* Allocate new buffer */
free(_cocoa_video_data.pixels);
_cocoa_video_data.pixels = (uint8*)malloc(newViewFrame.size.width * newViewFrame.size.height);
- assert(_cocoa_video_data.pixels != NULL);
+ if (_cocoa_video_data.pixels == NULL) {
+ ShowMacErrorDialog("Error: failed to allocate frame buffer");
+ }
/* Tell the game that the resolution changed */
@@ -1352,6 +1358,10 @@ static const char* QZ_SetVideoFullScreen(int width, int height)
_cocoa_video_data.realpixels = (uint8*)CGDisplayBaseAddress(_cocoa_video_data.display_id);
_cocoa_video_data.pitch = CGDisplayBytesPerRow(_cocoa_video_data.display_id);
+ if (_cocoa_video_data.realpixels == NULL ) {
+ ShowMacErrorDialog("Error: failure to locate screen buffer in the OS for full screen mode");
+ }
+
_cocoa_video_data.width = CGDisplayPixelsWide(_cocoa_video_data.display_id);
_cocoa_video_data.height = CGDisplayPixelsHigh(_cocoa_video_data.display_id);
_cocoa_video_data.fullscreen = true;