Limit RFX update region to screen.
@@ -1157,10 +1157,10 @@ BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data, UINT32 length,
{
RECTANGLE_16 clippingRect;
const RFX_RECT* rect = &(message->rects[i]);
- clippingRect.left = left + rect->x;
- clippingRect.top = top + rect->y;
- clippingRect.right = clippingRect.left + rect->width;
- clippingRect.bottom = clippingRect.top + rect->height;
+ clippingRect.left = MIN(left + rect->x, dstWidth);
+ clippingRect.top = MIN(top + rect->y, dstHeight);
+ clippingRect.right = MIN(clippingRect.left + rect->width, dstWidth);
+ clippingRect.bottom = MIN(clippingRect.top + rect->height, dstHeight);
region16_union_rect(&clippingRects, &clippingRects, &clippingRect);
}
@@ -1178,19 +1178,13 @@ BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data, UINT32 length,
for (j = 0; j < nbUpdateRects; j++)
{
- UINT32 stride = 64 * formatSize;
- UINT32 nXDst = updateRects[j].left;
- UINT32 nYDst = updateRects[j].top;
- UINT32 nXSrc = nXDst - updateRect.left;
- UINT32 nYSrc = nYDst - updateRect.top;
- UINT32 nWidth = MIN(64, updateRects[j].right - updateRects[j].left);
- UINT32 nHeight = MIN(64, updateRects[j].bottom - updateRects[j].top);
-
- if (nXDst + nWidth > dstWidth)
- nWidth = MAX(0, dstWidth - nXDst);
-
- if (nYDst + nHeight > dstHeight)
- nHeight = MAX(0, dstHeight - nYDst);
+ const UINT32 stride = 64 * formatSize;
+ const UINT32 nXDst = updateRects[j].left;
+ const UINT32 nYDst = updateRects[j].top;
+ const UINT32 nXSrc = nXDst - updateRect.left;
+ const UINT32 nYSrc = nYDst - updateRect.top;
+ const UINT32 nWidth = updateRects[j].right - updateRects[j].left;
+ const UINT32 nHeight = updateRects[j].bottom - updateRects[j].top;
if (!freerdp_image_copy(dst, dstFormat, dstStride,
nXDst, nYDst, nWidth, nHeight,
