summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndy <andy@teamrubber.com>2019-09-04 21:11:30 +0100
committerNiels Martin Hansen <nielsm@indvikleren.dk>2019-09-07 22:09:17 +0200
commit901463386671defe899505f4dd593d1de4b90a5c (patch)
treee490c56851946122b0ed51bb9e5dff58882f34f9 /src
parent0549a81c30be09529ab8a1f9acb4e435100c7c26 (diff)
downloadopenttd-901463386671defe899505f4dd593d1de4b90a5c.tar.xz
Fix: change Quartz driver colorSpace handling to address certain macOS performance issues (#7644)
Diffstat (limited to 'src')
-rw-r--r--src/video/cocoa/wnd_quartz.mm6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/video/cocoa/wnd_quartz.mm b/src/video/cocoa/wnd_quartz.mm
index 4245a3c18..bd5d8bdaa 100644
--- a/src/video/cocoa/wnd_quartz.mm
+++ b/src/video/cocoa/wnd_quartz.mm
@@ -113,7 +113,7 @@ static CGColorSpaceRef QZ_GetCorrectColorSpace()
if (colorSpace == NULL) {
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
if (MacOSVersionIsAtLeast(10, 5, 0)) {
- colorSpace = CGDisplayCopyColorSpace(CGMainDisplayID());
+ colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
} else
#endif
{
@@ -289,7 +289,9 @@ bool WindowQuartzSubdriver::SetVideoMode(int width, int height, int bpp)
styleMask:style
backing:NSBackingStoreBuffered
defer:NO ];
-
+ if ([ this->window respondsToSelector:@selector(setColorSpace:) ]) {
+ [ this->window setColorSpace:[ [ [ NSColorSpace alloc ] initWithCGColorSpace:QZ_GetCorrectColorSpace() ] autorelease ] ];
+ }
if (this->window == nil) {
DEBUG(driver, 0, "Could not create the Cocoa window.");
this->setup = false;