[ros-diffs] [tkreuzer] 50280: [WIN32K] Implement NtGdiGetBoundsRect and NtGdiSetBoundsRect. Patch by Samuel Serapion with modifications by me.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Tue Jan 4 12:36:20 UTC 2011


Author: tkreuzer
Date: Tue Jan  4 12:36:19 2011
New Revision: 50280

URL: http://svn.reactos.org/svn/reactos?rev=50280&view=rev
Log:
[WIN32K]
Implement NtGdiGetBoundsRect and NtGdiSetBoundsRect. Patch by Samuel Serapion with modifications by me.

Modified:
    trunk/reactos/subsystems/win32/win32k/objects/coord.c
    trunk/reactos/subsystems/win32/win32k/objects/dcutil.c

Modified: trunk/reactos/subsystems/win32/win32k/objects/coord.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/coord.c?rev=50280&r1=50279&r2=50280&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/coord.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/coord.c [iso-8859-1] Tue Jan  4 12:36:19 2011
@@ -1057,7 +1057,7 @@
         cxVirtualDeviceMm = NtGdiGetDeviceCaps(hdc, HORZSIZE);
         cyVirtualDeviceMm = NtGdiGetDeviceCaps(hdc, VERTSIZE);
     }
-    else if (cxVirtualDevicePixel == 0 || cyVirtualDevicePixel == 0 || 
+    else if (cxVirtualDevicePixel == 0 || cyVirtualDevicePixel == 0 ||
              cxVirtualDeviceMm == 0 || cyVirtualDeviceMm == 0)
     {
         return FALSE;
@@ -1322,28 +1322,4 @@
     return Ret;
 }
 
-
-DWORD
-APIENTRY
-NtGdiGetBoundsRect(
-    IN HDC hdc,
-    OUT LPRECT prc,
-    IN DWORD f)
-{
-    DPRINT1("stub\n");
-    return  DCB_RESET;   /* bounding rectangle always empty */
-}
-
-DWORD
-APIENTRY
-NtGdiSetBoundsRect(
-    IN HDC hdc,
-    IN LPRECT prc,
-    IN DWORD f)
-{
-    DPRINT1("stub\n");
-    return  DCB_DISABLE;   /* bounding rectangle always empty */
-}
-
-
 /* EOF */

Modified: trunk/reactos/subsystems/win32/win32k/objects/dcutil.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/dcutil.c?rev=50280&r1=50279&r2=50280&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dcutil.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dcutil.c [iso-8859-1] Tue Jan  4 12:36:19 2011
@@ -464,3 +464,92 @@
     DC_UnlockDc(pdc);
     return Ret;
 }
+
+DWORD
+APIENTRY
+NtGdiGetBoundsRect(
+    IN HDC hdc,
+    OUT LPRECT prc,
+    IN DWORD flags)
+{
+    DWORD ret;
+    PDC pdc;
+
+    /* Lock the DC */
+    if (!(pdc = DC_LockDc(hdc))) return 0;
+
+    /* Get the return value */
+    ret = pdc->fs & DC_ACCUM_APP ? DCB_ENABLE : DCB_DISABLE;
+    ret |= RECTL_bIsEmptyRect(&pdc->erclBoundsApp) ? DCB_RESET : DCB_SET;
+
+    /* Copy the rect to the caller */
+    _SEH2_TRY
+    {
+        ProbeForWrite(prc, sizeof(RECT), 1);
+        *prc = pdc->erclBoundsApp;
+    }
+    _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+    {
+        ret = 0;
+    }
+    _SEH2_END;
+
+    if (flags & DCB_RESET)
+    {
+        RECTL_vSetEmptyRect(&pdc->erclBoundsApp);
+    }
+
+    DC_UnlockDc(pdc);
+    return ret;
+}
+
+
+DWORD
+APIENTRY
+NtGdiSetBoundsRect(
+    IN HDC hdc,
+    IN LPRECT prc,
+    IN DWORD flags)
+{
+    DWORD ret;
+    PDC pdc;
+    RECTL rcl;
+
+    /* Verify arguments */
+    if ((flags & DCB_ENABLE) && (flags & DCB_DISABLE)) return 0;
+
+    /* Lock the DC */
+    if (!(pdc = DC_LockDc(hdc))) return 0;
+
+    /* Get the return value */
+    ret = pdc->fs & DC_ACCUM_APP ? DCB_ENABLE : DCB_DISABLE;
+    ret |= RECTL_bIsEmptyRect(&pdc->erclBoundsApp) ? DCB_RESET : DCB_SET;
+
+    if (flags & DCB_RESET)
+    {
+        RECTL_vSetEmptyRect(&pdc->erclBoundsApp);
+    }
+
+    if (flags & DCB_ACCUMULATE)
+    {
+        /* Capture the rect */
+        _SEH2_TRY
+        {
+            ProbeForRead(prc, sizeof(RECT), 1);
+            rcl = *prc;
+        }
+        _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+        {
+            _SEH2_YIELD(return 0;)
+        }
+        _SEH2_END;
+
+        RECTL_vMakeWellOrdered(&rcl);
+        RECTL_bUnionRect(&pdc->erclBoundsApp, &pdc->erclBoundsApp, &rcl);
+    }
+
+    if (flags & DCB_ENABLE) pdc->fs |= DC_ACCUM_APP;
+    if (flags & DCB_DISABLE) pdc->fs &= ~DC_ACCUM_APP;
+    DC_UnlockDc( pdc );
+    return ret;
+}




More information about the Ros-diffs mailing list