diff --git a/client/X11/xf_gdi.c b/client/X11/xf_gdi.c index b324dabe9..18e4e1001 100644 --- a/client/X11/xf_gdi.c +++ b/client/X11/xf_gdi.c @@ -541,7 +541,7 @@ void xf_gdi_cache_bitmap_v2(rdpUpdate* update, CACHE_BITMAP_V2_ORDER* cache_bitm xfInfo* xfi = GET_XFI(update); bitmap_v2_put(xfi->cache->bitmap_v2, cache_bitmap_v2->cacheId, - cache_bitmap_v2->cacheIndex, cache_bitmap_v2->bitmapDataStream); + cache_bitmap_v2->cacheIndex, cache_bitmap_v2->data); } void xf_gdi_cache_color_table(rdpUpdate* update, CACHE_COLOR_TABLE_ORDER* cache_color_table) diff --git a/client/X11/xfreerdp.c b/client/X11/xfreerdp.c index ad2924814..7c2879ae4 100644 --- a/client/X11/xfreerdp.c +++ b/client/X11/xfreerdp.c @@ -298,8 +298,10 @@ boolean xf_pre_connect(freerdp* instance) settings->order_support[NEG_MULTI_DRAWNINEGRID_INDEX] = False; settings->order_support[NEG_LINETO_INDEX] = True; settings->order_support[NEG_POLYLINE_INDEX] = True; - settings->order_support[NEG_MEMBLT_INDEX] = True; + settings->order_support[NEG_MEMBLT_INDEX] = False; settings->order_support[NEG_MEM3BLT_INDEX] = False; + settings->order_support[NEG_MEMBLT_V2_INDEX] = False; + settings->order_support[NEG_MEM3BLT_V2_INDEX] = False; settings->order_support[NEG_SAVEBITMAP_INDEX] = True; settings->order_support[NEG_GLYPH_INDEX_INDEX] = True; settings->order_support[NEG_FAST_INDEX_INDEX] = True; diff --git a/include/freerdp/settings.h b/include/freerdp/settings.h index 9adf77bb7..978f9b98c 100644 --- a/include/freerdp/settings.h +++ b/include/freerdp/settings.h @@ -58,11 +58,16 @@ #define NEG_SCRBLT_INDEX 0x02 #define NEG_MEMBLT_INDEX 0x03 #define NEG_MEM3BLT_INDEX 0x04 +#define NEG_ATEXTOUT_INDEX 0x05 +#define NEG_AEXTTEXTOUT_INDEX 0x06 #define NEG_DRAWNINEGRID_INDEX 0x07 #define NEG_LINETO_INDEX 0x08 #define NEG_MULTI_DRAWNINEGRID_INDEX 0x09 #define NEG_OPAQUE_RECT_INDEX 0x0A #define NEG_SAVEBITMAP_INDEX 0x0B +#define NEG_WTEXTOUT_INDEX 0x0C +#define NEG_MEMBLT_V2_INDEX 0x0D +#define NEG_MEM3BLT_V2_INDEX 0x0E #define NEG_MULTIDSTBLT_INDEX 0x0F #define NEG_MULTIPATBLT_INDEX 0x10 #define NEG_MULTISCRBLT_INDEX 0x11 @@ -75,6 +80,9 @@ #define NEG_ELLIPSE_SC_INDEX 0x19 #define NEG_ELLIPSE_CB_INDEX 0x1A #define NEG_GLYPH_INDEX_INDEX 0x1B +#define NEG_GLYPH_WEXTTEXTOUT_INDEX 0x1C +#define NEG_GLYPH_WLONGTEXTOUT_INDEX 0x1D +#define NEG_GLYPH_WLONGEXTTEXTOUT_INDEX 0x1E /* Glyph Support Level */ #define GLYPH_SUPPORT_NONE 0x0000 diff --git a/include/freerdp/update.h b/include/freerdp/update.h index 05b84611f..82afa1282 100644 --- a/include/freerdp/update.h +++ b/include/freerdp/update.h @@ -530,6 +530,7 @@ struct _CACHE_BITMAP_V2_ORDER uint16 cacheIndex; uint8 bitmapComprHdr[8]; uint8* bitmapDataStream; + uint8* data; }; typedef struct _CACHE_BITMAP_V2_ORDER CACHE_BITMAP_V2_ORDER; diff --git a/libfreerdp-cache/bitmap_v2.c b/libfreerdp-cache/bitmap_v2.c index d6350542b..667b8d3f2 100644 --- a/libfreerdp-cache/bitmap_v2.c +++ b/libfreerdp-cache/bitmap_v2.c @@ -79,7 +79,7 @@ rdpBitmapV2* bitmap_v2_new(rdpSettings* settings) bitmap_v2->maxCells = 5; - settings->bitmap_cache = True; + settings->bitmap_cache = False; settings->bitmapCacheV2NumCells = 5; settings->bitmapCacheV2CellInfo[0].numEntries = 600; settings->bitmapCacheV2CellInfo[0].persistent = False; diff --git a/libfreerdp-core/capabilities.c b/libfreerdp-core/capabilities.c index a1def6085..25ef026d7 100644 --- a/libfreerdp-core/capabilities.c +++ b/libfreerdp-core/capabilities.c @@ -900,7 +900,7 @@ void rdp_write_bitmap_cache_host_support_capability_set(STREAM* s, rdpSettings* rdp_capability_set_finish(s, header, CAPSET_TYPE_BITMAP_CACHE_HOST_SUPPORT); } -void rdp_write_bitmap_cache_cell_info(STREAM* s, uint16 numEntries, boolean persistent) +void rdp_write_bitmap_cache_cell_info(STREAM* s, BITMAP_CACHE_V2_CELL_INFO* cellInfo) { uint32 info; @@ -909,8 +909,7 @@ void rdp_write_bitmap_cache_cell_info(STREAM* s, uint16 numEntries, boolean pers * is used to indicate a persistent bitmap cache. */ - info = numEntries & persistent; - + info = cellInfo->numEntries || (cellInfo->persistent << 31); stream_write_uint32(s, info); } @@ -955,12 +954,12 @@ void rdp_write_bitmap_cache_v2_capability_set(STREAM* s, rdpSettings* settings) stream_write_uint16(s, cacheFlags); /* cacheFlags (2 bytes) */ stream_write_uint8(s, 0); /* pad2 (1 byte) */ - stream_write_uint8(s, 5); /* numCellCaches (1 byte) */ - rdp_write_bitmap_cache_cell_info(s, 600, 0); /* bitmapCache0CellInfo (4 bytes) */ - rdp_write_bitmap_cache_cell_info(s, 600, 0); /* bitmapCache1CellInfo (4 bytes) */ - rdp_write_bitmap_cache_cell_info(s, 2048, 0); /* bitmapCache2CellInfo (4 bytes) */ - rdp_write_bitmap_cache_cell_info(s, 4096, 0); /* bitmapCache3CellInfo (4 bytes) */ - rdp_write_bitmap_cache_cell_info(s, 2048, 0); /* bitmapCache4CellInfo (4 bytes) */ + stream_write_uint8(s, settings->bitmapCacheV2NumCells); /* numCellCaches (1 byte) */ + rdp_write_bitmap_cache_cell_info(s, &settings->bitmapCacheV2CellInfo[0]); /* bitmapCache0CellInfo (4 bytes) */ + rdp_write_bitmap_cache_cell_info(s, &settings->bitmapCacheV2CellInfo[1]); /* bitmapCache1CellInfo (4 bytes) */ + rdp_write_bitmap_cache_cell_info(s, &settings->bitmapCacheV2CellInfo[2]); /* bitmapCache2CellInfo (4 bytes) */ + rdp_write_bitmap_cache_cell_info(s, &settings->bitmapCacheV2CellInfo[3]); /* bitmapCache3CellInfo (4 bytes) */ + rdp_write_bitmap_cache_cell_info(s, &settings->bitmapCacheV2CellInfo[4]); /* bitmapCache4CellInfo (4 bytes) */ stream_write_zero(s, 12); /* pad3 (12 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_BITMAP_CACHE_V2); diff --git a/libfreerdp-core/orders.c b/libfreerdp-core/orders.c index 03df80b84..d6e1f3643 100644 --- a/libfreerdp-core/orders.c +++ b/libfreerdp-core/orders.c @@ -18,6 +18,7 @@ */ #include "window.h" +#include "bitmap.h" #include #include "orders.h" @@ -1359,6 +1360,9 @@ void update_read_cache_bitmap_order(STREAM* s, CACHE_BITMAP_ORDER* cache_bitmap_ void update_read_cache_bitmap_v2_order(STREAM* s, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2_order, boolean compressed, uint16 flags) { + boolean status; + uint16 dstSize; + uint8* srcData; uint8 bitsPerPixelId; cache_bitmap_v2_order->cacheId = flags & 0x0003; @@ -1389,20 +1393,40 @@ void update_read_cache_bitmap_v2_order(STREAM* s, CACHE_BITMAP_V2_ORDER* cache_b if (compressed) { - if (cache_bitmap_v2_order->flags & CBR2_NO_BITMAP_COMPRESSION_HDR) - { - stream_seek(s, cache_bitmap_v2_order->bitmapLength); /* bitmapDataStream */ - } - else + if (!(cache_bitmap_v2_order->flags & CBR2_NO_BITMAP_COMPRESSION_HDR)) { uint8* bitmapComprHdr = (uint8*) &(cache_bitmap_v2_order->bitmapComprHdr); stream_read(s, bitmapComprHdr, 8); /* bitmapComprHdr (8 bytes) */ - stream_seek(s, cache_bitmap_v2_order->bitmapLength); /* bitmapDataStream */ } + + dstSize = cache_bitmap_v2_order->bitmapLength; + cache_bitmap_v2_order->data = (uint8*) xmalloc(dstSize); + + stream_get_mark(s, srcData); + stream_seek(s, cache_bitmap_v2_order->bitmapLength); + + status = bitmap_decompress(srcData, cache_bitmap_v2_order->data, cache_bitmap_v2_order->bitmapWidth, + cache_bitmap_v2_order->bitmapHeight, cache_bitmap_v2_order->bitmapLength, + cache_bitmap_v2_order->bitmapBpp, cache_bitmap_v2_order->bitmapBpp); + + if (status != True) + printf("bitmap decompression failed, bpp:%d\n", cache_bitmap_v2_order->bitmapBpp); } else { - stream_seek(s, cache_bitmap_v2_order->bitmapLength); /* bitmapDataStream */ + int y; + int offset; + int scanline; + stream_get_mark(s, srcData); + dstSize = cache_bitmap_v2_order->bitmapLength; + cache_bitmap_v2_order->data = (uint8*) xmalloc(dstSize); + scanline = cache_bitmap_v2_order->bitmapWidth * (cache_bitmap_v2_order->bitmapBpp / 8); + + for (y = 0; y < cache_bitmap_v2_order->bitmapHeight; y++) + { + offset = (cache_bitmap_v2_order->bitmapHeight - y - 1) * scanline; + stream_read(s, &cache_bitmap_v2_order->data[offset], scanline); + } } } diff --git a/libfreerdp-core/settings.c b/libfreerdp-core/settings.c index b3fc2bb8d..4d5debe7d 100644 --- a/libfreerdp-core/settings.c +++ b/libfreerdp-core/settings.c @@ -100,7 +100,7 @@ rdpSettings* settings_new() settings->frame_marker = False; settings->bitmap_cache_v3 = False; - settings->bitmap_cache = True; + settings->bitmap_cache = False; settings->persistent_bitmap_cache = False; settings->glyphSupportLevel = GLYPH_SUPPORT_NONE;