[ros-diffs] [jimtabor] 33629: Fix behavior if bmi null in NtGdiCreateDIBSection. Start internal functions for regions, includes a wine port get_region_type.

jimtabor at svn.reactos.org jimtabor at svn.reactos.org
Thu May 22 00:32:14 CEST 2008


Author: jimtabor
Date: Wed May 21 17:32:13 2008
New Revision: 33629

URL: http://svn.reactos.org/svn/reactos?rev=33629&view=rev
Log:
Fix behavior if bmi null in NtGdiCreateDIBSection. Start internal functions for regions, includes a wine port get_region_type.

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

Modified: trunk/reactos/subsystems/win32/win32k/include/region.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/region.h?rev=33629&r1=33628&r2=33629&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/region.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/region.h [iso-8859-1] Wed May 21 17:32:13 2008
@@ -38,6 +38,9 @@
 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)
 

Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/dibobj.c?rev=33629&r1=33628&r2=33629&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] Wed May 21 17:32:13 2008
@@ -994,6 +994,8 @@
   DC *dc;
   BOOL bDesktopDC = FALSE;
 
+  if (!bmi) return hbitmap; // Make sure.
+
   // If the reference hdc is null, take the desktop dc
   if (hDC == 0)
   {

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=33629&r1=33628&r2=33629&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] Wed May 21 17:32:13 2008
@@ -483,6 +483,20 @@
 }
 #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
@@ -2064,6 +2078,62 @@
         ExFreePool(pRgn->Buffer);
     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



More information about the Ros-diffs mailing list