From: Timo Kreuzer Date: Tue, 4 Jan 2011 18:18:28 +0000 (+0000) Subject: [WIN32K] X-Git-Tag: backups/ros-branch-0_3_13@51035~202 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=768bb4103275ba01c370e3f7695fde2f1f903578 [WIN32K] - Fix type of DCLEVEL::prgnClip / prgnMeta (PVOID -> PREGION) - Move NtGdiGetRandomRgn to dcobjs.c svn path=/trunk/; revision=50288 --- diff --git a/reactos/subsystems/win32/win32k/include/dc.h b/reactos/subsystems/win32/win32k/include/dc.h index b1f8cd1838a..2d94c245ca3 100644 --- a/reactos/subsystems/win32/win32k/include/dc.h +++ b/reactos/subsystems/win32/win32k/include/dc.h @@ -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; diff --git a/reactos/subsystems/win32/win32k/objects/cliprgn.c b/reactos/subsystems/win32/win32k/objects/cliprgn.c index 264f68ec1a3..95e0e5cced9 100644 --- a/reactos/subsystems/win32/win32k/objects/cliprgn.c +++ b/reactos/subsystems/win32/win32k/objects/cliprgn.c @@ -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); diff --git a/reactos/subsystems/win32/win32k/objects/dcobjs.c b/reactos/subsystems/win32/win32k/objects/dcobjs.c index e4bc928b935..75cde4146ab 100644 --- a/reactos/subsystems/win32/win32k/objects/dcobjs.c +++ b/reactos/subsystems/win32/win32k/objects/dcobjs.c @@ -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( diff --git a/reactos/subsystems/win32/win32k/objects/region.c b/reactos/subsystems/win32/win32k/objects/region.c index 1724c94253f..e4129629cfb 100644 --- a/reactos/subsystems/win32/win32k/objects/region.c +++ b/reactos/subsystems/win32/win32k/objects/region.c @@ -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,