Fix behavior if bmi null in NtGdiCreateDIBSection. Start internal functions for regio...
authorJames Tabor <james.tabor@reactos.org>
Wed, 21 May 2008 22:32:13 +0000 (22:32 +0000)
committerJames Tabor <james.tabor@reactos.org>
Wed, 21 May 2008 22:32:13 +0000 (22:32 +0000)
svn path=/trunk/; revision=33629

reactos/subsystems/win32/win32k/include/region.h
reactos/subsystems/win32/win32k/objects/dibobj.c
reactos/subsystems/win32/win32k/objects/region.c

index a4293da..be02ea8 100644 (file)
@@ -38,6 +38,9 @@ INT STDCALL IntGdiGetRgnBox(HRGN, LPRECT);
 BOOL FASTCALL IntGdiPaintRgn(PDC, HRGN );
 HRGN FASTCALL GdiCreatePolyPolygonRgn(CONST PPOINT, CONST PINT, INT, INT );
 
+INT FASTCALL IntGdiCombineRgn(PROSRGNDATA, PROSRGNDATA, PROSRGNDATA, INT);
+INT FASTCALL REGION_Complexity(PROSRGNDATA);
+
 #define UnsafeIntCreateRectRgnIndirect(prc) \
   NtGdiCreateRectRgn((prc)->left, (prc)->top, (prc)->right, (prc)->bottom)
 
index 3428f34..3dc3417 100644 (file)
@@ -994,6 +994,8 @@ HBITMAP STDCALL NtGdiCreateDIBSection(HDC hDC,
   DC *dc;
   BOOL bDesktopDC = FALSE;
 
+  if (!bmi) return hbitmap; // Make sure.
+
   // If the reference hdc is null, take the desktop dc
   if (hDC == 0)
   {
index 60f4760..72aac3a 100644 (file)
@@ -483,6 +483,20 @@ IntDumpRegion(HRGN hRgn)
 }
 #endif /* not NDEBUG */
 
+
+INT
+FASTCALL
+REGION_Complexity( PROSRGNDATA obj )
+{
+    switch(obj->rdh.nCount)
+    {
+       DPRINT("Region Complexity -> %d",obj->rdh.nCount);
+       case 0:  return NULLREGION;
+       case 1:  return SIMPLEREGION;
+       default: return COMPLEXREGION;
+    }
+}
+
 static
 BOOL
 FASTCALL
@@ -2065,6 +2079,62 @@ REGION_Cleanup(PVOID ObjectBody)
     return TRUE;
 }
 
+INT
+FASTCALL
+IntGdiCombineRgn(PROSRGNDATA destRgn,
+                 PROSRGNDATA src1Rgn,
+                 PROSRGNDATA src2Rgn,
+                    INT  CombineMode)
+{
+  INT result = ERROR;
+
+  if (destRgn)
+  {
+     if (src1Rgn)
+     {
+        if (CombineMode == RGN_COPY)
+        {
+           if ( !REGION_CopyRegion(destRgn, src1Rgn) )
+               return ERROR;
+           result = destRgn->rdh.iType;
+        }
+        else
+        {
+           if (src2Rgn)
+           {
+              switch (CombineMode)
+              {
+                 case RGN_AND:
+                     REGION_IntersectRegion(destRgn, src1Rgn, src2Rgn);
+                     break;
+                 case RGN_OR:
+                     REGION_UnionRegion(destRgn, src1Rgn, src2Rgn);
+                     break;
+                 case RGN_XOR:
+                     REGION_XorRegion(destRgn, src1Rgn, src2Rgn);
+                     break;
+                 case RGN_DIFF:
+                     REGION_SubtractRegion(destRgn, src1Rgn, src2Rgn);
+                     break;
+              }
+              result = destRgn->rdh.iType;
+           }
+           else if (src2Rgn == NULL)
+           {
+               DPRINT1("IntGdiCombineRgn requires hSrc2 != NULL for combine mode %d!\n", CombineMode);
+           }
+        }
+     }
+  }
+  else
+  {
+     DPRINT("IntGdiCombineRgn: hDest unavailable\n");
+     result = ERROR;
+  }
+  return result;
+}
+
+
 // NtGdi Exported Functions
 INT
 STDCALL