mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 11:43:31 +00:00
winex11: Ignore rectangles with invalid coordinates when converting region data.
This commit is contained in:
parent
038e308a41
commit
fe7d81dc1b
1 changed files with 25 additions and 8 deletions
|
@ -161,13 +161,24 @@ RGNDATA *X11DRV_GetRegionData( HRGN hrgn, HDC hdc_lptodp )
|
|||
{
|
||||
int j;
|
||||
/* need to start from the end */
|
||||
xrect += data->rdh.nCount;
|
||||
for (j = data->rdh.nCount-1; j >= 0; j--)
|
||||
{
|
||||
tmp = rect[j];
|
||||
xrect[j].x = max( min( tmp.left, SHRT_MAX), SHRT_MIN);
|
||||
xrect[j].y = max( min( tmp.top, SHRT_MAX), SHRT_MIN);
|
||||
xrect[j].width = max( min( tmp.right - xrect[j].x, USHRT_MAX), 0);
|
||||
xrect[j].height = max( min( tmp.bottom - xrect[j].y, USHRT_MAX), 0);
|
||||
if (tmp.left > SHRT_MAX) continue;
|
||||
if (tmp.top > SHRT_MAX) continue;
|
||||
if (tmp.right < SHRT_MIN) continue;
|
||||
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
|
||||
|
@ -175,11 +186,17 @@ RGNDATA *X11DRV_GetRegionData( HRGN hrgn, HDC hdc_lptodp )
|
|||
for (i = 0; i < data->rdh.nCount; i++)
|
||||
{
|
||||
tmp = rect[i];
|
||||
xrect[i].x = max( min( tmp.left, SHRT_MAX), SHRT_MIN);
|
||||
xrect[i].y = max( min( tmp.top, SHRT_MAX), SHRT_MIN);
|
||||
xrect[i].width = max( min( tmp.right - xrect[i].x, USHRT_MAX), 0);
|
||||
xrect[i].height = max( min( tmp.bottom - xrect[i].y, USHRT_MAX), 0);
|
||||
if (tmp.left > SHRT_MAX) continue;
|
||||
if (tmp.top > SHRT_MAX) continue;
|
||||
if (tmp.right < SHRT_MIN) continue;
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue