--- freerdp/include/freerdp/secondary.h 2012-01-01 22:42:57.000000000 0100 +++ freerdp/include/freerdp/secondary.h 2012-01-01 22:42:57.000000000 0100 @@ -74,6 +74,7 @@ uint32 bitmapHeight; uint32 bitmapLength; uint32 cacheIndex; + boolean compressed; uint8 bitmapComprHdr[8]; uint8* bitmapDataStream; }; --- freerdp/libfreerdp-cache/bitmap.c 2012-01-01 22:42:57.000000000 0100 +++ freerdp/libfreerdp-cache/bitmap.c 2012-01-01 22:42:57.000000000 0100 @@ -53,7 +53,26 @@ void update_gdi_cache_bitmap(rdpContext* context, CACHE_BITMAP_ORDER* cache_bitmap) { - printf("Warning: CacheBitmapV1 Unimplemented\n"); + rdpBitmap* bitmap; + rdpBitmap* prevBitmap; + rdpCache* cache = context->cache; + + bitmap = Bitmap_Alloc(context); + + Bitmap_SetDimensions(context, bitmap, cache_bitmap->bitmapWidth, cache_bitmap->bitmapHeight); + + bitmap->Decompress(context, bitmap, + cache_bitmap->bitmapDataStream, cache_bitmap->bitmapWidth, cache_bitmap->bitmapHeight, + cache_bitmap->bitmapBpp, cache_bitmap->bitmapLength, cache_bitmap->compressed); + + bitmap->New(context, bitmap); + + prevBitmap = bitmap_cache_get(cache->bitmap, cache_bitmap->cacheId, cache_bitmap->cacheIndex); + + if (prevBitmap != NULL) + Bitmap_Free(context, prevBitmap); + + bitmap_cache_put(cache->bitmap, cache_bitmap->cacheId, cache_bitmap->cacheIndex, bitmap); } void update_gdi_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2) --- freerdp/libfreerdp-core/orders.c 2012-01-01 22:42:57.000000000 0100 +++ freerdp/libfreerdp-core/orders.c 2012-01-01 22:42:57.000000000 0100 @@ -1194,21 +1194,21 @@ if (compressed) { - if (flags & NO_BITMAP_COMPRESSION_HDR) - { - stream_seek(s, cache_bitmap_order->bitmapLength); /* bitmapDataStream */ - } - else + if ((flags & NO_BITMAP_COMPRESSION_HDR) == 0) { uint8* bitmapComprHdr = (uint8*) &(cache_bitmap_order->bitmapComprHdr); stream_read(s, bitmapComprHdr, 8); /* bitmapComprHdr (8 bytes) */ - stream_seek(s, cache_bitmap_order->bitmapLength); /* bitmapDataStream */ + cache_bitmap_order->bitmapLength -= 8; } + stream_get_mark(s, cache_bitmap_order->bitmapDataStream); + stream_seek(s, cache_bitmap_order->bitmapLength); } else { + stream_get_mark(s, cache_bitmap_order->bitmapDataStream); stream_seek(s, cache_bitmap_order->bitmapLength); /* bitmapDataStream */ } + cache_bitmap_order->compressed = compressed; } void update_read_cache_bitmap_v2_order(STREAM* s, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2_order, boolean compressed, uint16 flags) @@ -1252,14 +1252,13 @@ stream_get_mark(s, cache_bitmap_v2_order->bitmapDataStream); stream_seek(s, cache_bitmap_v2_order->bitmapLength); - cache_bitmap_v2_order->compressed = true; } else { stream_get_mark(s, cache_bitmap_v2_order->bitmapDataStream); stream_seek(s, cache_bitmap_v2_order->bitmapLength); - cache_bitmap_v2_order->compressed = false; } + cache_bitmap_v2_order->compressed = compressed; } void update_read_cache_bitmap_v3_order(STREAM* s, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3_order, boolean compressed, uint16 flags)