libfreerdp-gdi: fix 16bpp internal buffer format
This commit is contained in:
parent
48b35be953
commit
3b02eccc06
@ -493,7 +493,6 @@ void gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
|
|||||||
int nYSrc;
|
int nYSrc;
|
||||||
int nWidth;
|
int nWidth;
|
||||||
int nHeight;
|
int nHeight;
|
||||||
int nSrcStep;
|
|
||||||
int nDstStep;
|
int nDstStep;
|
||||||
UINT32 index;
|
UINT32 index;
|
||||||
BYTE* pSrcData;
|
BYTE* pSrcData;
|
||||||
@ -502,7 +501,6 @@ void gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
|
|||||||
BOOL compressed;
|
BOOL compressed;
|
||||||
UINT32 SrcFormat;
|
UINT32 SrcFormat;
|
||||||
UINT32 bitsPerPixel;
|
UINT32 bitsPerPixel;
|
||||||
UINT32 bytesPerPixel;
|
|
||||||
BITMAP_DATA* bitmap;
|
BITMAP_DATA* bitmap;
|
||||||
rdpGdi* gdi = context->gdi;
|
rdpGdi* gdi = context->gdi;
|
||||||
rdpCodecs* codecs = context->codecs;
|
rdpCodecs* codecs = context->codecs;
|
||||||
@ -525,9 +523,6 @@ void gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
|
|||||||
|
|
||||||
compressed = bitmap->compressed;
|
compressed = bitmap->compressed;
|
||||||
bitsPerPixel = bitmap->bitsPerPixel;
|
bitsPerPixel = bitmap->bitsPerPixel;
|
||||||
bytesPerPixel = (bitsPerPixel + 7) / 8;
|
|
||||||
|
|
||||||
SrcFormat = gdi_get_pixel_format(bitsPerPixel, TRUE);
|
|
||||||
|
|
||||||
if (gdi->bitmap_size < (nWidth * nHeight * 4))
|
if (gdi->bitmap_size < (nWidth * nHeight * 4))
|
||||||
{
|
{
|
||||||
@ -547,14 +542,14 @@ void gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
|
|||||||
freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_INTERLEAVED);
|
freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_INTERLEAVED);
|
||||||
|
|
||||||
status = interleaved_decompress(codecs->interleaved, pSrcData, SrcSize, bitsPerPixel,
|
status = interleaved_decompress(codecs->interleaved, pSrcData, SrcSize, bitsPerPixel,
|
||||||
&pDstData, SrcFormat, nWidth * bytesPerPixel, 0, 0, nWidth, nHeight);
|
&pDstData, gdi->format, -1, 0, 0, nWidth, nHeight);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_PLANAR);
|
freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_PLANAR);
|
||||||
|
|
||||||
status = planar_decompress(codecs->planar, pSrcData, SrcSize, &pDstData,
|
status = planar_decompress(codecs->planar, pSrcData, SrcSize, &pDstData,
|
||||||
gdi->format, nWidth * 4, 0, 0, nWidth, nHeight, TRUE);
|
gdi->format, -1, 0, 0, nWidth, nHeight, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
@ -565,17 +560,25 @@ void gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
|
|||||||
|
|
||||||
pSrcData = gdi->bitmap_buffer;
|
pSrcData = gdi->bitmap_buffer;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pDstData = gdi->bitmap_buffer;
|
||||||
|
SrcFormat = gdi_get_pixel_format(bitsPerPixel, TRUE);
|
||||||
|
|
||||||
nSrcStep = nWidth * bytesPerPixel;
|
status = freerdp_image_copy(pDstData, gdi->format, -1, 0, 0,
|
||||||
|
nWidth, nHeight, pSrcData, SrcFormat, -1, 0, 0);
|
||||||
|
|
||||||
|
pSrcData = gdi->bitmap_buffer;
|
||||||
|
}
|
||||||
|
|
||||||
pDstData = gdi->primary_buffer;
|
pDstData = gdi->primary_buffer;
|
||||||
nDstStep = gdi->width * 4;
|
nDstStep = gdi->width * gdi->bytesPerPixel;
|
||||||
|
|
||||||
nWidth = bitmap->destRight - bitmap->destLeft + 1; /* clip width */
|
nWidth = bitmap->destRight - bitmap->destLeft + 1; /* clip width */
|
||||||
nHeight = bitmap->destBottom - bitmap->destTop + 1; /* clip height */
|
nHeight = bitmap->destBottom - bitmap->destTop + 1; /* clip height */
|
||||||
|
|
||||||
status = freerdp_image_copy(pDstData, gdi->format, nDstStep, nXDst, nYDst,
|
status = freerdp_image_copy(pDstData, gdi->format, nDstStep, nXDst, nYDst,
|
||||||
nWidth, nHeight, pSrcData, SrcFormat, nSrcStep, nXSrc, nYSrc);
|
nWidth, nHeight, pSrcData, gdi->format, -1, nXSrc, nYSrc);
|
||||||
|
|
||||||
gdi_InvalidateRegion(gdi->primary->hdc, nXDst, nYDst, nWidth, nHeight);
|
gdi_InvalidateRegion(gdi->primary->hdc, nXDst, nYDst, nWidth, nHeight);
|
||||||
}
|
}
|
||||||
@ -925,11 +928,8 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
|
|||||||
|
|
||||||
DEBUG_GDI("destLeft %d destTop %d destRight %d destBottom %d "
|
DEBUG_GDI("destLeft %d destTop %d destRight %d destBottom %d "
|
||||||
"bpp %d codecID %d width %d height %d length %d",
|
"bpp %d codecID %d width %d height %d length %d",
|
||||||
cmd->destLeft, cmd->destTop,
|
cmd->destLeft, cmd->destTop, cmd->destRight, cmd->destBottom,
|
||||||
cmd->destRight, cmd->destBottom,
|
cmd->bpp, cmd->codecID, cmd->width, cmd->height, cmd->bitmapDataLength);
|
||||||
cmd->bpp, cmd->codecID,
|
|
||||||
cmd->width, cmd->height,
|
|
||||||
cmd->bitmapDataLength);
|
|
||||||
|
|
||||||
if (cmd->codecID == RDP_CODEC_ID_REMOTEFX)
|
if (cmd->codecID == RDP_CODEC_ID_REMOTEFX)
|
||||||
{
|
{
|
||||||
@ -946,14 +946,14 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
|
|||||||
pSrcData = message->tiles[i]->data;
|
pSrcData = message->tiles[i]->data;
|
||||||
pDstData = gdi->tile->bitmap->data;
|
pDstData = gdi->tile->bitmap->data;
|
||||||
|
|
||||||
if (!gdi->abgr)
|
if (!gdi->abgr && (gdi->dstBpp == 32))
|
||||||
{
|
{
|
||||||
gdi->tile->bitmap->data = pSrcData;
|
gdi->tile->bitmap->data = pSrcData;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
freerdp_image_copy(pDstData, gdi->format, 64 * 4, 0, 0,
|
freerdp_image_copy(pDstData, gdi->format, -1, 0, 0,
|
||||||
64, 64, pSrcData, PIXEL_FORMAT_XRGB32, 64 * 4, 0, 0);
|
64, 64, pSrcData, PIXEL_FORMAT_XRGB32, -1, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < message->numRects; j++)
|
for (j = 0; j < message->numRects; j++)
|
||||||
@ -990,8 +990,8 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
|
|||||||
pDstData = gdi->bitmap_buffer;
|
pDstData = gdi->bitmap_buffer;
|
||||||
pSrcData = gdi->codecs->nsc->BitmapData;
|
pSrcData = gdi->codecs->nsc->BitmapData;
|
||||||
|
|
||||||
freerdp_image_copy(pDstData, gdi->format, cmd->width * gdi->bytesPerPixel, 0, 0,
|
freerdp_image_copy(pDstData, gdi->format, -1, 0, 0,
|
||||||
cmd->width, cmd->height, pSrcData, PIXEL_FORMAT_XRGB32_VF, cmd->width * 4, 0, 0);
|
cmd->width, cmd->height, pSrcData, PIXEL_FORMAT_XRGB32_VF, -1, 0, 0);
|
||||||
|
|
||||||
gdi->image->bitmap->width = cmd->width;
|
gdi->image->bitmap->width = cmd->width;
|
||||||
gdi->image->bitmap->height = cmd->height;
|
gdi->image->bitmap->height = cmd->height;
|
||||||
@ -1015,8 +1015,8 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
|
|||||||
pDstData = gdi->bitmap_buffer;
|
pDstData = gdi->bitmap_buffer;
|
||||||
pSrcData = cmd->bitmapData;
|
pSrcData = cmd->bitmapData;
|
||||||
|
|
||||||
freerdp_image_copy(pDstData, gdi->format, cmd->width * gdi->bytesPerPixel, 0, 0,
|
freerdp_image_copy(pDstData, gdi->format, -1, 0, 0,
|
||||||
cmd->width, cmd->height, pSrcData, PIXEL_FORMAT_XRGB32_VF, cmd->width * 4, 0, 0);
|
cmd->width, cmd->height, pSrcData, PIXEL_FORMAT_XRGB32_VF, -1, 0, 0);
|
||||||
|
|
||||||
gdi->image->bitmap->width = cmd->width;
|
gdi->image->bitmap->width = cmd->width;
|
||||||
gdi->image->bitmap->height = cmd->height;
|
gdi->image->bitmap->height = cmd->height;
|
||||||
|
@ -52,8 +52,8 @@ int gdi_OutputUpdate(rdpGdi* gdi)
|
|||||||
if (!gdi->graphicsReset)
|
if (!gdi->graphicsReset)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
nDstStep = gdi->width * 4;
|
|
||||||
pDstData = gdi->primary_buffer;
|
pDstData = gdi->primary_buffer;
|
||||||
|
nDstStep = gdi->bytesPerPixel * gdi->width;
|
||||||
|
|
||||||
surface = (gdiGfxSurface*) gdi->gfx->GetSurfaceData(gdi->gfx, gdi->outputSurfaceId);
|
surface = (gdiGfxSurface*) gdi->gfx->GetSurfaceData(gdi->gfx, gdi->outputSurfaceId);
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ void gdi_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
|
|||||||
if (!bitmap->data)
|
if (!bitmap->data)
|
||||||
gdi_bitmap->bitmap = gdi_CreateCompatibleBitmap(gdi->hdc, bitmap->width, bitmap->height);
|
gdi_bitmap->bitmap = gdi_CreateCompatibleBitmap(gdi->hdc, bitmap->width, bitmap->height);
|
||||||
else
|
else
|
||||||
gdi_bitmap->bitmap = gdi_create_bitmap(gdi, bitmap->width, bitmap->height, gdi->dstBpp, bitmap->data);
|
gdi_bitmap->bitmap = gdi_create_bitmap(gdi, bitmap->width, bitmap->height, bitmap->bpp, bitmap->data);
|
||||||
|
|
||||||
gdi_SelectObject(gdi_bitmap->hdc, (HGDIOBJECT) gdi_bitmap->bitmap);
|
gdi_SelectObject(gdi_bitmap->hdc, (HGDIOBJECT) gdi_bitmap->bitmap);
|
||||||
gdi_bitmap->org_bitmap = NULL;
|
gdi_bitmap->org_bitmap = NULL;
|
||||||
@ -160,10 +160,7 @@ void gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
|||||||
bytesPerPixel = (bpp + 7) / 8;
|
bytesPerPixel = (bpp + 7) / 8;
|
||||||
size = width * height * 4;
|
size = width * height * 4;
|
||||||
|
|
||||||
if (!bitmap->data)
|
bitmap->data = (BYTE*) _aligned_malloc(size, 16);
|
||||||
bitmap->data = (BYTE*) _aligned_malloc(size, 16);
|
|
||||||
else
|
|
||||||
bitmap->data = (BYTE*) _aligned_realloc(bitmap->data, size, 16);
|
|
||||||
|
|
||||||
pSrcData = data;
|
pSrcData = data;
|
||||||
SrcSize = (UINT32) length;
|
SrcSize = (UINT32) length;
|
||||||
@ -176,14 +173,14 @@ void gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
|||||||
freerdp_client_codecs_prepare(gdi->codecs, FREERDP_CODEC_INTERLEAVED);
|
freerdp_client_codecs_prepare(gdi->codecs, FREERDP_CODEC_INTERLEAVED);
|
||||||
|
|
||||||
status = interleaved_decompress(gdi->codecs->interleaved, pSrcData, SrcSize, bpp,
|
status = interleaved_decompress(gdi->codecs->interleaved, pSrcData, SrcSize, bpp,
|
||||||
&pDstData, PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height);
|
&pDstData, gdi->format, -1, 0, 0, width, height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
freerdp_client_codecs_prepare(gdi->codecs, FREERDP_CODEC_PLANAR);
|
freerdp_client_codecs_prepare(gdi->codecs, FREERDP_CODEC_PLANAR);
|
||||||
|
|
||||||
status = planar_decompress(gdi->codecs->planar, pSrcData, SrcSize, &pDstData,
|
status = planar_decompress(gdi->codecs->planar, pSrcData, SrcSize, &pDstData,
|
||||||
PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height, FALSE);
|
gdi->format, -1, 0, 0, width, height, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
@ -196,13 +193,13 @@ void gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
|||||||
{
|
{
|
||||||
SrcFormat = gdi_get_pixel_format(bpp, TRUE);
|
SrcFormat = gdi_get_pixel_format(bpp, TRUE);
|
||||||
|
|
||||||
status = freerdp_image_copy(pDstData, PIXEL_FORMAT_XRGB32, width * 4, 0, 0,
|
status = freerdp_image_copy(pDstData, gdi->format, -1, 0, 0,
|
||||||
width, height, pSrcData, SrcFormat, width * bytesPerPixel, 0, 0);
|
width, height, pSrcData, SrcFormat, -1, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bitmap->compressed = FALSE;
|
bitmap->compressed = FALSE;
|
||||||
bitmap->length = size;
|
bitmap->length = size;
|
||||||
bitmap->bpp = 32;
|
bitmap->bpp = gdi->dstBpp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gdi_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
|
void gdi_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
|
||||||
|
Loading…
Reference in New Issue
Block a user