Reverted bitmap update changes.

This commit is contained in:
Armin Novak 2016-07-20 16:50:20 +02:00
parent 3898b56618
commit c22d16bc09

View File

@ -486,40 +486,61 @@ static BOOL gdi_bitmap_update(rdpContext* context,
for (index = 0; index < bitmapUpdate->number; index++)
{
const BITMAP_DATA* bitmapData = &(bitmapUpdate->rectangles[index]);
rdpBitmap* bmp = Bitmap_Alloc(context);
const BITMAP_DATA* bitmap = &(bitmapUpdate->rectangles[index]);
UINT32 nXSrc = 0;
UINT32 nYSrc = 0;
UINT32 nXDst = bitmap->destLeft;
UINT32 nYDst = bitmap->destTop;
UINT32 nWidth = MIN(bitmap->destRight,
gdi->width - 1) - bitmap->destLeft + 1; /* clip width */
UINT32 nHeight = MIN(bitmap->destBottom,
gdi->height - 1) - bitmap->destTop + 1; /* clip height */
const BYTE* pSrcData = bitmap->bitmapDataStream;
UINT32 SrcSize = bitmap->bitmapLength;
BOOL compressed = bitmap->compressed;
UINT32 bitsPerPixel = bitmap->bitsPerPixel;
if (!bmp)
return FALSE;
Bitmap_SetRectangle(bmp, bitmapData->destLeft, bitmapData->destTop,
bitmapData->destRight, bitmapData->destBottom);
if (!bmp->Decompress(context, bmp, bitmapData->bitmapDataStream,
bitmapData->width, bitmapData->height,
bitmapData->bitsPerPixel, bitmapData->bitmapLength,
bitmapData->compressed, RDP_CODEC_ID_NONE))
if (compressed)
{
bmp->Free(context, bmp);
if (bitsPerPixel < 32)
{
if (!interleaved_decompress(codecs->interleaved,
pSrcData, SrcSize,
bitmap->width, bitmap->height,
bitsPerPixel,
gdi->primary_buffer,
gdi->primary->hdc->format,
gdi->stride, nXDst, nYDst,
nWidth, nHeight,
&gdi->palette))
return FALSE;
}
else
{
if (!planar_decompress(codecs->planar, pSrcData,
SrcSize, bitmap->width, bitmap->height,
gdi->primary_buffer,
gdi->primary->hdc->format,
gdi->stride,
nXDst, nYDst, nWidth, nHeight, TRUE))
return FALSE;
}
}
else
{
UINT32 SrcFormat = gdi_get_pixel_format(bitsPerPixel, TRUE);
UINT32 nSrcStep = nWidth * GetBytesPerPixel(SrcFormat);
if (!freerdp_image_copy(gdi->primary_buffer, gdi->primary->hdc->format,
gdi->stride,
nXDst, nYDst, nWidth, nHeight,
pSrcData, SrcFormat, nSrcStep,
nXSrc, nYSrc, &gdi->palette))
return FALSE;
}
if (!bmp->New(context, bmp))
{
bmp->Free(context, bmp);
return FALSE;
}
if (!bmp->Paint(context, bmp))
{
bmp->Free(context, bmp);
return FALSE;
}
bmp->Free(context, bmp);
if (!gdi_InvalidateRegion(gdi->primary->hdc, bmp->left, bmp->top,
bmp->width, bmp->height))
if (!gdi_InvalidateRegion(gdi->primary->hdc, nXDst, nYDst,
nWidth, nHeight))
return FALSE;
}