- In NtGdiGetRandomRgn use the region pointers directly, instead of getting their handles. These regions might not even have a handle.
- Fix last error code

svn path=/trunk/; revision=58089
This commit is contained in:
Timo Kreuzer 2013-01-01 19:23:30 +00:00
parent 968788ebd8
commit d225c3c957

View file

@ -615,12 +615,13 @@ NtGdiGetRandomRgn(
INT ret = 0; INT ret = 0;
PDC pdc; PDC pdc;
HRGN hrgnSrc = NULL; HRGN hrgnSrc = NULL;
PREGION prgnSrc = NULL;
POINTL ptlOrg; POINTL ptlOrg;
pdc = DC_LockDc(hdc); pdc = DC_LockDc(hdc);
if (!pdc) if (!pdc)
{ {
EngSetLastError(ERROR_INVALID_PARAMETER); EngSetLastError(ERROR_INVALID_HANDLE);
return -1; return -1;
} }
@ -628,34 +629,52 @@ NtGdiGetRandomRgn(
{ {
case CLIPRGN: case CLIPRGN:
hrgnSrc = pdc->rosdc.hClipRgn; hrgnSrc = pdc->rosdc.hClipRgn;
// if (pdc->dclevel.prgnClip) hrgnSrc = pdc->dclevel.prgnClip->BaseObject.hHmgr; // if (pdc->dclevel.prgnClip) prgnSrc = pdc->dclevel.prgnClip;
break; break;
case METARGN: case METARGN:
if (pdc->dclevel.prgnMeta) prgnSrc = pdc->dclevel.prgnMeta;
hrgnSrc = pdc->dclevel.prgnMeta->BaseObject.hHmgr;
break; break;
case APIRGN: case APIRGN:
if (pdc->prgnAPI) hrgnSrc = pdc->prgnAPI->BaseObject.hHmgr; if (pdc->prgnAPI)
// else if (pdc->dclevel.prgnClip) hrgnSrc = pdc->dclevel.prgnClip->BaseObject.hHmgr;
else if (pdc->rosdc.hClipRgn) hrgnSrc = pdc->rosdc.hClipRgn;
else if (pdc->dclevel.prgnMeta) hrgnSrc = pdc->dclevel.prgnMeta->BaseObject.hHmgr;
break;
case SYSRGN:
if (pdc->prgnVis)
{ {
PREGION prgnDest = REGION_LockRgn(hrgnDest); prgnSrc = pdc->prgnAPI;
ret = IntGdiCombineRgn(prgnDest, pdc->prgnVis, 0, RGN_COPY) == ERROR ? -1 : 1; }
REGION_UnlockRgn(prgnDest); // else if (pdc->dclevel.prgnClip) prgnSrc = pdc->dclevel.prgnClip;
else if (pdc->rosdc.hClipRgn)
{
hrgnSrc = pdc->rosdc.hClipRgn;
}
else if (pdc->dclevel.prgnMeta)
{
prgnSrc = pdc->dclevel.prgnMeta;
} }
break; break;
case SYSRGN:
prgnSrc = pdc->prgnVis;
break;
default: default:
hrgnSrc = NULL; break;
} }
if (hrgnSrc) if (hrgnSrc)
{ {
ret = NtGdiCombineRgn(hrgnDest, hrgnSrc, 0, RGN_COPY) == ERROR ? -1 : 1; ret = NtGdiCombineRgn(hrgnDest, hrgnSrc, 0, RGN_COPY) == ERROR ? -1 : 1;
} }
else if (prgnSrc)
{
PREGION prgnDest = REGION_LockRgn(hrgnDest);
if (prgnDest)
{
ret = IntGdiCombineRgn(prgnDest, prgnSrc, 0, RGN_COPY) == ERROR ? -1 : 1;
REGION_UnlockRgn(prgnDest);
}
else
ret = -1;
}
if (iCode == SYSRGN) if (iCode == SYSRGN)
{ {