[ros-diffs] [greatlrd] 28001: partly implement NtGdiGetRandomRgn, we do not support metadc, so we will fail on thuse wine test for this api. The implemetions are base partly on wine and msdn

greatlrd at svn.reactos.org greatlrd at svn.reactos.org
Sun Jul 29 15:12:20 CEST 2007


Author: greatlrd
Date: Sun Jul 29 17:12:20 2007
New Revision: 28001

URL: http://svn.reactos.org/svn/reactos?rev=28001&view=rev
Log:
partly implement NtGdiGetRandomRgn, we do not support metadc, so we will fail on thuse wine test for this api. 
The implemetions are base partly on wine and msdn 

Modified:
    trunk/reactos/dll/win32/gdi32/gdi32.def
    trunk/reactos/dll/win32/gdi32/misc/stubs.c
    trunk/reactos/include/psdk/ntgdi.h
    trunk/reactos/subsystems/win32/win32k/objects/region.c
    trunk/reactos/tools/nci/w32ksvc.db

Modified: trunk/reactos/dll/win32/gdi32/gdi32.def
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/gdi32.def?rev=28001&r1=28000&r2=28001&view=diff
==============================================================================
--- trunk/reactos/dll/win32/gdi32/gdi32.def (original)
+++ trunk/reactos/dll/win32/gdi32/gdi32.def Sun Jul 29 17:12:20 2007
@@ -423,7 +423,7 @@
 GetPixelFormat at 4
 GetPolyFillMode at 4=NtGdiGetPolyFillMode at 4
 GetROP2 at 4=NtGdiGetROP2 at 4
-GetRandomRgn at 12
+GetRandomRgn at 12=NtGdiGetRandomRgn at 12
 GetRasterizerCaps at 8
 GetRegionData at 12=NtGdiGetRegionData at 12
 GetRelAbs at 8

Modified: trunk/reactos/dll/win32/gdi32/misc/stubs.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/stubs.c?rev=28001&r1=28000&r2=28001&view=diff
==============================================================================
--- trunk/reactos/dll/win32/gdi32/misc/stubs.c (original)
+++ trunk/reactos/dll/win32/gdi32/misc/stubs.c Sun Jul 29 17:12:20 2007
@@ -1295,21 +1295,6 @@
 }
 
 
-/*
- * @unimplemented
- */
-INT
-STDCALL
-GetRandomRgn(
-	HDC	a0,
-	HRGN	a1,
-	INT	a2
-	)
-{
-	UNIMPLEMENTED;
-	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-	return 0;
-}
 
 
 /*

Modified: trunk/reactos/include/psdk/ntgdi.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ntgdi.h?rev=28001&r1=28000&r2=28001&view=diff
==============================================================================
--- trunk/reactos/include/psdk/ntgdi.h (original)
+++ trunk/reactos/include/psdk/ntgdi.h Sun Jul 29 17:12:20 2007
@@ -2633,6 +2633,15 @@
 W32KAPI
 INT
 APIENTRY
+NtGdiGetRandomRgn(
+    IN HDC hDC, 
+    OUT HRGN hDest,
+    IN INT iCode
+);
+
+W32KAPI
+INT
+APIENTRY
 NtGdiGetRgnBox(
     IN HRGN hrgn,
     OUT LPRECT prcOut

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=28001&r1=28000&r2=28001&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/region.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/region.c Sun Jul 29 17:12:20 2007
@@ -2344,6 +2344,67 @@
 }
 
 
+/* See wine, msdn, osr and  Feng Yuan - Windows Graphics Programming Win32 Gdi And Directdraw */
+INT STDCALL
+NtGdiGetRandomRgn(HDC hDC, HRGN hDest, INT iCode)
+{
+    PDC pDC;
+    HRGN hSrc = NULL;
+    POINT org;
+
+    if ((hDC == NULL) || (hDest == NULL))
+    {
+        return -1;
+    }
+    if ((iCode<1 ) || (iCode>4 ))
+    {
+        return -1;
+    }
+
+    pDC = DC_LockDc(hDC);
+    if (pDC == NULL)
+    {
+        return -1;
+    }
+
+    switch (iCode)
+    {
+        case 1:
+            hSrc = pDC->w.hClipRgn;
+            break;
+        case 2:
+            //hSrc = dc->hMetaRgn;
+            DPRINT1("hMetaRgn not implement\n");
+            DC_UnlockDc(pDC);
+            return -1;
+            break;
+        case 3:
+            DPRINT1("waring : hMetaRgn not implement\n");
+            //hSrc = dc->hMetaClipRgn;
+            if(!hSrc)
+            {
+                hSrc = pDC->w.hClipRgn;
+            }
+            //if(!hSrc) rgn = dc->hMetaRgn;
+            break;
+        case 4:
+            hSrc = pDC->w.hVisRgn;
+    }
+    if (hSrc)
+    {
+        NtGdiCombineRgn(hDest, hSrc, 0, RGN_COPY);
+    }
+    if (iCode ==  SYSRGN)
+    {
+        IntGdiGetDCOrgEx(pDC, &org);
+        NtGdiOffsetRgn(hDest, org.x, org.y );
+    }
+
+   DC_UnlockDc(pDC);
+
+    return (hSrc != 0);
+}
+
 INT STDCALL
 NtGdiGetRgnBox(HRGN  hRgn,
 	      LPRECT  pRect)
@@ -2428,13 +2489,13 @@
   DPRINT("NtGdiOffsetRgn: hRgn %d Xoffs %d Yoffs %d rgn %x\n", hRgn, XOffset, YOffset, rgn );
 
   if( !rgn ){
-	  DPRINT("NtGdiOffsetRgn: hRgn error\n");
-	  return ERROR;
+        DPRINT("NtGdiOffsetRgn: hRgn error\n");
+        return ERROR;
   }
 
   if(XOffset || YOffset) {
     int nbox = rgn->rdh.nCount;
-	PRECT pbox = (PRECT)rgn->Buffer;
+    PRECT pbox = (PRECT)rgn->Buffer;
 
     if(nbox && pbox) {
       while(nbox--) {
@@ -2475,7 +2536,7 @@
   BITMAPOBJ *BitmapObj;
 
   if( !dc )
-	return FALSE;
+    return FALSE;
 
   if(!(tmpVisRgn = NtGdiCreateRectRgn(0, 0, 0, 0)))
   {

Modified: trunk/reactos/tools/nci/w32ksvc.db
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/nci/w32ksvc.db?rev=28001&r1=28000&r2=28001&view=diff
==============================================================================
--- trunk/reactos/tools/nci/w32ksvc.db (original)
+++ trunk/reactos/tools/nci/w32ksvc.db Sun Jul 29 17:12:20 2007
@@ -615,3 +615,4 @@
 NtGdiDdUnlockD3D                        2
 NtGdiDdUpdateOverlay                    3
 NtGdiDdWaitForVerticalBlank             2
+NtGdiGetRandomRgn				    3




More information about the Ros-diffs mailing list