Fixed various issues with primary orders.

This commit is contained in:
Armin Novak 2018-10-15 14:30:38 +02:00
parent 83fba667c1
commit f88ed950d3
5 changed files with 68 additions and 22 deletions

View File

@ -1096,9 +1096,9 @@ static BOOL xf_pre_connect(freerdp* instance)
settings->OrderSupport[NEG_SCRBLT_INDEX] = TRUE;
settings->OrderSupport[NEG_OPAQUE_RECT_INDEX] = TRUE;
settings->OrderSupport[NEG_DRAWNINEGRID_INDEX] = FALSE;
settings->OrderSupport[NEG_MULTIDSTBLT_INDEX] = FALSE;
settings->OrderSupport[NEG_MULTIPATBLT_INDEX] = FALSE;
settings->OrderSupport[NEG_MULTISCRBLT_INDEX] = FALSE;
settings->OrderSupport[NEG_MULTIDSTBLT_INDEX] = TRUE;
settings->OrderSupport[NEG_MULTIPATBLT_INDEX] = TRUE;
settings->OrderSupport[NEG_MULTISCRBLT_INDEX] = TRUE;
settings->OrderSupport[NEG_MULTIOPAQUERECT_INDEX] = TRUE;
settings->OrderSupport[NEG_MULTI_DRAWNINEGRID_INDEX] = FALSE;
settings->OrderSupport[NEG_LINETO_INDEX] = TRUE;
@ -1108,9 +1108,9 @@ static BOOL xf_pre_connect(freerdp* instance)
settings->OrderSupport[NEG_MEMBLT_V2_INDEX] = settings->BitmapCacheEnabled;
settings->OrderSupport[NEG_MEM3BLT_V2_INDEX] = settings->BitmapCacheEnabled;
settings->OrderSupport[NEG_SAVEBITMAP_INDEX] = FALSE;
settings->OrderSupport[NEG_GLYPH_INDEX_INDEX] = TRUE;
settings->OrderSupport[NEG_FAST_INDEX_INDEX] = TRUE;
settings->OrderSupport[NEG_FAST_GLYPH_INDEX] = TRUE;
settings->OrderSupport[NEG_GLYPH_INDEX_INDEX] = FALSE;
settings->OrderSupport[NEG_FAST_INDEX_INDEX] = FALSE;
settings->OrderSupport[NEG_FAST_GLYPH_INDEX] = FALSE;
settings->OrderSupport[NEG_POLYGON_SC_INDEX] = FALSE;
settings->OrderSupport[NEG_POLYGON_CB_INDEX] = FALSE;
settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE;

View File

@ -212,7 +212,7 @@ struct _MULTI_DRAW_NINE_GRID_ORDER
UINT32 bitmapId;
UINT32 nDeltaEntries;
UINT32 cbData;
BYTE* codeDeltaList;
DELTA_RECT rectangles[45];
};
typedef struct _MULTI_DRAW_NINE_GRID_ORDER MULTI_DRAW_NINE_GRID_ORDER;

View File

@ -265,15 +265,24 @@ static BOOL fastpath_recv_orders(rdpFastPath* fastpath, wStream* s)
UINT16 numberOrders;
if (!fastpath || !fastpath->rdp || !s)
{
WLog_ERR(TAG, "Invalid arguments");
return FALSE;
}
update = fastpath->rdp->update;
if (!update)
{
WLog_ERR(TAG, "Invalid configuration");
return FALSE;
}
if (Stream_GetRemainingLength(s) < 2)
{
WLog_ERR(TAG, "Stream short");
return FALSE;
}
Stream_Read_UINT16(s, numberOrders); /* numberOrders (2 bytes) */

View File

@ -319,7 +319,7 @@ static BOOL freerdp_check_point(rdpContext* context, INT32 x, INT32 y)
if (x > dw)
goto fail;
if (y > dw)
if (y > dh)
goto fail;
return TRUE;
@ -328,6 +328,35 @@ fail:
return FALSE;
}
static BOOL adjust_point(rdpContext* context, INT32* px, INT32* py)
{
INT32 x, y;
UINT32 dw, dh;
if (!context || !context->settings || !px || !py)
return FALSE;
x = *px;
y = *py;
dw = context->settings->DesktopWidth;
dh = context->settings->DesktopHeight;
if (x < 0)
x = 0;
if (y < 0)
y = 0;
if (x > dw)
x = dw;
if (y > dh)
y = dh;
*px = x;
*py = y;
return TRUE;;
}
static BOOL freerdp_check_delta_point(rdpContext* context, INT32 x, INT32 y, UINT32 count,
const DELTA_POINT* data)
{
@ -1402,7 +1431,12 @@ static BOOL update_read_multi_draw_nine_grid_order(wStream* s,
if (orderInfo->fieldFlags & ORDER_FIELD_07)
{
FIELD_SKIP_BUFFER16(s, multi_draw_nine_grid->cbData);
if (Stream_GetRemainingLength(s) < 2)
return FALSE;
Stream_Read_UINT16(s, multi_draw_nine_grid->cbData);
return update_read_delta_rects(s, multi_draw_nine_grid->rectangles,
multi_draw_nine_grid->nDeltaEntries);
}
return TRUE;
@ -3449,7 +3483,10 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
primary->multi_draw_nine_grid.srcBottom))
return FALSE;
// TODO: Delta rects
if (!freerdp_check_delta_rect(context, primary->multi_draw_nine_grid.nDeltaEntries,
primary->multi_draw_nine_grid.rectangles))
return FALSE;
rc = IFCALLRESULT(FALSE, primary->MultiDrawNineGrid, context, &primary->multi_draw_nine_grid);
break;
@ -3462,10 +3499,10 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
if (!freerdp_check_point(context, primary->line_to.nXStart, primary->line_to.nYStart))
if (!adjust_point(context, &primary->line_to.nXStart, &primary->line_to.nYStart))
return FALSE;
if (!freerdp_check_point(context, primary->line_to.nXEnd, primary->line_to.nYEnd))
if (!adjust_point(context, &primary->line_to.nXEnd, &primary->line_to.nYEnd))
return FALSE;
rc = IFCALLRESULT(FALSE, primary->LineTo, context, &primary->line_to);
@ -3604,7 +3641,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
primary->fast_glyph.opRight, primary->fast_index.opBottom))
return FALSE;
if (!freerdp_check_point(context, primary->fast_glyph.x, primary->fast_glyph.y))
if (!adjust_point(context, &primary->fast_glyph.x, &primary->fast_glyph.y))
return FALSE;
rc = IFCALLRESULT(FALSE, primary->FastGlyph, context, &primary->fast_glyph);

View File

@ -394,19 +394,19 @@ rdpSettings* freerdp_settings_new(DWORD flags)
settings->OrderSupport[NEG_MULTIPATBLT_INDEX] = TRUE;
settings->OrderSupport[NEG_MULTISCRBLT_INDEX] = TRUE;
settings->OrderSupport[NEG_MULTIOPAQUERECT_INDEX] = TRUE;
settings->OrderSupport[NEG_MULTI_DRAWNINEGRID_INDEX] = TRUE;
settings->OrderSupport[NEG_MULTI_DRAWNINEGRID_INDEX] = FALSE;
settings->OrderSupport[NEG_LINETO_INDEX] = TRUE;
settings->OrderSupport[NEG_POLYLINE_INDEX] = TRUE;
settings->OrderSupport[NEG_MEMBLT_INDEX] = TRUE;
settings->OrderSupport[NEG_MEM3BLT_INDEX] = TRUE;
settings->OrderSupport[NEG_SAVEBITMAP_INDEX] = TRUE;
settings->OrderSupport[NEG_GLYPH_INDEX_INDEX] = TRUE;
settings->OrderSupport[NEG_FAST_INDEX_INDEX] = TRUE;
settings->OrderSupport[NEG_FAST_GLYPH_INDEX] = TRUE;
settings->OrderSupport[NEG_POLYGON_SC_INDEX] = TRUE;
settings->OrderSupport[NEG_POLYGON_CB_INDEX] = TRUE;
settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = TRUE;
settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = TRUE;
settings->OrderSupport[NEG_SAVEBITMAP_INDEX] = FALSE;
settings->OrderSupport[NEG_GLYPH_INDEX_INDEX] = FALSE;
settings->OrderSupport[NEG_FAST_INDEX_INDEX] = FALSE;
settings->OrderSupport[NEG_FAST_GLYPH_INDEX] = FALSE;
settings->OrderSupport[NEG_POLYGON_SC_INDEX] = FALSE;
settings->OrderSupport[NEG_POLYGON_CB_INDEX] = FALSE;
settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE;
settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = FALSE;
settings->ClientProductId = calloc(1, 32);
if (!settings->ClientProductId)