- Fix type of DCLEVEL::prgnClip / prgnMeta (PVOID -> PREGION)
- Move NtGdiGetRandomRgn to dcobjs.c

svn path=/trunk/; revision=50288
This commit is contained in:
Timo Kreuzer 2011-01-04 18:18:28 +00:00
parent 00b94dd55a
commit 768bb41032
4 changed files with 80 additions and 84 deletions

View file

@ -76,8 +76,8 @@ typedef struct _DCLEVEL
HGDIOBJ hPath; /* HPATH */
FLONG flPath;
LINEATTRS laPath; /* 0x20 bytes */
PVOID prgnClip; /* PROSRGNDATA */
PVOID prgnMeta;
PREGION prgnClip;
PREGION prgnMeta;
COLORADJUSTMENT ca;
FLONG flFontState;
UNIVERSAL_FONT_ID ufi;
@ -126,9 +126,9 @@ typedef struct _DC
RECTL erclWindow;
RECTL erclBounds;
RECTL erclBoundsApp;
PROSRGNDATA prgnAPI; /* PROSRGNDATA */
PROSRGNDATA prgnVis; /* Visible region (must never be 0) */
PROSRGNDATA prgnRao;
PREGION prgnAPI;
PREGION prgnVis; /* Visible region (must never be 0) */
PREGION prgnRao;
POINTL ptlFillOrigin;
EBRUSHOBJ eboFill;
EBRUSHOBJ eboLine;

View file

@ -483,13 +483,13 @@ IntGdiSetMetaRgn(PDC pDC)
RGN_AND);
if ( Ret )
{
GDIOBJ_ShareUnlockObjByPtr(pDC->dclevel.prgnMeta);
GDIOBJ_ShareUnlockObjByPtr(&pDC->dclevel.prgnMeta->BaseObject);
if (!((PROSRGNDATA)pDC->dclevel.prgnMeta)->BaseObject.ulShareCount)
REGION_Delete(pDC->dclevel.prgnMeta);
pDC->dclevel.prgnMeta = TempRgn;
GDIOBJ_ShareUnlockObjByPtr(pDC->dclevel.prgnClip);
GDIOBJ_ShareUnlockObjByPtr(&pDC->dclevel.prgnClip->BaseObject);
if (!((PROSRGNDATA)pDC->dclevel.prgnClip)->BaseObject.ulShareCount)
REGION_Delete(pDC->dclevel.prgnClip);

View file

@ -457,6 +457,79 @@ NtGdiGetDCObject(HDC hDC, INT ObjectType)
return SelObject;
}
/* See wine, msdn, osr and Feng Yuan - Windows Graphics Programming Win32 Gdi And Directdraw
1st: http://www.codeproject.com/gdi/cliprgnguide.asp is wrong!
The intersection of the clip with the meta region is not Rao it's API!
Go back and read 7.2 Clipping pages 418-19:
Rao = API & Vis:
1) The Rao region is the intersection of the API region and the system region,
named after the Microsoft engineer who initially proposed it.
2) The Rao region can be calculated from the API region and the system region.
API:
API region is the intersection of the meta region and the clipping region,
clearly named after the fact that it is controlled by GDI API calls.
*/
INT
APIENTRY
NtGdiGetRandomRgn(
HDC hdc,
HRGN hrgnDest,
INT iCode)
{
INT ret = 0;
PDC pdc;
HRGN hrgnSrc = NULL;
POINTL ptlOrg;
pdc = DC_LockDc(hdc);
if (!pdc)
{
EngSetLastError(ERROR_INVALID_HANDLE);
return -1;
}
switch (iCode)
{
case CLIPRGN:
hrgnSrc = pdc->rosdc.hClipRgn;
// if (pdc->dclevel.prgnClip) hrgnSrc = pdc->dclevel.prgnClip->BaseObject.hHmgr;
break;
case METARGN:
if (pdc->dclevel.prgnMeta)
hrgnSrc = pdc->dclevel.prgnMeta->BaseObject.hHmgr;
break;
case APIRGN:
if (pdc->prgnAPI) hrgnSrc = pdc->prgnAPI->BaseObject.hHmgr;
// 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) hrgnSrc = pdc->prgnVis->BaseObject.hHmgr;
break;
default:
hrgnSrc = NULL;
}
if (hrgnSrc)
{
ret = NtGdiCombineRgn(hrgnDest, hrgnSrc, 0, RGN_COPY) == ERROR ? -1 : 1;
}
if (iCode == SYSRGN)
{
ptlOrg = pdc->ptlDCOrig;
NtGdiOffsetRgn(hrgnDest, ptlOrg.x, ptlOrg.y );
}
DC_UnlockDc(pdc);
return ret;
}
ULONG
APIENTRY
NtGdiEnumObjects(

View file

@ -3637,83 +3637,6 @@ NtGdiFrameRgn(
}
/* See wine, msdn, osr and Feng Yuan - Windows Graphics Programming Win32 Gdi And Directdraw
1st: http://www.codeproject.com/gdi/cliprgnguide.asp is wrong!
The intersection of the clip with the meta region is not Rao it's API!
Go back and read 7.2 Clipping pages 418-19:
Rao = API & Vis:
1) The Rao region is the intersection of the API region and the system region,
named after the Microsoft engineer who initially proposed it.
2) The Rao region can be calculated from the API region and the system region.
API:
API region is the intersection of the meta region and the clipping region,
clearly named after the fact that it is controlled by GDI API calls.
*/
INT APIENTRY
NtGdiGetRandomRgn(
HDC hDC,
HRGN hDest,
INT iCode
)
{
INT ret = 0;
PDC pDC;
HRGN hSrc = NULL;
POINT org;
pDC = DC_LockDc(hDC);
if (pDC == NULL)
{
EngSetLastError(ERROR_INVALID_HANDLE);
return -1;
}
switch (iCode)
{
case CLIPRGN:
hSrc = pDC->rosdc.hClipRgn;
// if (pDC->dclevel.prgnClip) hSrc = ((PROSRGNDATA)pDC->dclevel.prgnClip)->BaseObject.hHmgr;
break;
case METARGN:
if (pDC->dclevel.prgnMeta) hSrc = ((PROSRGNDATA)pDC->dclevel.prgnMeta)->BaseObject.hHmgr;
break;
case APIRGN:
if (pDC->prgnAPI) hSrc = ((PROSRGNDATA)pDC->prgnAPI)->BaseObject.hHmgr;
// else if (pDC->dclevel.prgnClip) hSrc = ((PROSRGNDATA)pDC->dclevel.prgnClip)->BaseObject.hHmgr;
else if (pDC->rosdc.hClipRgn) hSrc = pDC->rosdc.hClipRgn;
else if (pDC->dclevel.prgnMeta) hSrc = ((PROSRGNDATA)pDC->dclevel.prgnMeta)->BaseObject.hHmgr;
break;
case SYSRGN:
if (pDC->prgnVis) hSrc = pDC->prgnVis->BaseObject.hHmgr;
break;
default:
hSrc = 0;
}
if (hSrc)
{
if (NtGdiCombineRgn(hDest, hSrc, 0, RGN_COPY) == ERROR)
{
ret = -1;
}
else
{
ret = 1;
}
}
if (iCode == SYSRGN)
{
org = pDC->ptlDCOrig;
NtGdiOffsetRgn(hDest, org.x, org.y );
}
DC_UnlockDc(pDC);
return ret;
}
INT APIENTRY
NtGdiGetRgnBox(
HRGN hRgn,