libfreerdp-core: force flushing of updates

This commit is contained in:
Marc-André Moreau 2013-06-09 20:37:58 -04:00
parent 64d8c3d42b
commit 404f66820b
2 changed files with 45 additions and 8 deletions

View File

@ -2486,7 +2486,7 @@ BOOL update_write_cache_brush_order(wStream* s, CACHE_BRUSH_ORDER* cache_brush,
BYTE iBitmapFormat;
BOOL compressed = FALSE;
Stream_EnsureRemainingCapacity(s, update_approximate_cache_brush_order);
Stream_EnsureRemainingCapacity(s, update_approximate_cache_brush_order(cache_brush, flags));
iBitmapFormat = BPP_BMF[cache_brush->bpp];
@ -2657,9 +2657,9 @@ int update_approximate_switch_surface_order(SWITCH_SURFACE_ORDER* switch_surface
BOOL update_write_switch_surface_order(wStream* s, SWITCH_SURFACE_ORDER* switch_surface)
{
Stream_EnsureRemainingCapacity(s, 2);
Stream_EnsureRemainingCapacity(s, update_approximate_switch_surface_order(switch_surface));
Stream_Write_UINT16(s, update_approximate_switch_surface_order(switch_surface)); /* bitmapId (2 bytes) */
Stream_Write_UINT16(s, switch_surface->bitmapId); /* bitmapId (2 bytes) */
return TRUE;
}

View File

@ -498,17 +498,26 @@ static void update_flush(rdpContext* context)
}
}
static void update_force_flush(rdpContext* context)
{
rdpUpdate* update = context->update;
if (update->numberOrders > 0)
{
update->EndPaint(context);
update->BeginPaint(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)
if (Stream_GetPosition(s) + size + 256 >= settings->MultifragMaxRequestSize)
{
update_flush(context);
return TRUE;
@ -980,7 +989,7 @@ static void update_send_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORD
INT16 orderLength;
rdpUpdate* update = context->update;
//update_flush(context);
update_force_flush(context);
extraFlags = 0;
headerLength = 6;
@ -1010,7 +1019,7 @@ static void update_send_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORD
update->numberOrders++;
//update_flush(context);
update_force_flush(context);
}
static void update_send_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3)
@ -1023,6 +1032,8 @@ static void update_send_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORD
INT16 orderLength;
rdpUpdate* update = context->update;
update_force_flush(context);
extraFlags = 0;
headerLength = 6;
orderType = ORDER_TYPE_BITMAP_COMPRESSED_V3;
@ -1048,6 +1059,8 @@ static void update_send_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORD
Stream_SetPosition(s, em);
update->numberOrders++;
update_force_flush(context);
}
static void update_send_cache_color_table(rdpContext* context, CACHE_COLOR_TABLE_ORDER* cache_color_table)
@ -1059,6 +1072,8 @@ static void update_send_cache_color_table(rdpContext* context, CACHE_COLOR_TABLE
INT16 orderLength;
rdpUpdate* update = context->update;
update_force_flush(context);
flags = 0;
headerLength = 6;
@ -1083,6 +1098,8 @@ static void update_send_cache_color_table(rdpContext* context, CACHE_COLOR_TABLE
Stream_SetPosition(s, em);
update->numberOrders++;
update_force_flush(context);
}
static void update_send_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cache_glyph)
@ -1094,6 +1111,8 @@ static void update_send_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cach
INT16 orderLength;
rdpUpdate* update = context->update;
update_force_flush(context);
flags = 0;
headerLength = 6;
@ -1118,6 +1137,8 @@ static void update_send_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cach
Stream_SetPosition(s, em);
update->numberOrders++;
update_force_flush(context);
}
static void update_send_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER* cache_glyph_v2)
@ -1129,6 +1150,8 @@ static void update_send_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER
INT16 orderLength;
rdpUpdate* update = context->update;
update_force_flush(context);
flags = 0;
headerLength = 6;
@ -1153,6 +1176,8 @@ static void update_send_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER
Stream_SetPosition(s, em);
update->numberOrders++;
update_force_flush(context);
}
static void update_send_cache_brush(rdpContext* context, CACHE_BRUSH_ORDER* cache_brush)
@ -1164,6 +1189,8 @@ static void update_send_cache_brush(rdpContext* context, CACHE_BRUSH_ORDER* cach
INT16 orderLength;
rdpUpdate* update = context->update;
update_force_flush(context);
flags = 0;
headerLength = 6;
@ -1188,6 +1215,8 @@ static void update_send_cache_brush(rdpContext* context, CACHE_BRUSH_ORDER* cach
Stream_SetPosition(s, em);
update->numberOrders++;
update_force_flush(context);
}
static void update_send_create_offscreen_bitmap_order(rdpContext* context, CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap)
@ -1199,6 +1228,8 @@ static void update_send_create_offscreen_bitmap_order(rdpContext* context, CREAT
int headerLength;
rdpUpdate* update = context->update;
update_force_flush(context);
headerLength = 1;
orderType = ORDER_TYPE_CREATE_OFFSCREEN_BITMAP;
controlFlags = ORDER_SECONDARY | (orderType << 2);
@ -1219,6 +1250,8 @@ static void update_send_create_offscreen_bitmap_order(rdpContext* context, CREAT
Stream_SetPosition(s, em);
update->numberOrders++;
update_force_flush(context);
}
static void update_send_switch_surface_order(rdpContext* context, SWITCH_SURFACE_ORDER* switch_surface)
@ -1230,6 +1263,8 @@ static void update_send_switch_surface_order(rdpContext* context, SWITCH_SURFACE
int headerLength;
rdpUpdate* update = context->update;
update_force_flush(context);
headerLength = 1;
orderType = ORDER_TYPE_SWITCH_SURFACE;
controlFlags = ORDER_SECONDARY | (orderType << 2);
@ -1250,6 +1285,8 @@ static void update_send_switch_surface_order(rdpContext* context, SWITCH_SURFACE
Stream_SetPosition(s, em);
update->numberOrders++;
update_force_flush(context);
}
static void update_send_pointer_system(rdpContext* context, POINTER_SYSTEM_UPDATE* pointer_system)