[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 3/8] Cursor: 8 -> 1 bit alpha downsampling improvement
From: |
marcandre . lureau |
Subject: |
[PULL 3/8] Cursor: 8 -> 1 bit alpha downsampling improvement |
Date: |
Tue, 23 Jul 2024 00:06:13 +0400 |
From: Phil Dennis-Jordan <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>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20240624101040.82726-1-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..dd3853320d 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 & 0x80000000) == 0x0) { /* Alpha < 0x80 (128) */
if (transparent != 0) {
mask[x/8] |= bit;
}
--
2.45.2.827.g557ae147e6
- [PULL 0/8] Ui patches, marcandre . lureau, 2024/07/22
- [PULL 1/8] vnc: increase max display size, marcandre . lureau, 2024/07/22
- [PULL 2/8] virtio-gpu-gl: declare dependency on ui-opengl, marcandre . lureau, 2024/07/22
- [PULL 3/8] Cursor: 8 -> 1 bit alpha downsampling improvement,
marcandre . lureau <=
- [PULL 4/8] ui: add more tracing for dbus, marcandre . lureau, 2024/07/22
- [PULL 5/8] ui/vdagent: improve vdagent_fe_open() trace, marcandre . lureau, 2024/07/22
- [PULL 7/8] ui/vdagent: send caps on fe_open, marcandre . lureau, 2024/07/22
- [PULL 6/8] ui/vdagent: notify clipboard peers of serial reset, marcandre . lureau, 2024/07/22
- [PULL 8/8] chardev/char-win-stdio.c: restore old console mode, marcandre . lureau, 2024/07/22
- Re: [PULL 0/8] Ui patches, Philippe Mathieu-Daudé, 2024/07/22
- Re: [PULL 0/8] Ui patches, Richard Henderson, 2024/07/23