From: Akihiko Odaki <akihiko.od...@daynix.com> CGImageCreate | Apple Developer Documentation https://developer.apple.com/documentation/coregraphics/1455149-cgimagecreate > The color space is retained; on return, you may safely release it.
Signed-off-by: Akihiko Odaki <akihiko.od...@daynix.com> Tested-by: Phil Dennis-Jordan <p...@philjordan.eu> Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org> Message-ID: <20240715-cursor-v3-1-afa5b9492...@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> --- ui/cocoa.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 2935247cdd..79a054b128 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -307,6 +307,7 @@ @interface QemuCocoaView : NSView BOOL isMouseGrabbed; BOOL isAbsoluteEnabled; CFMachPortRef eventsTap; + CGColorSpaceRef colorspace; } - (void) switchSurface:(pixman_image_t *)image; - (void) grabMouse; @@ -359,6 +360,7 @@ - (id)initWithFrame:(NSRect)frameRect [trackingArea release]; screen.width = frameRect.size.width; screen.height = frameRect.size.height; + colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_14_0 [self setClipsToBounds:YES]; #endif @@ -379,6 +381,7 @@ - (void) dealloc CFRelease(eventsTap); } + CGColorSpaceRelease(colorspace); [super dealloc]; } @@ -456,7 +459,7 @@ - (void) drawRect:(NSRect) rect DIV_ROUND_UP(bitsPerPixel, 8) * 2, //bitsPerComponent bitsPerPixel, //bitsPerPixel stride, //bytesPerRow - CGColorSpaceCreateWithName(kCGColorSpaceSRGB), //colorspace + colorspace, //colorspace kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst, //bitmapInfo dataProviderRef, //provider NULL, //decode -- 2.41.0