https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8a6312abda24d11d6c9abfe133013b32e4aef3e6

commit 8a6312abda24d11d6c9abfe133013b32e4aef3e6
Author:     Oleg Dubinskiy <[email protected]>
AuthorDate: Mon Dec 20 20:27:13 2021 +0000
Commit:     GitHub <[email protected]>
CommitDate: Mon Dec 20 21:27:13 2021 +0100

    [WIN32SS][NTDDRAW] Improve DxEngGetDCState type 2 implementation (#4176)
    
    - Use the REGION_Complexity() function to get the actual region complexity 
instead of just number of rectangles.
    - Don't use prgnRao at all, because it is always uninitialized when passed 
to the function. So in condition between prgnRao and prgnVis, the 2nd one 
always succeeds.
    - Update the comment accordingly.
    - Additionally, add a DPRINT to the end of the function, which displays the 
returned value.
    
    This allows to properly enable and use DirectDraw and Direct3D hardware 
acceleration with the following MS DirectX components: ddraw.dll, d3d8.dll, 
d3d9.dll and dxg.sys. As in VM, same on real hardware.
    But note that now the bugcheck 0x50 (PAGE_FAULT_IN_NONPAGED_AREA) occurs 
when executing fullscreen DDraw apps, after switching display mode. It's 
unhidden by this fix.
    Addendum to 855bf46.
    CORE-17561
---
 win32ss/reactx/ntddraw/dxeng.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/win32ss/reactx/ntddraw/dxeng.c b/win32ss/reactx/ntddraw/dxeng.c
index 24cb542643e..7004e58e480 100644
--- a/win32ss/reactx/ntddraw/dxeng.c
+++ b/win32ss/reactx/ntddraw/dxeng.c
@@ -464,8 +464,8 @@ DxEngGetDCState(HDC hDC,
                 retVal = (DWORD_PTR) pDC->fs & DC_FLAG_FULLSCREEN;
                 break;
             case 2:
-                /* Return the number of rectangles in the visible region. */
-                retVal = (DWORD_PTR) pDC->prgnRao ? pDC->prgnRao->rdh.nCount : 
pDC->prgnVis->rdh.nCount;
+                /* Return the complexity of the visible region. */
+                retVal = (DWORD_PTR) REGION_Complexity(pDC->prgnVis);
                 break;
             case 3:
             {
@@ -481,6 +481,8 @@ DxEngGetDCState(HDC hDC,
         DC_UnlockDc(pDC);
     }
 
+    DPRINT1("Return value %08lx\n", retVal);
+
     return retVal;
 }
 

Reply via email to