libfreerdp-cache: fix 15bpp

This commit is contained in:
Marc-André Moreau 2014-09-12 01:11:40 -04:00
parent 7130b7064e
commit efd9b8f7a9

View File

@ -107,13 +107,17 @@ void update_gdi_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORDER* cach
rdpBitmap* bitmap; rdpBitmap* bitmap;
rdpBitmap* prevBitmap; rdpBitmap* prevBitmap;
rdpCache* cache = context->cache; rdpCache* cache = context->cache;
rdpSettings* settings = context->settings;
bitmap = Bitmap_Alloc(context); bitmap = Bitmap_Alloc(context);
Bitmap_SetDimensions(context, bitmap, cacheBitmapV2->bitmapWidth, cacheBitmapV2->bitmapHeight); Bitmap_SetDimensions(context, bitmap, cacheBitmapV2->bitmapWidth, cacheBitmapV2->bitmapHeight);
if (!cacheBitmapV2->bitmapBpp) if (!cacheBitmapV2->bitmapBpp)
cacheBitmapV2->bitmapBpp = context->settings->ColorDepth; cacheBitmapV2->bitmapBpp = settings->ColorDepth;
if ((settings->ColorDepth == 15) && (cacheBitmapV2->bitmapBpp == 16))
cacheBitmapV2->bitmapBpp = settings->ColorDepth;
bitmap->Decompress(context, bitmap, bitmap->Decompress(context, bitmap,
cacheBitmapV2->bitmapDataStream, cacheBitmapV2->bitmapWidth, cacheBitmapV2->bitmapHeight, cacheBitmapV2->bitmapDataStream, cacheBitmapV2->bitmapWidth, cacheBitmapV2->bitmapHeight,
@ -134,8 +138,9 @@ void update_gdi_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORDER* cach
{ {
rdpBitmap* bitmap; rdpBitmap* bitmap;
rdpBitmap* prevBitmap; rdpBitmap* prevBitmap;
BOOL isCompressed = TRUE; BOOL compressed = TRUE;
rdpCache* cache = context->cache; rdpCache* cache = context->cache;
rdpSettings* settings = context->settings;
BITMAP_DATA_EX* bitmapData = &cacheBitmapV3->bitmapData; BITMAP_DATA_EX* bitmapData = &cacheBitmapV3->bitmapData;
bitmap = Bitmap_Alloc(context); bitmap = Bitmap_Alloc(context);
@ -143,15 +148,13 @@ void update_gdi_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORDER* cach
Bitmap_SetDimensions(context, bitmap, bitmapData->width, bitmapData->height); Bitmap_SetDimensions(context, bitmap, bitmapData->width, bitmapData->height);
if (!cacheBitmapV3->bpp) if (!cacheBitmapV3->bpp)
cacheBitmapV3->bpp = context->settings->ColorDepth; cacheBitmapV3->bpp = settings->ColorDepth;
/* According to http://msdn.microsoft.com/en-us/library/gg441209.aspx compressed = (bitmapData->codecID != RDP_CODEC_ID_NONE);
* CACHE_BITMAP_REV3_ORDER::bitmapData::codecID = 0x00 (uncompressed) */
isCompressed = (bitmapData->codecID != RDP_CODEC_ID_NONE);
bitmap->Decompress(context, bitmap, bitmap->Decompress(context, bitmap,
bitmapData->data, bitmap->width, bitmap->height, bitmapData->data, bitmap->width, bitmap->height,
bitmapData->bpp, bitmapData->length, isCompressed, bitmapData->bpp, bitmapData->length, compressed,
bitmapData->codecID); bitmapData->codecID);
bitmap->New(context, bitmap); bitmap->New(context, bitmap);