Fix Windows 10 cursors drawing as black
@@ -229,18 +229,23 @@ static BOOL wf_Pointer_New(rdpContext* context, const rdpPointer* pointer)
else
{
BYTE* pdata = (BYTE*) _aligned_malloc(pointer->lengthAndMask, 16);
+ // currently color xorBpp is only 24 per [T128] section 8.14.3
+ UINT32 srcFormat = gdi_get_pixel_format(pointer->xorBpp);
if (!pdata)
goto fail;
+ if (!srcFormat)
+ goto fail;
+
flip_bitmap(pointer->andMaskData, pdata, (pointer->width + 7) / 8,
pointer->height);
info.hbmMask = CreateBitmap(pointer->width, pointer->height, 1, 1, pdata);
_aligned_free(pdata);
- pdata = (BYTE*) _aligned_malloc(pointer->width * pointer->height *
- GetBitsPerPixel(gdi->dstFormat), 16);
- if (!pdata)
+ info.hbmColor = wf_create_dib((wfContext*)context, pointer->width, pointer->height, srcFormat, NULL, &pdata);
+
+ if (!info.hbmColor)
goto fail;
if (!freerdp_image_copy_from_pointer_data(pdata, gdi->dstFormat, 0, 0, 0,
@@ -248,13 +253,8 @@ static BOOL wf_Pointer_New(rdpContext* context, const rdpPointer* pointer)
pointer->xorMaskData, pointer->lengthXorMask,
pointer->andMaskData, pointer->lengthAndMask, pointer->xorBpp, &gdi->palette))
{
- _aligned_free(pdata);
goto fail;
}
-
- info.hbmColor = CreateBitmap(pointer->width, pointer->height, 1,
- GetBitsPerPixel(gdi->dstFormat), pdata);
- _aligned_free(pdata);
}
hCur = CreateIconIndirect(&info);
