Author: jgardou
Date: Fri Jul 25 10:56:50 2014
New Revision: 63735
URL:
http://svn.reactos.org/svn/reactos?rev=63735&view=rev
Log:
[WIN32K]
- Improve parameter checking in NtGdiExtSelectClipRgn
- Update the DC clipping regions before getting the clipbox
Modified:
trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c
Modified: trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/cliprgn.…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/cliprgn.c [iso-8859-1] Fri Jul 25 10:56:50 2014
@@ -44,9 +44,9 @@
PREGION prgn,
int fnMode)
{
- if (!prgn)
- {
- if (fnMode == RGN_COPY)
+ if (fnMode == RGN_COPY)
+ {
+ if (!prgn)
{
if (dc->dclevel.prgnClip != NULL)
{
@@ -56,12 +56,14 @@
}
return SIMPLEREGION;
}
- else
- {
- EngSetLastError(ERROR_INVALID_PARAMETER);
- return ERROR;
- }
- }
+
+ if (!dc->dclevel.prgnClip)
+ dc->dclevel.prgnClip = IntSysCreateRectpRgn(0, 0, 0, 0);
+
+ return IntGdiCombineRgn(dc->dclevel.prgnClip, prgn, NULL, RGN_COPY);
+ }
+
+ ASSERT(prgn != NULL);
if (!dc->dclevel.prgnClip)
{
@@ -72,9 +74,6 @@
}
dc->fs |= DC_FLAG_DIRTY_RAO;
-
- if(fnMode == RGN_COPY)
- return IntGdiCombineRgn(dc->dclevel.prgnClip, prgn, 0, fnMode);
return IntGdiCombineRgn(dc->dclevel.prgnClip, dc->dclevel.prgnClip, prgn,
fnMode);
}
@@ -99,8 +98,15 @@
prgn = REGION_LockRgn(hrgn);
- /* IntGdiExtSelectClipRgn takes care of checking for NULL region */
- retval = IntGdiExtSelectClipRgn(dc, prgn, fnMode);
+ if ((prgn == NULL) && (fnMode != RGN_COPY))
+ {
+ EngSetLastError(ERROR_INVALID_HANDLE);
+ retval = ERROR;
+ }
+ else
+ {
+ retval = IntGdiExtSelectClipRgn(dc, prgn, fnMode);
+ }
if (prgn)
REGION_UnlockRgn(prgn);
@@ -120,6 +126,9 @@
{
return ERROR;
}
+
+ if (dc->fs & DC_FLAG_DIRTY_RAO)
+ CLIPPING_UpdateGCRegion(dc);
/* FIXME: Rao and Vis only! */
if (dc->prgnAPI) // APIRGN