mirror of
https://github.com/reactos/reactos.git
synced 2025-04-30 19:19:00 +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;
|
hReg = pReg->BaseObject.hHmgr;
|
||||||
|
|
||||||
if (nReg == 1)
|
if (nReg == 0 || nReg == 1)
|
||||||
{
|
{
|
||||||
/* Testing shows that > 95% of all regions have only 1 rect.
|
/* Testing shows that > 95% of all regions have only 1 rect.
|
||||||
Including that here saves us from having to do another allocation */
|
Including that here saves us from having to do another allocation */
|
||||||
|
@ -2496,6 +2496,8 @@ NtGdiExtCreateRegion(
|
||||||
HRGN hRgn;
|
HRGN hRgn;
|
||||||
PROSRGNDATA Region;
|
PROSRGNDATA Region;
|
||||||
DWORD nCount = 0;
|
DWORD nCount = 0;
|
||||||
|
DWORD iType = 0;
|
||||||
|
DWORD dwSize = 0;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
MATRIX matrix;
|
MATRIX matrix;
|
||||||
|
|
||||||
|
@ -2504,14 +2506,8 @@ NtGdiExtCreateRegion(
|
||||||
{
|
{
|
||||||
ProbeForRead(RgnData, Count, 1);
|
ProbeForRead(RgnData, Count, 1);
|
||||||
nCount = RgnData->rdh.nCount;
|
nCount = RgnData->rdh.nCount;
|
||||||
if (Count < sizeof(RGNDATAHEADER) + nCount * sizeof(RECT) ||
|
iType = RgnData->rdh.iType;
|
||||||
nCount == 0 ||
|
dwSize = RgnData->rdh.dwSize;
|
||||||
RgnData->rdh.iType != RDH_RECTANGLES ||
|
|
||||||
RgnData->rdh.dwSize != sizeof(RGNDATAHEADER))
|
|
||||||
{
|
|
||||||
Status = STATUS_INVALID_PARAMETER;
|
|
||||||
_SEH2_LEAVE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
|
@ -2524,6 +2520,14 @@ NtGdiExtCreateRegion(
|
||||||
return NULL;
|
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);
|
Region = REGION_AllocRgnWithHandle(nCount);
|
||||||
|
|
||||||
if (Region == NULL)
|
if (Region == NULL)
|
||||||
|
@ -2712,10 +2716,7 @@ NtGdiGetRandomRgn(
|
||||||
if (pDC->dclevel.prgnMeta) hSrc = ((PROSRGNDATA)pDC->dclevel.prgnMeta)->BaseObject.hHmgr;
|
if (pDC->dclevel.prgnMeta) hSrc = ((PROSRGNDATA)pDC->dclevel.prgnMeta)->BaseObject.hHmgr;
|
||||||
break;
|
break;
|
||||||
case APIRGN:
|
case APIRGN:
|
||||||
DPRINT1("hMetaRgn not implemented\n");
|
hSrc = pDC->rosdc.hClipRgn;
|
||||||
//hSrc = dc->hMetaClipRgn;
|
|
||||||
if (!hSrc) hSrc = pDC->rosdc.hClipRgn;
|
|
||||||
//if (!hSrc) rgn = dc->hMetaRgn;
|
|
||||||
// if (pDC->prgnAPI) hSrc = ((PROSRGNDATA)pDC->prgnAPI)->BaseObject.hHmgr;
|
// 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.prgnClip) hSrc = ((PROSRGNDATA)pDC->dclevel.prgnClip)->BaseObject.hHmgr;
|
||||||
// else if (pDC->dclevel.prgnMeta) hSrc = ((PROSRGNDATA)pDC->dclevel.prgnMeta)->BaseObject.hHmgr;
|
// else if (pDC->dclevel.prgnMeta) hSrc = ((PROSRGNDATA)pDC->dclevel.prgnMeta)->BaseObject.hHmgr;
|
||||||
|
|
Loading…
Reference in a new issue