Author: tkreuzer
Date: Tue Jan 4 18:18:28 2011
New Revision: 50288
URL:
http://svn.reactos.org/svn/reactos?rev=50288&view=rev
Log:
[WIN32K]
- Fix type of DCLEVEL::prgnClip / prgnMeta (PVOID -> PREGION)
- Move NtGdiGetRandomRgn to dcobjs.c
Modified:
trunk/reactos/subsystems/win32/win32k/include/dc.h
trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c
trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c
trunk/reactos/subsystems/win32/win32k/objects/region.c
Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] Tue Jan 4 18:18:28
2011
@@ -76,8 +76,8 @@
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 @@
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;
Modified: trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c [iso-8859-1] Tue Jan 4
18:18:28 2011
@@ -483,13 +483,13 @@
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);
Modified: trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c [iso-8859-1] Tue Jan 4
18:18:28 2011
@@ -457,6 +457,79 @@
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(
Modified: trunk/reactos/subsystems/win32/win32k/objects/region.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/region.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/region.c [iso-8859-1] Tue Jan 4
18:18:28 2011
@@ -3637,83 +3637,6 @@
}
-/* 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,