From 0c981407e5ffb66d5493c8b84a54941cb17d77a5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc-Andr=C3=A9=20Moreau?= Date: Thu, 4 Aug 2011 03:39:10 -0400 Subject: [PATCH] libfreerdp-core: don't decompress uncompressed bitmaps --- libfreerdp-core/update.c | 31 ++++++++++++++++--------------- libfreerdp-gdi/gdi.c | 6 ++++++ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/libfreerdp-core/update.c b/libfreerdp-core/update.c index fc3f950..983523b 100644 --- a/libfreerdp-core/update.c +++ b/libfreerdp-core/update.c @@ -74,25 +74,26 @@ void update_read_bitmap_data(STREAM* s, BITMAP_DATA* bitmap_data) dstSize = cbUncompressedSize; bitmap_data->length = cbCompMainBodySize; - } - else - { - dstSize = bitmap_data->width * bitmap_data->height * bytesPerPixel; - } - - stream_get_mark(s, srcData); - stream_seek(s, bitmap_data->length); - bitmap_data->data = (uint8*) xzalloc(dstSize); + bitmap_data->data = (uint8*) xzalloc(dstSize); - //printf("bytesPerPixel:%d, width:%d, height:%d dstSize:%d flags:0x%04X\n", - // bytesPerPixel, bitmap_data->width, bitmap_data->height, dstSize, bitmap_data->flags); + stream_get_mark(s, srcData); + stream_seek(s, bitmap_data->length); - status = bitmap_decompress(srcData, bitmap_data->data, bitmap_data->width, bitmap_data->height, - bitmap_data->length, bitmap_data->bpp, bitmap_data->bpp); + status = bitmap_decompress(srcData, bitmap_data->data, bitmap_data->width, bitmap_data->height, + bitmap_data->length, bitmap_data->bpp, bitmap_data->bpp); - if (status != True) - printf("bitmap decompression failed, bpp:%d\n", bitmap_data->bpp); + if (status != True) + printf("bitmap decompression failed, bpp:%d\n", bitmap_data->bpp); + } + else + { + stream_get_mark(s, srcData); + dstSize = bitmap_data->length; + stream_seek(s, bitmap_data->length); + bitmap_data->data = (uint8*) xzalloc(dstSize); + memcpy(bitmap_data->data, srcData, dstSize); + } } void update_read_bitmap(rdpUpdate* update, STREAM* s, BITMAP_UPDATE* bitmap_update) diff --git a/libfreerdp-gdi/gdi.c b/libfreerdp-gdi/gdi.c index a9ac1c5..1b59b1b 100644 --- a/libfreerdp-gdi/gdi.c +++ b/libfreerdp-gdi/gdi.c @@ -1117,6 +1117,8 @@ void gdi_patblt(rdpUpdate* update, PATBLT_ORDER* patblt) if (patblt->brushStyle & CACHED_BRUSH) { /* obtain brush from cache */ + printf("should obtain brush from cache.\n"); + return; } patblt->brushStyle &= 0x7F; @@ -1156,6 +1158,10 @@ void gdi_patblt(rdpUpdate* update, PATBLT_ORDER* patblt) gdi_DeleteObject((HGDIOBJECT) gdi->drawing->hdc->brush); gdi->drawing->hdc->brush = originalBrush; } + else + { + printf("unimplemented brush style:%d\n", patblt->brushStyle); + } } void gdi_scrblt(rdpUpdate* update, SCRBLT_ORDER* scrblt) -- 2.7.4