ui/cocoa: Release CGColorSpace

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.odaki@daynix.com>
Tested-by: Phil Dennis-Jordan <phil@philjordan.eu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240715-cursor-v3-1-afa5b9492dbf@daynix.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
Akihiko Odaki 2024-07-15 14:25:42 +09:00 committed by Philippe Mathieu-Daudé
parent dfaf55a19a
commit 3f5ef05fe0

View File

@ -307,6 +307,7 @@ static void handleAnyDeviceErrors(Error * err)
BOOL isMouseGrabbed; BOOL isMouseGrabbed;
BOOL isAbsoluteEnabled; BOOL isAbsoluteEnabled;
CFMachPortRef eventsTap; CFMachPortRef eventsTap;
CGColorSpaceRef colorspace;
} }
- (void) switchSurface:(pixman_image_t *)image; - (void) switchSurface:(pixman_image_t *)image;
- (void) grabMouse; - (void) grabMouse;
@ -359,6 +360,7 @@ static CGEventRef handleTapEvent(CGEventTapProxy proxy, CGEventType type, CGEven
[trackingArea release]; [trackingArea release];
screen.width = frameRect.size.width; screen.width = frameRect.size.width;
screen.height = frameRect.size.height; screen.height = frameRect.size.height;
colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_14_0 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_14_0
[self setClipsToBounds:YES]; [self setClipsToBounds:YES];
#endif #endif
@ -379,6 +381,7 @@ static CGEventRef handleTapEvent(CGEventTapProxy proxy, CGEventType type, CGEven
CFRelease(eventsTap); CFRelease(eventsTap);
} }
CGColorSpaceRelease(colorspace);
[super dealloc]; [super dealloc];
} }
@ -456,7 +459,7 @@ static CGEventRef handleTapEvent(CGEventTapProxy proxy, CGEventType type, CGEven
DIV_ROUND_UP(bitsPerPixel, 8) * 2, //bitsPerComponent DIV_ROUND_UP(bitsPerPixel, 8) * 2, //bitsPerComponent
bitsPerPixel, //bitsPerPixel bitsPerPixel, //bitsPerPixel
stride, //bytesPerRow stride, //bytesPerRow
CGColorSpaceCreateWithName(kCGColorSpaceSRGB), //colorspace colorspace, //colorspace
kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst, //bitmapInfo kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst, //bitmapInfo
dataProviderRef, //provider dataProviderRef, //provider
NULL, //decode NULL, //decode