summaryrefslogtreecommitdiff
path: root/src/video/cocoa/wnd_quickdraw.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/video/cocoa/wnd_quickdraw.mm')
-rw-r--r--src/video/cocoa/wnd_quickdraw.mm21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/video/cocoa/wnd_quickdraw.mm b/src/video/cocoa/wnd_quickdraw.mm
index 592c41d6e..4c125ae38 100644
--- a/src/video/cocoa/wnd_quickdraw.mm
+++ b/src/video/cocoa/wnd_quickdraw.mm
@@ -54,7 +54,7 @@ class WindowQuickdrawSubdriver;
/* Subclass of NSWindow to fix genie effect and support resize events */
-@interface OTTD_QuartzWindow : NSWindow {
+@interface OTTD_QuickdrawWindow : NSWindow {
WindowQuickdrawSubdriver *driver;
}
@@ -70,7 +70,7 @@ class WindowQuickdrawSubdriver;
@end
/* Delegate for our NSWindow to send ask for quit on close */
-@interface OTTD_QuartzWindowDelegate : NSObject{
+@interface OTTD_QuickdrawWindowDelegate : NSObject{
WindowQuickdrawSubdriver *driver;
}
@@ -93,7 +93,7 @@ class WindowQuickdrawSubdriver: public CocoaSubdriver {
void *pixel_buffer;
void *window_buffer;
- OTTD_QuartzWindow *window;
+ OTTD_QuickdrawWindow *window;
#define MAX_DIRTY_RECTS 100
Rect dirty_rects[MAX_DIRTY_RECTS];
@@ -179,7 +179,7 @@ public:
};
-@implementation OTTD_QuartzWindow
+@implementation OTTD_QuickdrawWindow
- (void)setDriver:(WindowQuickdrawSubdriver*)drv
{
@@ -275,7 +275,7 @@ public:
@end
-@implementation OTTD_QuartzWindowDelegate
+@implementation OTTD_QuickdrawWindowDelegate
- (void)setDriver:(WindowQuickdrawSubdriver*)drv
{
driver = drv;
@@ -390,7 +390,7 @@ bool WindowQuickdrawSubdriver::SetVideoMode(int width, int height)
/* Check if we should recreate the window */
if (window == nil) {
- OTTD_QuartzWindowDelegate *delegate;
+ OTTD_QuickdrawWindowDelegate *delegate;
/* Set the window style */
style = NSTitledWindowMask;
@@ -398,7 +398,7 @@ bool WindowQuickdrawSubdriver::SetVideoMode(int width, int height)
style |= NSResizableWindowMask;
/* Manually create a window, avoids having a nib file resource */
- window = [ [ OTTD_QuartzWindow alloc ]
+ window = [ [ OTTD_QuickdrawWindow alloc ]
initWithContentRect:contentRect
styleMask:style
backing:NSBackingStoreBuffered
@@ -421,7 +421,7 @@ bool WindowQuickdrawSubdriver::SetVideoMode(int width, int height)
[ window setAcceptsMouseMovedEvents:YES ];
[ window setViewsNeedDisplay:NO ];
- delegate = [ [ OTTD_QuartzWindowDelegate alloc ] init ];
+ delegate = [ [ OTTD_QuickdrawWindowDelegate alloc ] init ];
[ delegate setDriver:this ];
[ window setDelegate: [ delegate autorelease ] ];
} else {
@@ -803,6 +803,11 @@ CocoaSubdriver *QZ_CreateWindowQuickdrawSubdriver(int width, int height, int bpp
{
WindowQuickdrawSubdriver *ret;
+ if (bpp != 8 && bpp != 32) {
+ DEBUG(driver, 0, "The cocoa quickdraw subdriver only supports 8 and 32 bpp.");
+ return NULL;
+ }
+
ret = new WindowQuickdrawSubdriver(bpp);
if (!ret->ChangeResolution(width, height)) {