summaryrefslogtreecommitdiffstats
path: root/hw/display/sm501.c
diff options
context:
space:
mode:
authorSebastian Bauer2018-06-18 23:38:16 +0200
committerDavid Gibson2018-06-21 13:22:53 +0200
commita69232e2a36b9fcee46ddbf140ab2de1583abf39 (patch)
treee6fd716c20eae1e6b77ce6ff4989c2ab443fd4b8 /hw/display/sm501.c
parentfpu_helper.c: fix helper_fpscr_clrbit() function (diff)
downloadqemu-a69232e2a36b9fcee46ddbf140ab2de1583abf39.tar.gz
qemu-a69232e2a36b9fcee46ddbf140ab2de1583abf39.tar.xz
qemu-a69232e2a36b9fcee46ddbf140ab2de1583abf39.zip
sm501: Fix hardware cursor color conversion
According to the sm501 specs the hardware cursor colors are to be given in the rgb565 format, but the code currently interprets them as bgr565. Therefore, the colors of the hardware cursors are wrong in the QEMU display, e.g., the standard mouse pointer of AmigaOS appears blue instead of red. This change fixes this issue by replacing the existing naive bgr565 => rgb888 conversion with a standard rgb565 => rgb888 one that also scales the color component values properly. Signed-off-by: Sebastian Bauer <mail@sebastianbauer.info> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/display/sm501.c')
-rw-r--r--hw/display/sm501.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index ca0840f6fa..8206ae81a1 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -652,9 +652,9 @@ static inline void get_hwc_palette(SM501State *state, int crt, uint8_t *palette)
} else {
rgb565 = color_reg & 0xFFFF;
}
- palette[i * 3 + 0] = (rgb565 << 3) & 0xf8; /* red */
- palette[i * 3 + 1] = (rgb565 >> 3) & 0xfc; /* green */
- palette[i * 3 + 2] = (rgb565 >> 8) & 0xf8; /* blue */
+ palette[i * 3 + 0] = ((rgb565 >> 11) * 527 + 23) >> 6; /* r */
+ palette[i * 3 + 1] = (((rgb565 >> 5) & 0x3f) * 259 + 33) >> 6; /* g */
+ palette[i * 3 + 2] = ((rgb565 & 0x1f) * 527 + 23) >> 6; /* b */
}
}