From: Phil Dennis-Jordan <phil@philjordan.eu>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, philmd@linaro.org,
akihiko.odaki@daynix.com, marcandre.lureau@redhat.com,
Phil Dennis-Jordan <phil@philjordan.eu>
Subject: [PATCH 1/3] Cursor: 8 -> 1 bit alpha downsampling improvement
Date: Sat, 8 Jun 2024 22:20:43 +0200 [thread overview]
Message-ID: <20240608202045.2815-2-phil@philjordan.eu> (raw)
In-Reply-To: <20240608202045.2815-1-phil@philjordan.eu>
Mouse cursors with 8 bit alpha were downsampled to 1-bit opacity maps by
turning alpha values of 255 into 1 and everything else into 0. This
means that mostly-opaque pixels ended up completely invisible.
This patch changes the behaviour so that only pixels with less than 50%
alpha (0-127) are treated as transparent when converted to 1-bit alpha.
This greatly improves the subjective appearance of anti-aliased mouse
cursors, such as those used by macOS, when using a front-end UI without
support for alpha-blended cursors, such as some VNC clients.
Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
---
ui/cursor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/cursor.c b/ui/cursor.c
index 29717b3ecb..4c05e5555c 100644
--- a/ui/cursor.c
+++ b/ui/cursor.c
@@ -232,7 +232,7 @@ void cursor_get_mono_mask(QEMUCursor *c, int transparent, uint8_t *mask)
for (y = 0; y < c->height; y++) {
bit = 0x80;
for (x = 0; x < c->width; x++, data++) {
- if ((*data & 0xff000000) != 0xff000000) {
+ if ((*data & 0xff000000) < 0x80000000) {
if (transparent != 0) {
mask[x/8] |= bit;
}
--
2.36.1
next prev parent reply other threads:[~2024-06-08 20:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-08 20:20 [PATCH 0/3] Mouse cursor improvements on macOS and VNC Phil Dennis-Jordan
2024-06-08 20:20 ` Phil Dennis-Jordan [this message]
2024-06-09 8:52 ` [PATCH 1/3] Cursor: 8 -> 1 bit alpha downsampling improvement Akihiko Odaki
2024-06-08 20:20 ` [PATCH 2/3] hw: Moves int_clamp() implementations to header Phil Dennis-Jordan
2024-06-09 8:59 ` Akihiko Odaki
2024-06-10 8:50 ` Phil Dennis-Jordan
2024-06-10 8:54 ` Akihiko Odaki
2024-06-08 20:20 ` [PATCH 3/3] ui/cocoa: Adds support for mouse cursors Phil Dennis-Jordan
2024-06-09 9:06 ` Akihiko Odaki
2024-06-10 14:00 ` Phil Dennis-Jordan
2024-06-11 7:35 ` Akihiko Odaki
2024-06-25 18:57 ` Phil Dennis-Jordan
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=20240608202045.2815-2-phil@philjordan.eu \
--to=phil@philjordan.eu \
--cc=akihiko.odaki@daynix.com \
--cc=marcandre.lureau@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).