mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
ui/vnc: fix tight palette pixel encoding for 8/16-bpp formats
When sending a tight rectangle with the palette filter, if the client format was 8/16bpp, the colours on big endian hosts are not set as we're sending the wrong bytes. We must first cast the 32-bit colour to a 16/8-bit value, and then send the result. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
7009744285
commit
63d3209092
1 changed files with 12 additions and 4 deletions
|
@ -1001,16 +1001,24 @@ static int send_mono_rect(VncState *vs, int x, int y,
|
|||
break;
|
||||
}
|
||||
case 2:
|
||||
vnc_write(vs, &bg, 2);
|
||||
vnc_write(vs, &fg, 2);
|
||||
{
|
||||
uint16_t bg16 = bg;
|
||||
uint16_t fg16 = fg;
|
||||
vnc_write(vs, &bg16, 2);
|
||||
vnc_write(vs, &fg16, 2);
|
||||
tight_encode_mono_rect16(vs->tight->tight.buffer, w, h, bg, fg);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
vnc_write_u8(vs, bg);
|
||||
vnc_write_u8(vs, fg);
|
||||
{
|
||||
uint8_t bg8 = bg;
|
||||
uint8_t fg8 = fg;
|
||||
vnc_write_u8(vs, bg8);
|
||||
vnc_write_u8(vs, fg8);
|
||||
tight_encode_mono_rect8(vs->tight->tight.buffer, w, h, bg, fg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
vs->tight->tight.offset = bytes;
|
||||
|
||||
bytes = tight_compress_data(vs, stream, bytes, level, Z_DEFAULT_STRATEGY);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue