summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2020-12-26 16:07:51 +0100
committerMichael Lutz <michi@icosahedron.de>2021-01-03 13:25:32 +0100
commita61a7416836ec021f522720940265d2b67dedb08 (patch)
treee594016111c8bc20e5c5abf559c9f8ea2721a366 /src/video
parent9ccef816f90e9a7e3042cd89141ba3c0956d7bb9 (diff)
downloadopenttd-a61a7416836ec021f522720940265d2b67dedb08.tar.xz
Change: [OSX] Compiling the Cocoa/Quartz video driver cannot be disabled anymore.
Diffstat (limited to 'src/video')
-rw-r--r--src/video/cocoa/cocoa_v.h2
-rw-r--r--src/video/cocoa/cocoa_v.mm41
2 files changed, 8 insertions, 35 deletions
diff --git a/src/video/cocoa/cocoa_v.h b/src/video/cocoa/cocoa_v.h
index c05bd08e2..0944424e8 100644
--- a/src/video/cocoa/cocoa_v.h
+++ b/src/video/cocoa/cocoa_v.h
@@ -191,9 +191,7 @@ public:
extern CocoaSubdriver *_cocoa_subdriver;
-#ifdef ENABLE_COCOA_QUARTZ
CocoaSubdriver *QZ_CreateWindowQuartzSubdriver(int width, int height, int bpp);
-#endif
void QZ_GameSizeChanged();
diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm
index c01d9c42e..aa9d57ecf 100644
--- a/src/video/cocoa/cocoa_v.mm
+++ b/src/video/cocoa/cocoa_v.mm
@@ -163,23 +163,6 @@ void QZ_GameSizeChanged()
}
/**
- * Find a suitable cocoa window subdriver.
- *
- * @param width Width of display area.
- * @param height Height of display area.
- * @param bpp Colour depth of display area.
- * @return Pointer to window subdriver.
- */
-static CocoaSubdriver *QZ_CreateWindowSubdriver(int width, int height, int bpp)
-{
-#if defined(ENABLE_COCOA_QUARTZ)
- return QZ_CreateWindowQuartzSubdriver(width, height, bpp);
-#else
- return nullptr;
-#endif
-}
-
-/**
* Find a suitable cocoa subdriver.
*
* @param width Width of display area.
@@ -191,7 +174,7 @@ static CocoaSubdriver *QZ_CreateWindowSubdriver(int width, int height, int bpp)
*/
static CocoaSubdriver *QZ_CreateSubdriver(int width, int height, int bpp, bool fullscreen, bool fallback)
{
- CocoaSubdriver *ret = QZ_CreateWindowSubdriver(width, height, bpp);
+ CocoaSubdriver *ret = QZ_CreateWindowQuartzSubdriver(width, height, bpp);
if (ret != nullptr && fullscreen) ret->ToggleFullscreen();
if (ret != nullptr) return ret;
@@ -199,7 +182,7 @@ static CocoaSubdriver *QZ_CreateSubdriver(int width, int height, int bpp, bool f
/* Try again in 640x480 windowed */
DEBUG(driver, 0, "Setting video mode failed, falling back to 640x480 windowed mode.");
- ret = QZ_CreateWindowSubdriver(640, 480, bpp);
+ ret = QZ_CreateWindowQuartzSubdriver(640, 480, bpp);
if (ret != nullptr) return ret;
return nullptr;
@@ -228,7 +211,7 @@ void VideoDriver_Cocoa::Stop()
*/
const char *VideoDriver_Cocoa::Start(const StringList &parm)
{
- if (!MacOSVersionIsAtLeast(10, 6, 0)) return "The Cocoa video driver requires Mac OS X 10.6 or later.";
+ if (!MacOSVersionIsAtLeast(10, 7, 0)) return "The Cocoa video driver requires Mac OS X 10.7 or later.";
if (_cocoa_video_started) return "Already started";
_cocoa_video_started = true;
@@ -240,6 +223,11 @@ const char *VideoDriver_Cocoa::Start(const StringList &parm)
int height = _cur_resolution.height;
int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
+ if (bpp != 8 && bpp != 32) {
+ Stop();
+ return "The cocoa quartz subdriver only supports 8 and 32 bpp.";
+ }
+
_cocoa_subdriver = QZ_CreateSubdriver(width, height, bpp, _fullscreen, true);
if (_cocoa_subdriver == NULL) {
Stop();
@@ -332,8 +320,6 @@ void VideoDriver_Cocoa::EditBoxLostFocus()
HandleTextInput(NULL, true);
}
-#ifdef ENABLE_COCOA_QUARTZ
-
class WindowQuartzSubdriver;
/* Subclass of OTTD_CocoaView to fix Quartz rendering */
@@ -850,16 +836,6 @@ bool WindowQuartzSubdriver::WindowResized()
CocoaSubdriver *QZ_CreateWindowQuartzSubdriver(int width, int height, int bpp)
{
- if (!MacOSVersionIsAtLeast(10, 7, 0)) {
- DEBUG(driver, 0, "The cocoa quartz subdriver requires Mac OS X 10.7 or later.");
- return NULL;
- }
-
- if (bpp != 8 && bpp != 32) {
- DEBUG(driver, 0, "The cocoa quartz subdriver only supports 8 and 32 bpp.");
- return NULL;
- }
-
WindowQuartzSubdriver *ret = new WindowQuartzSubdriver();
if (!ret->ChangeResolution(width, height, bpp)) {
@@ -869,6 +845,5 @@ CocoaSubdriver *QZ_CreateWindowQuartzSubdriver(int width, int height, int bpp)
return ret;
}
-#endif /* ENABLE_COCOA_QUARTZ */
#endif /* WITH_COCOA */