Henri Verbeet : ddraw: Allow querying the surface interface if a device was created from a surface .

Alexandre Julliard julliard at winehq.org
Wed Jan 18 14:03:37 CST 2012


Module: wine
Branch: master
Commit: cf636cc3b3b1de0d966d43e04314a0454fc055a4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=cf636cc3b3b1de0d966d43e04314a0454fc055a4

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Jan 17 21:13:32 2012 +0100

ddraw: Allow querying the surface interface if a device was created from a surface.

---

 dlls/ddraw/ddraw_private.h |    2 ++
 dlls/ddraw/device.c        |    7 +++++++
 dlls/ddraw/surface.c       |    1 +
 3 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h
index c23007e..2e5b65b 100644
--- a/dlls/ddraw/ddraw_private.h
+++ b/dlls/ddraw/ddraw_private.h
@@ -299,6 +299,8 @@ struct IDirect3DDeviceImpl
 
     /* Required to keep track which of two available texture blending modes in d3ddevice3 is used */
     BOOL legacyTextureBlending;
+    BOOL from_surface;
+
     D3DMATRIX legacy_projection;
     D3DMATRIX legacy_clipspace;
 
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 7e935e5..a056d9d 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -179,6 +179,13 @@ IDirect3DDeviceImpl_7_QueryInterface(IDirect3DDevice7 *iface,
         TRACE("(%p) Returning IDirect3DDevice7 interface at %p\n", This, *obj);
     }
 
+    /* DirectDrawSurface */
+    else if (IsEqualGUID(&IID_IDirectDrawSurface, refiid) && This->from_surface)
+    {
+        *obj = &This->target->IDirectDrawSurface_iface;
+        TRACE("Returning IDirectDrawSurface interface %p.\n", *obj);
+    }
+
     /* Unknown interface */
     else
     {
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index f1477f4..e57762c 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -199,6 +199,7 @@ static HRESULT WINAPI ddraw_surface7_QueryInterface(IDirectDrawSurface7 *iface,
         if (d3d)
         {
             device_impl = impl_from_IDirect3DDevice7(d3d);
+            device_impl->from_surface = TRUE;
             *obj = &device_impl->IDirect3DDevice_iface;
             TRACE("(%p) Returning IDirect3DDevice interface at %p\n", This, *obj);
             return S_OK;




More information about the wine-cvs mailing list