Merge pull request #4839 from akallabeth/optional_begin_paint

Fixed #4835: BeginPaint callback now optional.
This commit is contained in:
David Fort 2018-09-04 15:17:01 +02:00 committed by GitHub
commit c2e2eb9108
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 20 deletions

View File

@ -283,11 +283,6 @@ static BOOL xf_desktop_resize(rdpContext* context)
return TRUE; return TRUE;
} }
static BOOL xf_sw_begin_paint(rdpContext* context)
{
return TRUE;
}
static BOOL xf_sw_end_paint(rdpContext* context) static BOOL xf_sw_end_paint(rdpContext* context)
{ {
int i; int i;
@ -390,11 +385,6 @@ out:
return ret; return ret;
} }
static BOOL xf_hw_begin_paint(rdpContext* context)
{
return TRUE;
}
static BOOL xf_hw_end_paint(rdpContext* context) static BOOL xf_hw_end_paint(rdpContext* context)
{ {
INT32 x, y; INT32 x, y;
@ -1263,13 +1253,11 @@ static BOOL xf_post_connect(freerdp* instance)
if (settings->SoftwareGdi) if (settings->SoftwareGdi)
{ {
update->BeginPaint = xf_sw_begin_paint;
update->EndPaint = xf_sw_end_paint; update->EndPaint = xf_sw_end_paint;
update->DesktopResize = xf_sw_desktop_resize; update->DesktopResize = xf_sw_desktop_resize;
} }
else else
{ {
update->BeginPaint = xf_hw_begin_paint;
update->EndPaint = xf_hw_end_paint; update->EndPaint = xf_hw_end_paint;
update->DesktopResize = xf_hw_desktop_resize; update->DesktopResize = xf_hw_desktop_resize;
} }

View File

@ -565,10 +565,11 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
else else
{ {
const size_t totalSize = Stream_GetPosition(fastpath->updateData); const size_t totalSize = Stream_GetPosition(fastpath->updateData);
if (totalSize > transport->settings->MultifragMaxRequestSize) if (totalSize > transport->settings->MultifragMaxRequestSize)
{ {
WLog_ERR(TAG, "Total size (%"PRIuz") exceeds MultifragMaxRequestSize (%"PRIu32")", WLog_ERR(TAG, "Total size (%"PRIuz") exceeds MultifragMaxRequestSize (%"PRIu32")",
totalSize, transport->settings->MultifragMaxRequestSize); totalSize, transport->settings->MultifragMaxRequestSize);
goto out_fail; goto out_fail;
} }
@ -581,8 +582,6 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
} }
fastpath->fragmentation = FASTPATH_FRAGMENT_FIRST; fastpath->fragmentation = FASTPATH_FRAGMENT_FIRST;
} }
else if (fragmentation == FASTPATH_FRAGMENT_NEXT) else if (fragmentation == FASTPATH_FRAGMENT_NEXT)
{ {
@ -605,7 +604,6 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
} }
fastpath->fragmentation = -1; fastpath->fragmentation = -1;
Stream_SealLength(fastpath->updateData); Stream_SealLength(fastpath->updateData);
Stream_SetPosition(fastpath->updateData, 0); Stream_SetPosition(fastpath->updateData, 0);
status = fastpath_recv_update(fastpath, updateCode, fastpath->updateData); status = fastpath_recv_update(fastpath, updateCode, fastpath->updateData);
@ -621,7 +619,6 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
return status; return status;
out_fail: out_fail:
return -1; return -1;
} }
@ -634,7 +631,7 @@ int fastpath_recv_updates(rdpFastPath* fastpath, wStream* s)
update = fastpath->rdp->update; update = fastpath->rdp->update;
if (!IFCALLRESULT(FALSE, update->BeginPaint, update->context)) if (!IFCALLRESULT(TRUE, update->BeginPaint, update->context))
return -2; return -2;
while (Stream_GetRemainingLength(s) >= 3) while (Stream_GetRemainingLength(s) >= 3)

View File

@ -130,11 +130,14 @@ static BOOL update_read_bitmap_data(rdpUpdate* update, wStream* s,
if (bitmapData->bitmapLength > 0) if (bitmapData->bitmapLength > 0)
{ {
bitmapData->bitmapDataStream = malloc(bitmapData->bitmapLength); bitmapData->bitmapDataStream = malloc(bitmapData->bitmapLength);
if (!bitmapData->bitmapDataStream) if (!bitmapData->bitmapDataStream)
return FALSE; return FALSE;
memcpy(bitmapData->bitmapDataStream, Stream_Pointer(s), bitmapData->bitmapLength); memcpy(bitmapData->bitmapDataStream, Stream_Pointer(s), bitmapData->bitmapLength);
Stream_Seek(s, bitmapData->bitmapLength); Stream_Seek(s, bitmapData->bitmapLength);
} }
return TRUE; return TRUE;
} }
@ -633,9 +636,9 @@ BOOL update_recv(rdpUpdate* update, wStream* s)
} }
Stream_Read_UINT16(s, updateType); /* updateType (2 bytes) */ Stream_Read_UINT16(s, updateType); /* updateType (2 bytes) */
WLog_Print(update->log, WLOG_TRACE, "%s Update Data PDU", UPDATE_TYPE_STRINGS[updateType]);
//WLog_DBG(TAG, "%s Update Data PDU", UPDATE_TYPE_STRINGS[updateType]); if (!IFCALLRESULT(TRUE, update->BeginPaint, context))
if (!IFCALLRESULT(FALSE, update->BeginPaint, context))
return FALSE; return FALSE;
switch (updateType) switch (updateType)