Author: gschneider
Date: Thu Apr  9 16:16:51 2009
New Revision: 40427

URL: http://svn.reactos.org/svn/reactos?rev=40427&view=rev
Log:
- REGION_AllocRgnWithHandle: allow creation of empty region
- NtGdiExtCreateRegion: copy parameters in SEH, check them later without 
setting last error, loosen checks for zero requested regions (returns an empty 
region)
- NtGdiGetRandomRgn: remove outdated comments and debug prints: DCs don't hold 
meta regions anymore
- Fixes four gdi32 clipping winetests

Modified:
    trunk/reactos/subsystems/win32/win32k/objects/region.c

Modified: trunk/reactos/subsystems/win32/win32k/objects/region.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/region.c?rev=40427&r1=40426&r2=40427&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/region.c [iso-8859-1] 
(original)
+++ trunk/reactos/subsystems/win32/win32k/objects/region.c [iso-8859-1] Thu Apr 
 9 16:16:51 2009
@@ -2043,7 +2043,7 @@
     
     hReg = pReg->BaseObject.hHmgr;
 
-    if (nReg == 1)
+    if (nReg == 0 || nReg == 1)
     {
         /* Testing shows that > 95% of all regions have only 1 rect.
            Including that here saves us from having to do another allocation */
@@ -2496,6 +2496,8 @@
     HRGN hRgn;
     PROSRGNDATA Region;
     DWORD nCount = 0;
+    DWORD iType = 0;
+    DWORD dwSize = 0;
     NTSTATUS Status = STATUS_SUCCESS;
     MATRIX matrix;
 
@@ -2504,14 +2506,8 @@
     {
         ProbeForRead(RgnData, Count, 1);
         nCount = RgnData->rdh.nCount;
-        if (Count < sizeof(RGNDATAHEADER) + nCount * sizeof(RECT) ||
-            nCount == 0 ||
-            RgnData->rdh.iType != RDH_RECTANGLES ||
-            RgnData->rdh.dwSize != sizeof(RGNDATAHEADER))
-        {
-            Status = STATUS_INVALID_PARAMETER;
-            _SEH2_LEAVE;
-        }
+        iType = RgnData->rdh.iType;
+        dwSize = RgnData->rdh.dwSize;
     }
     _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
     {
@@ -2521,6 +2517,14 @@
     if (!NT_SUCCESS(Status))
     {
         SetLastNtError(Status);
+        return NULL;
+    }
+
+    /* Check parameters, but don't set last error here */
+    if (Count < sizeof(RGNDATAHEADER) + nCount * sizeof(RECT) ||
+        iType != RDH_RECTANGLES ||
+        dwSize != sizeof(RGNDATAHEADER))
+    {
         return NULL;
     }
 
@@ -2712,10 +2716,7 @@
         if (pDC->dclevel.prgnMeta) hSrc = 
((PROSRGNDATA)pDC->dclevel.prgnMeta)->BaseObject.hHmgr;
         break;
     case APIRGN:
-        DPRINT1("hMetaRgn not implemented\n");
-        //hSrc = dc->hMetaClipRgn;
-        if (!hSrc) hSrc = pDC->rosdc.hClipRgn;
-        //if (!hSrc) rgn = dc->hMetaRgn;
+        hSrc = pDC->rosdc.hClipRgn;
 //        if (pDC->prgnAPI) hSrc = 
((PROSRGNDATA)pDC->prgnAPI)->BaseObject.hHmgr;
 //        else if (pDC->dclevel.prgnClip) hSrc = 
((PROSRGNDATA)pDC->dclevel.prgnClip)->BaseObject.hHmgr;
 //        else if (pDC->dclevel.prgnMeta) hSrc = 
((PROSRGNDATA)pDC->dclevel.prgnMeta)->BaseObject.hHmgr;

Reply via email to