mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2025-01-07 16:03:51 +08:00
libfreerdp-cache: apply bitmap cache v1 patch from Pawel Jakub Dawidek
This commit is contained in:
parent
26cd7bc476
commit
5f28591d3a
@ -74,6 +74,7 @@ struct _CACHE_BITMAP_ORDER
|
||||
uint32 bitmapHeight;
|
||||
uint32 bitmapLength;
|
||||
uint32 cacheIndex;
|
||||
boolean compressed;
|
||||
uint8 bitmapComprHdr[8];
|
||||
uint8* bitmapDataStream;
|
||||
};
|
||||
|
@ -53,7 +53,26 @@ void update_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
|
||||
|
||||
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)
|
||||
|
@ -1194,21 +1194,21 @@ void update_read_cache_bitmap_order(STREAM* s, CACHE_BITMAP_ORDER* cache_bitmap_
|
||||
|
||||
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)
|
||||
@ -1257,14 +1257,13 @@ void update_read_cache_bitmap_v2_order(STREAM* s, CACHE_BITMAP_V2_ORDER* cache_b
|
||||
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user