summaryrefslogtreecommitdiff
path: root/src/video/cocoa
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2016-10-31 19:29:01 +0000
committermichi_cc <michi_cc@openttd.org>2016-10-31 19:29:01 +0000
commit94b3965989f23363a2863da7e819d6e8a8ff1214 (patch)
tree28799cb5fbd64a2c60c3c1288cbb128186722763 /src/video/cocoa
parent51052f4961cea7203d2291b9b70ae865602b469e (diff)
downloadopenttd-94b3965989f23363a2863da7e819d6e8a8ff1214.tar.xz
(svn r27675) -Fix [FS#6502]: [OSX] Building with 10.11 or 10.12 SDKs.
Diffstat (limited to 'src/video/cocoa')
-rw-r--r--src/video/cocoa/wnd_quartz.mm22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/video/cocoa/wnd_quartz.mm b/src/video/cocoa/wnd_quartz.mm
index c93a1f6fb..795a311bc 100644
--- a/src/video/cocoa/wnd_quartz.mm
+++ b/src/video/cocoa/wnd_quartz.mm
@@ -110,15 +110,23 @@ static CGColorSpaceRef QZ_GetCorrectColorSpace()
static CGColorSpaceRef colorSpace = NULL;
if (colorSpace == NULL) {
- CMProfileRef sysProfile;
-
- if (CMGetSystemProfile(&sysProfile) == noErr) {
- colorSpace = CGColorSpaceCreateWithPlatformColorSpace(sysProfile);
- CMCloseProfile(sysProfile);
- } else {
- colorSpace = CGColorSpaceCreateDeviceRGB();
+#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
+ if (MacOSVersionIsAtLeast(10, 5, 0)) {
+ colorSpace = CGDisplayCopyColorSpace(CGMainDisplayID());
+ } else
+#endif
+ {
+#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) && !defined(HAVE_OSX_1011_SDK)
+ CMProfileRef sysProfile;
+ if (CMGetSystemProfile(&sysProfile) == noErr) {
+ colorSpace = CGColorSpaceCreateWithPlatformColorSpace(sysProfile);
+ CMCloseProfile(sysProfile);
+ }
+#endif
}
+ if (colorSpace == NULL) colorSpace = CGColorSpaceCreateDeviceRGB();
+
if (colorSpace == NULL) error("Could not get system colour space. You might need to recalibrate your monitor.");
}