Merge pull request #2692 from nfedera/add-16bit-cursor-conversion

codec/color: support for 8bpp and 16bpp color pointer
This commit is contained in:
Norbert Federa 2015-06-12 10:52:52 +02:00
commit 78b23cf3c5
3 changed files with 26 additions and 2 deletions

View File

@ -1093,9 +1093,11 @@ BOOL xf_post_connect(freerdp* instance)
gdi = context->gdi;
xfc->primary_buffer = gdi->primary_buffer;
xfc->palette = gdi->palette;
}
else
{
xfc->palette = xfc->palette_hwgdi;
xfc->srcBpp = settings->ColorDepth;
xf_gdi_register_update_callbacks(update);
}

View File

@ -127,7 +127,8 @@ struct xf_context
HANDLE mutex;
BOOL UseXThreads;
BOOL cursorHidden;
BYTE palette[256 * 4];
BYTE* palette;
BYTE palette_hwgdi[256 * 4];
HGDI_DC hdc;
UINT32 bitmap_size;

View File

@ -1512,12 +1512,19 @@ int freerdp_image_copy_from_pointer_data(BYTE* pDstData, UINT32 DstFormat, int n
return 1;
}
else if (xorBpp == 24 || xorBpp == 32)
else if (xorBpp == 24 || xorBpp == 32 || xorBpp == 16 || xorBpp == 8)
{
int xorBytesPerPixel = xorBpp >> 3;
xorStep = nWidth * xorBytesPerPixel;
pDstPixel = (UINT32*) &pDstData[(nYDst * nDstStep) + (nXDst * 4)];
if (xorBpp == 8 && !palette)
{
WLog_ERR(TAG, "null palette in convertion from %d bpp to %d bpp",
xorBpp, dstBitsPerPixel);
return -1;
}
for (y = 0; y < nHeight; y++)
{
andBit = 0x80;
@ -1536,9 +1543,23 @@ int freerdp_image_copy_from_pointer_data(BYTE* pDstData, UINT32 DstFormat, int n
for (x = 0; x < nWidth; x++)
{
if (xorBpp == 32)
{
xorPixel = *((UINT32*) xorBits);
}
else if (xorBpp == 16)
{
UINT16 r, g, b;
GetRGB16(r, g, b, *(UINT16*)xorBits);
xorPixel = ARGB32(0xFF, r, g, b);
}
else if (xorBpp == 8)
{
xorPixel = 0xFF << 24 | ((UINT32*)palette)[xorBits[0]];
}
else
{
xorPixel = xorBits[0] | xorBits[1] << 8 | xorBits[2] << 16 | 0xFF << 24;
}
xorBits += xorBytesPerPixel;