From: Akihiko Odaki <akihiko.odaki@daynix.com>
To: "Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Dmitry Fleytman" <dmitry.fleytman@gmail.com>,
"Phil Dennis-Jordan" <phil@philjordan.eu>
Cc: qemu-devel@nongnu.org, Akihiko Odaki <akihiko.odaki@daynix.com>
Subject: [PATCH v3 1/4] ui/cocoa: Release CGColorSpace
Date: Mon, 15 Jul 2024 14:25:42 +0900 [thread overview]
Message-ID: <20240715-cursor-v3-1-afa5b9492dbf@daynix.com> (raw)
In-Reply-To: <20240715-cursor-v3-0-afa5b9492dbf@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>
---
ui/cocoa.m | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 981615a8b925..908454a434c5 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -299,6 +299,7 @@ @interface QemuCocoaView : NSView
BOOL isMouseGrabbed;
BOOL isAbsoluteEnabled;
CFMachPortRef eventsTap;
+ CGColorSpaceRef colorspace;
}
- (void) switchSurface:(pixman_image_t *)image;
- (void) grabMouse;
@@ -360,6 +361,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
@@ -380,6 +382,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.45.2
next prev parent reply other threads:[~2024-07-15 5:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-15 5:25 [PATCH v3 0/4] ui/cocoa: Add cursor composition Akihiko Odaki
2024-07-15 5:25 ` Akihiko Odaki [this message]
2024-07-15 6:57 ` [PATCH v3 1/4] ui/cocoa: Release CGColorSpace Philippe Mathieu-Daudé
2024-07-15 5:25 ` [PATCH v3 2/4] ui/console: Convert mouse visibility parameter into bool Akihiko Odaki
2024-07-15 6:56 ` Philippe Mathieu-Daudé
2024-07-15 5:25 ` [PATCH v3 3/4] ui/cocoa: Add cursor composition Akihiko Odaki
2024-07-15 5:25 ` [PATCH v3 4/4] ui/console: Remove dpy_cursor_define_supported() Akihiko Odaki
2024-07-16 17:55 ` [PATCH v3 0/4] ui/cocoa: Add cursor composition Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240715-cursor-v3-1-afa5b9492dbf@daynix.com \
--to=akihiko.odaki@daynix.com \
--cc=berrange@redhat.com \
--cc=dmitry.fleytman@gmail.com \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=phil@philjordan.eu \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).