mirror of
https://github.com/reactos/reactos.git
synced 2025-01-11 16:51:06 +00:00
- REGION_AllocRgnWithHandle: allow creation of empty region
- NtGdiExtCreateRegion: copy parameters in SEH, check them later without setting last error, loosen checks for zero requested regions (returns an empty region) - NtGdiGetRandomRgn: remove outdated comments and debug prints: DCs don't hold meta regions anymore - Fixes four gdi32 clipping winetests svn path=/trunk/; revision=40427
This commit is contained in:
parent
bc89d1efbd
commit
8cd1519932
1 changed files with 14 additions and 13 deletions
|
@ -2043,7 +2043,7 @@ REGION_AllocRgnWithHandle(INT nReg)
|
|||
|
||||
hReg = pReg->BaseObject.hHmgr;
|
||||
|
||||
if (nReg == 1)
|
||||
if (nReg == 0 || nReg == 1)
|
||||
{
|
||||
/* Testing shows that > 95% of all regions have only 1 rect.
|
||||
Including that here saves us from having to do another allocation */
|
||||
|
@ -2496,6 +2496,8 @@ NtGdiExtCreateRegion(
|
|||
HRGN hRgn;
|
||||
PROSRGNDATA Region;
|
||||
DWORD nCount = 0;
|
||||
DWORD iType = 0;
|
||||
DWORD dwSize = 0;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
MATRIX matrix;
|
||||
|
||||
|
@ -2504,14 +2506,8 @@ NtGdiExtCreateRegion(
|
|||
{
|
||||
ProbeForRead(RgnData, Count, 1);
|
||||
nCount = RgnData->rdh.nCount;
|
||||
if (Count < sizeof(RGNDATAHEADER) + nCount * sizeof(RECT) ||
|
||||
nCount == 0 ||
|
||||
RgnData->rdh.iType != RDH_RECTANGLES ||
|
||||
RgnData->rdh.dwSize != sizeof(RGNDATAHEADER))
|
||||
{
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
_SEH2_LEAVE;
|
||||
}
|
||||
iType = RgnData->rdh.iType;
|
||||
dwSize = RgnData->rdh.dwSize;
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
@ -2524,6 +2520,14 @@ NtGdiExtCreateRegion(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* Check parameters, but don't set last error here */
|
||||
if (Count < sizeof(RGNDATAHEADER) + nCount * sizeof(RECT) ||
|
||||
iType != RDH_RECTANGLES ||
|
||||
dwSize != sizeof(RGNDATAHEADER))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Region = REGION_AllocRgnWithHandle(nCount);
|
||||
|
||||
if (Region == NULL)
|
||||
|
@ -2712,10 +2716,7 @@ NtGdiGetRandomRgn(
|
|||
if (pDC->dclevel.prgnMeta) hSrc = ((PROSRGNDATA)pDC->dclevel.prgnMeta)->BaseObject.hHmgr;
|
||||
break;
|
||||
case APIRGN:
|
||||
DPRINT1("hMetaRgn not implemented\n");
|
||||
//hSrc = dc->hMetaClipRgn;
|
||||
if (!hSrc) hSrc = pDC->rosdc.hClipRgn;
|
||||
//if (!hSrc) rgn = dc->hMetaRgn;
|
||||
hSrc = pDC->rosdc.hClipRgn;
|
||||
// if (pDC->prgnAPI) hSrc = ((PROSRGNDATA)pDC->prgnAPI)->BaseObject.hHmgr;
|
||||
// else if (pDC->dclevel.prgnClip) hSrc = ((PROSRGNDATA)pDC->dclevel.prgnClip)->BaseObject.hHmgr;
|
||||
// else if (pDC->dclevel.prgnMeta) hSrc = ((PROSRGNDATA)pDC->dclevel.prgnMeta)->BaseObject.hHmgr;
|
||||
|
|
Loading…
Reference in a new issue