mirror of https://github.com/FreeRDP/FreeRDP
libfreerdp-core: add update_check_flush
This commit is contained in:
parent
49b056bec0
commit
64d8c3d42b
|
@ -498,6 +498,25 @@ static void update_flush(rdpContext* context)
|
|||
}
|
||||
}
|
||||
|
||||
static BOOL update_check_flush(rdpContext* context, int size)
|
||||
{
|
||||
wStream* s;
|
||||
rdpUpdate* update = context->update;
|
||||
rdpSettings* settings = context->settings;
|
||||
|
||||
return TRUE;
|
||||
|
||||
s = update->us;
|
||||
|
||||
if (Stream_GetPosition(s) + size >= settings->MultifragMaxRequestSize)
|
||||
{
|
||||
update_flush(context);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void update_set_bounds(rdpContext* context, rdpBounds* bounds)
|
||||
{
|
||||
rdpUpdate* update = context->update;
|
||||
|
@ -754,6 +773,8 @@ static void update_send_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt)
|
|||
|
||||
headerLength = update_prepare_order_info(context, &orderInfo, ORDER_TYPE_DSTBLT);
|
||||
|
||||
update_check_flush(context, headerLength + update_approximate_dstblt_order(&orderInfo, dstblt));
|
||||
|
||||
s = update->us;
|
||||
offset = Stream_GetPosition(s);
|
||||
|
||||
|
@ -776,6 +797,8 @@ static void update_send_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
|||
|
||||
headerLength = update_prepare_order_info(context, &orderInfo, ORDER_TYPE_PATBLT);
|
||||
|
||||
update_check_flush(context, headerLength + update_approximate_patblt_order(&orderInfo, patblt));
|
||||
|
||||
s = update->us;
|
||||
offset = Stream_GetPosition(s);
|
||||
|
||||
|
@ -798,6 +821,8 @@ static void update_send_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt)
|
|||
|
||||
headerLength = update_prepare_order_info(context, &orderInfo, ORDER_TYPE_SCRBLT);
|
||||
|
||||
update_check_flush(context, headerLength + update_approximate_scrblt_order(&orderInfo, scrblt));
|
||||
|
||||
s = update->us;
|
||||
offset = Stream_GetPosition(s);
|
||||
|
||||
|
@ -820,6 +845,8 @@ static void update_send_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaq
|
|||
|
||||
headerLength = update_prepare_order_info(context, &orderInfo, ORDER_TYPE_OPAQUE_RECT);
|
||||
|
||||
update_check_flush(context, headerLength + update_approximate_opaque_rect_order(&orderInfo, opaque_rect));
|
||||
|
||||
s = update->us;
|
||||
offset = Stream_GetPosition(s);
|
||||
|
||||
|
@ -842,6 +869,8 @@ static void update_send_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
|
|||
|
||||
headerLength = update_prepare_order_info(context, &orderInfo, ORDER_TYPE_LINE_TO);
|
||||
|
||||
update_check_flush(context, headerLength + update_approximate_line_to_order(&orderInfo, line_to));
|
||||
|
||||
s = update->us;
|
||||
offset = Stream_GetPosition(s);
|
||||
|
||||
|
@ -864,6 +893,8 @@ static void update_send_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
|
|||
|
||||
headerLength = update_prepare_order_info(context, &orderInfo, ORDER_TYPE_MEMBLT);
|
||||
|
||||
update_check_flush(context, headerLength + update_approximate_memblt_order(&orderInfo, memblt));
|
||||
|
||||
s = update->us;
|
||||
offset = Stream_GetPosition(s);
|
||||
|
||||
|
@ -886,6 +917,8 @@ static void update_send_glyph_index(rdpContext* context, GLYPH_INDEX_ORDER* glyp
|
|||
|
||||
headerLength = update_prepare_order_info(context, &orderInfo, ORDER_TYPE_GLYPH_INDEX);
|
||||
|
||||
update_check_flush(context, headerLength + update_approximate_glyph_index_order(&orderInfo, glyph_index));
|
||||
|
||||
s = update->us;
|
||||
offset = Stream_GetPosition(s);
|
||||
|
||||
|
@ -914,6 +947,8 @@ static void update_send_cache_bitmap(rdpContext* context, CACHE_BITMAP_ORDER* ca
|
|||
orderType = cache_bitmap->compressed ?
|
||||
ORDER_TYPE_CACHE_BITMAP_COMPRESSED : ORDER_TYPE_BITMAP_UNCOMPRESSED;
|
||||
|
||||
update_check_flush(context, headerLength + update_approximate_cache_bitmap_order(cache_bitmap, cache_bitmap->compressed, &extraFlags));
|
||||
|
||||
s = update->us;
|
||||
bm = Stream_GetPosition(s);
|
||||
|
||||
|
@ -933,13 +968,6 @@ static void update_send_cache_bitmap(rdpContext* context, CACHE_BITMAP_ORDER* ca
|
|||
Stream_SetPosition(s, em);
|
||||
|
||||
update->numberOrders++;
|
||||
|
||||
/**
|
||||
* temporary workaround to avoid PDUs exceeding maximum size
|
||||
*/
|
||||
|
||||
update->EndPaint(context);
|
||||
update->BeginPaint(context);
|
||||
}
|
||||
|
||||
static void update_send_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2)
|
||||
|
@ -952,7 +980,7 @@ static void update_send_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORD
|
|||
INT16 orderLength;
|
||||
rdpUpdate* update = context->update;
|
||||
|
||||
update_flush(context);
|
||||
//update_flush(context);
|
||||
|
||||
extraFlags = 0;
|
||||
headerLength = 6;
|
||||
|
@ -960,6 +988,8 @@ static void update_send_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORD
|
|||
orderType = cache_bitmap_v2->compressed ?
|
||||
ORDER_TYPE_BITMAP_COMPRESSED_V2 : ORDER_TYPE_BITMAP_UNCOMPRESSED_V2;
|
||||
|
||||
update_check_flush(context, headerLength + update_approximate_cache_bitmap_v2_order(cache_bitmap_v2, cache_bitmap_v2->compressed, &extraFlags));
|
||||
|
||||
s = update->us;
|
||||
bm = Stream_GetPosition(s);
|
||||
|
||||
|
@ -969,8 +999,6 @@ static void update_send_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORD
|
|||
update_write_cache_bitmap_v2_order(s, cache_bitmap_v2, cache_bitmap_v2->compressed, &extraFlags);
|
||||
em = Stream_GetPosition(s);
|
||||
|
||||
printf("update_send_cache_bitmap_v2: orderLength: %d numberOrders: %d\n", orderLength, update->numberOrders);
|
||||
|
||||
orderLength = (em - bm) - 13;
|
||||
|
||||
Stream_SetPosition(s, bm);
|
||||
|
@ -982,11 +1010,7 @@ static void update_send_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORD
|
|||
|
||||
update->numberOrders++;
|
||||
|
||||
/**
|
||||
* temporary workaround to avoid PDUs exceeding maximum size
|
||||
*/
|
||||
|
||||
update_flush(context);
|
||||
//update_flush(context);
|
||||
}
|
||||
|
||||
static void update_send_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3)
|
||||
|
@ -1003,6 +1027,8 @@ static void update_send_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORD
|
|||
headerLength = 6;
|
||||
orderType = ORDER_TYPE_BITMAP_COMPRESSED_V3;
|
||||
|
||||
update_check_flush(context, headerLength + update_approximate_cache_bitmap_v3_order(cache_bitmap_v3, &extraFlags));
|
||||
|
||||
s = update->us;
|
||||
bm = Stream_GetPosition(s);
|
||||
|
||||
|
@ -1022,13 +1048,6 @@ static void update_send_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORD
|
|||
Stream_SetPosition(s, em);
|
||||
|
||||
update->numberOrders++;
|
||||
|
||||
/**
|
||||
* temporary workaround to avoid PDUs exceeding maximum size
|
||||
*/
|
||||
|
||||
update->EndPaint(context);
|
||||
update->BeginPaint(context);
|
||||
}
|
||||
|
||||
static void update_send_cache_color_table(rdpContext* context, CACHE_COLOR_TABLE_ORDER* cache_color_table)
|
||||
|
@ -1043,6 +1062,8 @@ static void update_send_cache_color_table(rdpContext* context, CACHE_COLOR_TABLE
|
|||
flags = 0;
|
||||
headerLength = 6;
|
||||
|
||||
update_check_flush(context, headerLength + update_approximate_cache_color_table_order(cache_color_table, &flags));
|
||||
|
||||
s = update->us;
|
||||
bm = Stream_GetPosition(s);
|
||||
|
||||
|
@ -1076,6 +1097,8 @@ static void update_send_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cach
|
|||
flags = 0;
|
||||
headerLength = 6;
|
||||
|
||||
update_check_flush(context, headerLength + update_approximate_cache_glyph_order(cache_glyph, &flags));
|
||||
|
||||
s = update->us;
|
||||
bm = Stream_GetPosition(s);
|
||||
|
||||
|
@ -1109,6 +1132,8 @@ static void update_send_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER
|
|||
flags = 0;
|
||||
headerLength = 6;
|
||||
|
||||
update_check_flush(context, headerLength + update_approximate_cache_glyph_v2_order(cache_glyph_v2, &flags));
|
||||
|
||||
s = update->us;
|
||||
bm = Stream_GetPosition(s);
|
||||
|
||||
|
@ -1142,6 +1167,8 @@ static void update_send_cache_brush(rdpContext* context, CACHE_BRUSH_ORDER* cach
|
|||
flags = 0;
|
||||
headerLength = 6;
|
||||
|
||||
update_check_flush(context, headerLength + update_approximate_cache_brush_order(cache_brush, &flags));
|
||||
|
||||
s = update->us;
|
||||
bm = Stream_GetPosition(s);
|
||||
|
||||
|
@ -1176,6 +1203,8 @@ static void update_send_create_offscreen_bitmap_order(rdpContext* context, CREAT
|
|||
orderType = ORDER_TYPE_CREATE_OFFSCREEN_BITMAP;
|
||||
controlFlags = ORDER_SECONDARY | (orderType << 2);
|
||||
|
||||
update_check_flush(context, headerLength + update_approximate_create_offscreen_bitmap_order(create_offscreen_bitmap));
|
||||
|
||||
s = update->us;
|
||||
bm = Stream_GetPosition(s);
|
||||
|
||||
|
@ -1205,6 +1234,8 @@ static void update_send_switch_surface_order(rdpContext* context, SWITCH_SURFACE
|
|||
orderType = ORDER_TYPE_SWITCH_SURFACE;
|
||||
controlFlags = ORDER_SECONDARY | (orderType << 2);
|
||||
|
||||
update_check_flush(context, headerLength + update_approximate_switch_surface_order(switch_surface));
|
||||
|
||||
s = update->us;
|
||||
bm = Stream_GetPosition(s);
|
||||
|
||||
|
|
Loading…
Reference in New Issue