From 99b10aa98d00a73167b720873644fcdecfb1febc Mon Sep 17 00:00:00 2001 From: kubistika Date: Tue, 4 Jun 2019 17:33:18 +0300 Subject: [PATCH] rdpUpdate: add autoCalculateBitmapData flag --- include/freerdp/update.h | 5 +++++ libfreerdp/core/update.c | 20 ++++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/include/freerdp/update.h b/include/freerdp/update.h index b2e1a4c..9970f6f 100644 --- a/include/freerdp/update.h +++ b/include/freerdp/update.h @@ -253,6 +253,11 @@ struct rdp_update rdpBounds currentBounds; rdpBounds previousBounds; CRITICAL_SECTION mux; + + /* if autoCalculateBitmapData is set to TRUE, the server automatically + * fills BITMAP_DATA struct members: flags, cbCompMainBodySize and cbCompFirstRowSize. + */ + BOOL autoCalculateBitmapData; }; #endif /* FREERDP_UPDATE_H */ diff --git a/libfreerdp/core/update.c b/libfreerdp/core/update.c index 9d904c6..a21fcfe 100644 --- a/libfreerdp/core/update.c +++ b/libfreerdp/core/update.c @@ -148,16 +148,19 @@ static BOOL update_write_bitmap_data(rdpUpdate* update, wStream* s, if (!Stream_EnsureRemainingCapacity(s, 64 + bitmapData->bitmapLength)) return FALSE; - bitmapData->flags = 0; - bitmapData->cbCompFirstRowSize = 0; + if (update->autoCalculateBitmapData) + { + bitmapData->flags = 0; + bitmapData->cbCompFirstRowSize = 0; - if (bitmapData->compressed) - bitmapData->flags |= BITMAP_COMPRESSION; + if (bitmapData->compressed) + bitmapData->flags |= BITMAP_COMPRESSION; - if (update->context->settings->NoBitmapCompressionHeader) - { - bitmapData->flags |= NO_BITMAP_COMPRESSION_HDR; - bitmapData->cbCompMainBodySize = bitmapData->bitmapLength; + if (update->context->settings->NoBitmapCompressionHeader) + { + bitmapData->flags |= NO_BITMAP_COMPRESSION_HDR; + bitmapData->cbCompMainBodySize = bitmapData->bitmapLength; + } } Stream_Write_UINT16(s, bitmapData->destLeft); @@ -2190,6 +2193,7 @@ rdpUpdate* update_new(rdpRdp* rdp) deleteList->cIndices = 0; update->SuppressOutput = update_send_suppress_output; update->initialState = TRUE; + update->autoCalculateBitmapData = TRUE; update->queue = MessageQueue_New(&cb); if (!update->queue) -- 2.7.4