qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 3/4] ui/cocoa: Add cursor composition


From: Phil Dennis-Jordan
Subject: Re: [PATCH v2 3/4] ui/cocoa: Add cursor composition
Date: Tue, 2 Jul 2024 15:19:29 +0200



On Thu, 27 Jun 2024 at 13:17, Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
Co-authored-by: Phil Dennis-Jordan <phil@philjordan.eu>
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>

+- (void)setCursor:(QEMUCursor *)given_cursor
+{
+    […]
+
+    provider = CGDataProviderCreateWithData(
+        NULL,
+        cursor->data,
+        cursor->width * cursor->height * 4,
+        NULL
+    );
+
+    image = CGImageCreate(
+        cursor->width, //width
+        cursor->height, //height
+        8, //bitsPerComponent
+        32, //bitsPerPixel
+        cursor->width * 4, //bytesPerRow
+        colorspace, //colorspace
+        kCGBitmapByteOrder32Little | kCGImageAlphaFirst, //bitmapInfo
+        provider, //provider
+        NULL, //decode
+        0, //interpolate
+        kCGRenderingIntentDefault //intent
+    );
 
I still think this is an awkward amount of boilerplate that could be outsourced to a helper function - especially as you've now reminded me in patch 1/4 that drawRect: does essentially the same thing and could probably share that helper.

I'm still keen on NSCursor support for absolute pointing mode though, so I can experiment with doing a better job of cleaning it up as part v3 of that patch series. So:

Reviewed-by: Phil Dennis-Jordan <phil@philjordan.eu>
Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]