Commit fe7d81dc authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Ignore rectangles with invalid coordinates when converting region data.

parent 038e308a
...@@ -161,13 +161,24 @@ RGNDATA *X11DRV_GetRegionData( HRGN hrgn, HDC hdc_lptodp ) ...@@ -161,13 +161,24 @@ RGNDATA *X11DRV_GetRegionData( HRGN hrgn, HDC hdc_lptodp )
{ {
int j; int j;
/* need to start from the end */ /* need to start from the end */
xrect += data->rdh.nCount;
for (j = data->rdh.nCount-1; j >= 0; j--) for (j = data->rdh.nCount-1; j >= 0; j--)
{ {
tmp = rect[j]; tmp = rect[j];
xrect[j].x = max( min( tmp.left, SHRT_MAX), SHRT_MIN); if (tmp.left > SHRT_MAX) continue;
xrect[j].y = max( min( tmp.top, SHRT_MAX), SHRT_MIN); if (tmp.top > SHRT_MAX) continue;
xrect[j].width = max( min( tmp.right - xrect[j].x, USHRT_MAX), 0); if (tmp.right < SHRT_MIN) continue;
xrect[j].height = max( min( tmp.bottom - xrect[j].y, USHRT_MAX), 0); if (tmp.bottom < SHRT_MIN) continue;
xrect--;
xrect->x = max( min( tmp.left, SHRT_MAX), SHRT_MIN);
xrect->y = max( min( tmp.top, SHRT_MAX), SHRT_MIN);
xrect->width = max( min( tmp.right, SHRT_MAX ) - xrect->x, 0);
xrect->height = max( min( tmp.bottom, SHRT_MAX ) - xrect->y, 0);
}
if (xrect > (XRectangle *)data->Buffer)
{
data->rdh.nCount -= xrect - (XRectangle *)data->Buffer;
memmove( (XRectangle *)data->Buffer, xrect, data->rdh.nCount * sizeof(*xrect) );
} }
} }
else else
...@@ -175,11 +186,17 @@ RGNDATA *X11DRV_GetRegionData( HRGN hrgn, HDC hdc_lptodp ) ...@@ -175,11 +186,17 @@ RGNDATA *X11DRV_GetRegionData( HRGN hrgn, HDC hdc_lptodp )
for (i = 0; i < data->rdh.nCount; i++) for (i = 0; i < data->rdh.nCount; i++)
{ {
tmp = rect[i]; tmp = rect[i];
xrect[i].x = max( min( tmp.left, SHRT_MAX), SHRT_MIN); if (tmp.left > SHRT_MAX) continue;
xrect[i].y = max( min( tmp.top, SHRT_MAX), SHRT_MIN); if (tmp.top > SHRT_MAX) continue;
xrect[i].width = max( min( tmp.right - xrect[i].x, USHRT_MAX), 0); if (tmp.right < SHRT_MIN) continue;
xrect[i].height = max( min( tmp.bottom - xrect[i].y, USHRT_MAX), 0); if (tmp.bottom < SHRT_MIN) continue;
xrect->x = max( min( tmp.left, SHRT_MAX), SHRT_MIN);
xrect->y = max( min( tmp.top, SHRT_MAX), SHRT_MIN);
xrect->width = max( min( tmp.right, SHRT_MAX ) - xrect->x, 0);
xrect->height = max( min( tmp.bottom, SHRT_MAX ) - xrect->y, 0);
xrect++;
} }
data->rdh.nCount = xrect - (XRectangle *)data->Buffer;
} }
return data; return data;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment