From 79e5b3353b0995900ba51d1019d25f9a5196f4a5 Mon Sep 17 00:00:00 2001 From: Henrik Andersson Date: Tue, 26 Jun 2018 10:03:50 +0200 Subject: Add support for 16bit cursors Fixes issue #273 --- xwin.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/xwin.c b/xwin.c index 7922374..ca4a82b 100644 --- a/xwin.c +++ b/xwin.c @@ -3314,6 +3314,7 @@ get_pixel(uint32 idx, uint8 * andmask, uint8 * xormask, int bpp, uint8 * xor_fla uint32 argb; uint8 alpha; uint8 *pxor; + PixelColour pc; *xor_flag = 0; @@ -3338,6 +3339,14 @@ get_pixel(uint32 idx, uint8 * andmask, uint8 * xormask, int bpp, uint8 * xor_fla argb = (alpha << 24) | (argb ? 0xffffff : 0x000000); break; + case 16: + offs = idx * 2; + pxor = xormask + offs; + SPLITCOLOUR16(*((uint16*)pxor), pc); + alpha = GET_BIT(andmask, idx) ? 0x00 : 0xff; + argb = (alpha << 24) | (pc.red << 16) | (pc.green << 8) | pc.blue; + break; + case 24: offs = idx * 3; pxor = xormask + offs; @@ -3408,7 +3417,7 @@ ui_create_cursor(unsigned int xhot, unsigned int yhot, uint32 width, logger(GUI, Debug, "ui_create_cursor(): xhot=%d, yhot=%d, width=%d, height=%d, bpp=%d", xhot, yhot, width, height, bpp); - if (bpp != 1 && bpp != 24 && bpp != 32) + if (bpp != 1 && bpp != 16 && bpp != 24 && bpp != 32) { logger(GUI, Warning, "ui_create_xcursor_cursor(): Unhandled cursor bit depth %d", bpp); -- cgit v1.2.3