https://git.reactos.org/?p=reactos.git;a=commitdiff;h=31139c253f24b2577423d4bc363e55caa5a9d8a0

commit 31139c253f24b2577423d4bc363e55caa5a9d8a0
Author:     Oleg Dubinskiy <oleg.dubinski...@gmail.com>
AuthorDate: Tue May 31 23:58:35 2022 +0200
Commit:     GitHub <nore...@github.com>
CommitDate: Wed Jun 1 00:58:35 2022 +0300

    [WIN32SS][NTDDRAW][NTGDI] Implement some DxEng* callbacks (#3638)
    
    Implement the following DxEng* functions:
    - DxEngAltLockSurface
    - DxEngDeleteSurface
    - DxEngReferenceHdev
    - DxEngSelectBitmap
    - DxEngSetBitmapOwner
    - DxEngUnreferenceHdev
    
    Update their prototypes and call the appropriate win32k functions
    inside them, since they are already implemented. Also get rid of
    now unused IntGdi(Un)ReferencePdev, whose were called only by dxeng,
    and whose are not used anymore. In Windows, DxEng(Un)ReferenceHdev calls
    PDEVOBJ_vReferencePDEV and PDEVOBJ_vDeferencePDEV directly (those
    correspond to our PDEVOBJ_vReference and PDEVOBJ_vRelease accordingly).
    
    Required by MS DirectDraw stack (ddraw.dll & dxg.sys). CORE-17561
---
 sdk/include/reactos/drivers/directx/dxeng.h |  8 ++++----
 win32ss/gdi/ntgdi/dc.h                      |  2 --
 win32ss/gdi/ntgdi/device.c                  | 12 -----------
 win32ss/reactx/ntddraw/dxeng.c              | 32 ++++++++++++++++-------------
 4 files changed, 22 insertions(+), 32 deletions(-)

diff --git a/sdk/include/reactos/drivers/directx/dxeng.h 
b/sdk/include/reactos/drivers/directx/dxeng.h
index c4ddf18c0c5..8a349ce6507 100644
--- a/sdk/include/reactos/drivers/directx/dxeng.h
+++ b/sdk/include/reactos/drivers/directx/dxeng.h
@@ -107,11 +107,11 @@ DWORD NTAPI DxEngSpSpritesVisible(DWORD x1);
 HDC NTAPI DxEngGetDesktopDC(ULONG DcType, BOOL EmptyDC, BOOL ValidatehWnd);
 BOOLEAN NTAPI DxEngDeleteDC(HDC hdc, BOOL Force);
 BOOLEAN NTAPI DxEngSetDCState(HDC hDC, DWORD SetType, DWORD Set);
-DWORD NTAPI DxEngSelectBitmap(DWORD x1, DWORD x2);
-DWORD NTAPI DxEngSetBitmapOwner(DWORD x1, DWORD x2);
-DWORD NTAPI DxEngDeleteSurface(DWORD x1);
+HBITMAP NTAPI DxEngSelectBitmap(HDC hdc, HBITMAP hbmp);
+BOOLEAN NTAPI DxEngSetBitmapOwner(HBITMAP hbmp, ULONG ulOwner);
+BOOLEAN NTAPI DxEngDeleteSurface(HSURF hsurf);
 DWORD NTAPI DxEngGetSurfaceData(DWORD x1, DWORD x2);
-DWORD NTAPI DxEngAltLockSurface(DWORD x1);
+SURFOBJ * NTAPI DxEngAltLockSurface(HSURF hsurf);
 DWORD NTAPI DxEngUploadPaletteEntryToSurface(DWORD x1, DWORD x2,DWORD x3, 
DWORD x4);
 DWORD NTAPI DxEngMarkSurfaceAsDirectDraw(DWORD x1, DWORD x2);
 DWORD NTAPI DxEngSelectPaletteToSurface(DWORD x1, DWORD x2);
diff --git a/win32ss/gdi/ntgdi/dc.h b/win32ss/gdi/ntgdi/dc.h
index f18480c5a94..358527103aa 100644
--- a/win32ss/gdi/ntgdi/dc.h
+++ b/win32ss/gdi/ntgdi/dc.h
@@ -200,8 +200,6 @@ VOID NTAPI DC_vRestoreDC(IN PDC pdc, INT iSaveLevel);
 VOID NTAPI DC_vFreeDcAttr(PDC pdc);
 VOID NTAPI DC_vInitDc(PDC pdc, DCTYPE dctype, PPDEVOBJ ppdev);
 
-VOID FASTCALL IntGdiReferencePdev(PPDEVOBJ pPDev);
-VOID FASTCALL IntGdiUnreferencePdev(PPDEVOBJ pPDev, DWORD CleanUpType);
 HDC FASTCALL IntGdiCreateDisplayDC(HDEV hDev, ULONG DcType, BOOL EmptyDC);
 BOOL FASTCALL IntGdiCleanDC(HDC hDC);
 VOID FASTCALL IntvGetDeviceCaps(PPDEVOBJ, PDEVCAPS);
diff --git a/win32ss/gdi/ntgdi/device.c b/win32ss/gdi/ntgdi/device.c
index 9a8bf433374..b9684fe9c9a 100644
--- a/win32ss/gdi/ntgdi/device.c
+++ b/win32ss/gdi/ntgdi/device.c
@@ -13,18 +13,6 @@
 
 PDC defaultDCstate = NULL;
 
-VOID FASTCALL
-IntGdiReferencePdev(PPDEVOBJ ppdev)
-{
-    UNIMPLEMENTED;
-}
-
-VOID FASTCALL
-IntGdiUnreferencePdev(PPDEVOBJ ppdev, DWORD CleanUpType)
-{
-    UNIMPLEMENTED;
-}
-
 BOOL FASTCALL
 IntCreatePrimarySurface(VOID)
 {
diff --git a/win32ss/reactx/ntddraw/dxeng.c b/win32ss/reactx/ntddraw/dxeng.c
index 2b1fe1cbd66..a096bf5f350 100644
--- a/win32ss/reactx/ntddraw/dxeng.c
+++ b/win32ss/reactx/ntddraw/dxeng.c
@@ -587,7 +587,7 @@ BOOLEAN
 APIENTRY
 DxEngReferenceHdev(HDEV hDev)
 {
-    IntGdiReferencePdev((PPDEVOBJ) hDev);
+    PDEVOBJ_vReference((PPDEVOBJ)hDev);
     /* ALWAYS return true */
     return TRUE;
 }
@@ -689,7 +689,7 @@ BOOLEAN
 APIENTRY
 DxEngUnreferenceHdev(HDEV hDev)
 {
-    IntGdiUnreferencePdev((PPDEVOBJ) hDev, 0);
+    PDEVOBJ_vRelease((PPDEVOBJ)hDev);
     return TRUE; // Always true.
 }
 
@@ -762,28 +762,31 @@ DxEngSetDCState(HDC hDC, DWORD SetType, DWORD Set)
 /************************************************************************/
 /* DxEngSelectBitmap                                                    */
 /************************************************************************/
-DWORD APIENTRY DxEngSelectBitmap(DWORD x1, DWORD x2)
+HBITMAP APIENTRY DxEngSelectBitmap(HDC hdc, HBITMAP hbmp)
 {
-    UNIMPLEMENTED;
-    return FALSE;
+    DPRINT1("ReactX Calling : DxEngSelectBitmap \n");
+
+    return NtGdiSelectBitmap(hdc, hbmp);
 }
 
 /************************************************************************/
 /* DxEngSetBitmapOwner                                                  */
 /************************************************************************/
-DWORD APIENTRY DxEngSetBitmapOwner(DWORD x1, DWORD x2)
+BOOLEAN APIENTRY DxEngSetBitmapOwner(HBITMAP hbmp, ULONG ulOwner)
 {
-    UNIMPLEMENTED;
-    return FALSE;
+    DPRINT1("ReactX Calling : DxEngSetBitmapOwner \n");
+
+    return GreSetBitmapOwner(hbmp, ulOwner);
 }
 
 /************************************************************************/
 /* DxEngDeleteSurface                                                   */
 /************************************************************************/
-DWORD APIENTRY DxEngDeleteSurface(DWORD x1)
+BOOLEAN APIENTRY DxEngDeleteSurface(HSURF hsurf)
 {
-    UNIMPLEMENTED;
-    return FALSE;
+    DPRINT1("ReactX Calling : DxEngDeleteSurface \n");
+
+    return EngDeleteSurface(hsurf);
 }
 
 /************************************************************************/
@@ -798,10 +801,11 @@ DWORD APIENTRY DxEngGetSurfaceData(DWORD x1, DWORD x2)
 /************************************************************************/
 /* DxEngAltLockSurface                                                  */
 /************************************************************************/
-DWORD APIENTRY DxEngAltLockSurface(DWORD x1)
+SURFOBJ * APIENTRY DxEngAltLockSurface(HSURF hsurf)
 {
-    UNIMPLEMENTED;
-    return FALSE;
+    DPRINT1("ReactX Calling : DxEngAltLockSurface \n");
+
+    return EngLockSurface(hsurf);
 }
 
 /************************************************************************/

Reply via email to