[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/13] ui/cocoa: Release CGColorSpace
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 08/13] ui/cocoa: Release CGColorSpace |
Date: |
Tue, 16 Jul 2024 20:09:35 +0200 |
From: Akihiko Odaki <akihiko.odaki@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.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>
---
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
- [PULL 00/13] Misc HW/UI patches for 2024-07-16, Philippe Mathieu-Daudé, 2024/07/16
- [PULL 01/13] hw/core/loader: allow loading larger ROMs, Philippe Mathieu-Daudé, 2024/07/16
- [PULL 02/13] hw/isa/vt82c686: Turn "intr" irq into a named gpio, Philippe Mathieu-Daudé, 2024/07/16
- [PULL 03/13] include/hw/qdev-core.h: Correct and clarify gpio doc comments, Philippe Mathieu-Daudé, 2024/07/16
- [PULL 04/13] loader: remove load_image_gzipped function as its not used anywhere, Philippe Mathieu-Daudé, 2024/07/16
- [PULL 05/13] accel/tcg: Make cpu_exec_interrupt hook mandatory, Philippe Mathieu-Daudé, 2024/07/16
- [PULL 06/13] system/cpus: Add cpu_pause() function, Philippe Mathieu-Daudé, 2024/07/16
- [PULL 07/13] esp: remove transfer size check from DMA DATA IN and DATA OUT transfers, Philippe Mathieu-Daudé, 2024/07/16
- [PULL 08/13] ui/cocoa: Release CGColorSpace,
Philippe Mathieu-Daudé <=
- [PULL 09/13] ui/console: Convert mouse visibility parameter into bool, Philippe Mathieu-Daudé, 2024/07/16
- [PULL 13/13] system/physmem: use return value of ram_block_discard_require() as errno, Philippe Mathieu-Daudé, 2024/07/16
- [PULL 10/13] ui/cocoa: Add cursor composition, Philippe Mathieu-Daudé, 2024/07/16
- [PULL 11/13] ui/console: Remove dpy_cursor_define_supported(), Philippe Mathieu-Daudé, 2024/07/16
- [PULL 12/13] vl: fix "type is NULL" in -vga help, Philippe Mathieu-Daudé, 2024/07/16
- Re: [PULL 00/13] Misc HW/UI patches for 2024-07-16, Richard Henderson, 2024/07/17