Add support for 16bit cursors

Fixes issue #273
This commit is contained in:
Henrik Andersson 2018-06-26 10:03:50 +02:00
parent 3918157521
commit 79e5b3353b

11
xwin.c
View File

@ -3314,6 +3314,7 @@ get_pixel(uint32 idx, uint8 * andmask, uint8 * xormask, int bpp, uint8 * xor_fla
uint32 argb; uint32 argb;
uint8 alpha; uint8 alpha;
uint8 *pxor; uint8 *pxor;
PixelColour pc;
*xor_flag = 0; *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); argb = (alpha << 24) | (argb ? 0xffffff : 0x000000);
break; 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: case 24:
offs = idx * 3; offs = idx * 3;
pxor = xormask + offs; 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", logger(GUI, Debug, "ui_create_cursor(): xhot=%d, yhot=%d, width=%d, height=%d, bpp=%d",
xhot, yhot, width, height, bpp); 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", logger(GUI, Warning, "ui_create_xcursor_cursor(): Unhandled cursor bit depth %d",
bpp); bpp);