Fixed color pointer.

This commit is contained in:
Armin Novak 2016-08-03 14:22:55 +02:00
parent c8a7065f93
commit 90cd2a8a45

View File

@ -194,6 +194,7 @@ static BOOL wf_Pointer_New(rdpContext* context, const rdpPointer* pointer)
HCURSOR hCur;
ICONINFO info;
rdpGdi* gdi;
BOOL rc = FALSE;
if (!context || !pointer)
return FALSE;
@ -211,6 +212,9 @@ static BOOL wf_Pointer_New(rdpContext* context, const rdpPointer* pointer)
{
BYTE* pdata = (BYTE*) _aligned_malloc(pointer->lengthAndMask +
pointer->lengthXorMask, 16);
if (!pdata)
goto fail;
CopyMemory(pdata, pointer->andMaskData, pointer->lengthAndMask);
CopyMemory(pdata + pointer->lengthAndMask, pointer->xorMaskData,
pointer->lengthXorMask);
@ -220,29 +224,43 @@ static BOOL wf_Pointer_New(rdpContext* context, const rdpPointer* pointer)
}
else
{
const UINT32 scanline = pointer->width * pointer->xorBpp / 8;
BYTE* pdata = (BYTE*) _aligned_malloc(pointer->lengthAndMask, 16);
if (!pdata)
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->lengthXorMask, 16);
flip_bitmap(pointer->xorMaskData, pdata, scanline, pointer->height);
pdata = (BYTE*) _aligned_malloc(pointer->width * pointer->height * GetBitsPerPixel(gdi->dstFormat), 16);
if (!pdata)
goto fail;
if (!freerdp_image_copy_from_pointer_data(pdata, gdi->dstFormat, 0, 0, 0, pointer->width, pointer->height,
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,
pointer->xorBpp, pdata);
GetBitsPerPixel(gdi->dstFormat), pdata);
_aligned_free(pdata);
}
hCur = CreateIconIndirect(&info);
((wfPointer*) pointer)->cursor = hCur;
rc = TRUE;
fail:
if (info.hbmMask)
DeleteObject(info.hbmMask);
if (info.hbmColor)
DeleteObject(info.hbmColor);
return TRUE;
return rc;
}
static BOOL wf_Pointer_Free(rdpContext* context, rdpPointer* pointer)