Created
September 14, 2019 12:44
-
-
Save michicc/6642dbbd7c3ace963f726fe535aedadd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/video/cocoa/wnd_quartz.mm b/src/video/cocoa/wnd_quartz.mm | |
index bd5d8bdaa..c2c35fe78 100644 | |
--- a/src/video/cocoa/wnd_quartz.mm | |
+++ b/src/video/cocoa/wnd_quartz.mm | |
@@ -289,9 +289,7 @@ - (void)drawRect:(NSRect)invalidRect | |
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; | |
@@ -598,6 +596,11 @@ - (void)drawRect:(NSRect)invalidRect | |
this->window_width = (int)newframe.size.width; | |
this->window_height = (int)newframe.size.height; | |
+ CGColorSpaceRef color_space = [ [ this->window colorSpace ] CGColorSpace ]; | |
+ CGColorSpaceRetain(color_space); | |
+ if (color_space == NULL) color_space = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); | |
+ if (color_space == NULL) color_space = CGColorSpaceCreateDeviceRGB(); | |
+ | |
/* Create Core Graphics Context */ | |
free(this->window_buffer); | |
this->window_buffer = (uint32*)malloc(this->window_width * this->window_height * 4); | |
@@ -609,9 +612,10 @@ - (void)drawRect:(NSRect)invalidRect | |
this->window_height, // height | |
8, // bits per component | |
this->window_width * 4, // bytes per row | |
- QZ_GetCorrectColorSpace(), // color space | |
+ color_space, // color space | |
kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host | |
); | |
+ CGColorSpaceRelease(color_space); | |
assert(this->cgcontext != NULL); | |
CGContextSetShouldAntialias(this->cgcontext, FALSE); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment