* [PATCH v2] Cursor: 8 -> 1 bit alpha downsampling improvement
@ 2024-06-24 10:10 Phil Dennis-Jordan
2024-06-24 11:29 ` Akihiko Odaki
2024-06-29 12:22 ` Marc-André Lureau
0 siblings, 2 replies; 6+ messages in thread
From: Phil Dennis-Jordan @ 2024-06-24 10:10 UTC (permalink / raw)
To: qemu-devel; +Cc: marcandre.lureau, akihiko.odaki, lists, Phil Dennis-Jordan
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..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.39.3 (Apple Git-146)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] Cursor: 8 -> 1 bit alpha downsampling improvement
2024-06-24 10:10 [PATCH v2] Cursor: 8 -> 1 bit alpha downsampling improvement Phil Dennis-Jordan
@ 2024-06-24 11:29 ` Akihiko Odaki
2024-06-29 12:22 ` Marc-André Lureau
1 sibling, 0 replies; 6+ messages in thread
From: Akihiko Odaki @ 2024-06-24 11:29 UTC (permalink / raw)
To: Phil Dennis-Jordan, qemu-devel; +Cc: marcandre.lureau, lists
On 2024/06/24 19:10, Phil Dennis-Jordan wrote:
> 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>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] Cursor: 8 -> 1 bit alpha downsampling improvement
2024-06-24 10:10 [PATCH v2] Cursor: 8 -> 1 bit alpha downsampling improvement Phil Dennis-Jordan
2024-06-24 11:29 ` Akihiko Odaki
@ 2024-06-29 12:22 ` Marc-André Lureau
2024-07-17 13:11 ` Phil Dennis-Jordan
1 sibling, 1 reply; 6+ messages in thread
From: Marc-André Lureau @ 2024-06-29 12:22 UTC (permalink / raw)
To: Phil Dennis-Jordan; +Cc: qemu-devel, akihiko.odaki, lists
[-- Attachment #1: Type: text/plain, Size: 1533 bytes --]
On Mon, Jun 24, 2024 at 2:11 PM Phil Dennis-Jordan <phil@philjordan.eu>
wrote:
> 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: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> 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.39.3 (Apple Git-146)
>
>
>
--
Marc-André Lureau
[-- Attachment #2: Type: text/html, Size: 2375 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] Cursor: 8 -> 1 bit alpha downsampling improvement
2024-06-29 12:22 ` Marc-André Lureau
@ 2024-07-17 13:11 ` Phil Dennis-Jordan
2024-07-17 13:20 ` Marc-André Lureau
0 siblings, 1 reply; 6+ messages in thread
From: Phil Dennis-Jordan @ 2024-07-17 13:11 UTC (permalink / raw)
To: Marc-André Lureau; +Cc: qemu-devel, akihiko.odaki, lists
[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]
> 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: Marc-André Lureau <marcandre.lureau@redhat.com>
>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Thanks for the reviews folks! Is there anything I can do to move this
forward? Should I submit a v3 with the review tags included? The patch
continues to apply cleanly so it didn't seem necessary, but I admit I'm
still not 100% clear on whom I should badger (?) to get favourably received
patches actually pulled into staging/master.
https://patchew.org/QEMU/20240624101040.82726-1-phil@philjordan.eu/
Thanks!
Kind regards,
Phil
[-- Attachment #2: Type: text/html, Size: 2169 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] Cursor: 8 -> 1 bit alpha downsampling improvement
2024-07-17 13:11 ` Phil Dennis-Jordan
@ 2024-07-17 13:20 ` Marc-André Lureau
2024-07-17 13:22 ` Phil Dennis-Jordan
0 siblings, 1 reply; 6+ messages in thread
From: Marc-André Lureau @ 2024-07-17 13:20 UTC (permalink / raw)
To: Phil Dennis-Jordan; +Cc: qemu-devel, akihiko.odaki, lists
[-- Attachment #1: Type: text/plain, Size: 1406 bytes --]
Hi
On Wed, Jul 17, 2024 at 5:11 PM Phil Dennis-Jordan <phil@philjordan.eu>
wrote:
>
> 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: Marc-André Lureau <marcandre.lureau@redhat.com>
>>
>
> Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>
>
> Thanks for the reviews folks! Is there anything I can do to move this
> forward? Should I submit a v3 with the review tags included? The patch
> continues to apply cleanly so it didn't seem necessary, but I admit I'm
> still not 100% clear on whom I should badger (?) to get favourably received
> patches actually pulled into staging/master.
>
> https://patchew.org/QEMU/20240624101040.82726-1-phil@philjordan.eu/
>
>
I'll include it in a UI-related PR.
thanks
--
Marc-André Lureau
[-- Attachment #2: Type: text/html, Size: 2748 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] Cursor: 8 -> 1 bit alpha downsampling improvement
2024-07-17 13:20 ` Marc-André Lureau
@ 2024-07-17 13:22 ` Phil Dennis-Jordan
0 siblings, 0 replies; 6+ messages in thread
From: Phil Dennis-Jordan @ 2024-07-17 13:22 UTC (permalink / raw)
To: Marc-André Lureau; +Cc: qemu-devel, akihiko.odaki, lists
[-- Attachment #1: Type: text/plain, Size: 1528 bytes --]
On Wed, 17 Jul 2024 at 15:20, Marc-André Lureau <marcandre.lureau@gmail.com>
wrote:
> Hi
>
> On Wed, Jul 17, 2024 at 5:11 PM Phil Dennis-Jordan <phil@philjordan.eu>
> wrote:
>
>>
>> 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: Marc-André Lureau <marcandre.lureau@redhat.com>
>>>
>>
>> Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>>
>>
>> Thanks for the reviews folks! Is there anything I can do to move this
>> forward? Should I submit a v3 with the review tags included? The patch
>> continues to apply cleanly so it didn't seem necessary, but I admit I'm
>> still not 100% clear on whom I should badger (?) to get favourably received
>> patches actually pulled into staging/master.
>>
>> https://patchew.org/QEMU/20240624101040.82726-1-phil@philjordan.eu/
>>
>>
> I'll include it in a UI-related PR.
>
> thanks
>
Thank you!
[-- Attachment #2: Type: text/html, Size: 3058 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-07-17 13:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-24 10:10 [PATCH v2] Cursor: 8 -> 1 bit alpha downsampling improvement Phil Dennis-Jordan
2024-06-24 11:29 ` Akihiko Odaki
2024-06-29 12:22 ` Marc-André Lureau
2024-07-17 13:11 ` Phil Dennis-Jordan
2024-07-17 13:20 ` Marc-André Lureau
2024-07-17 13:22 ` Phil Dennis-Jordan
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).