Henri Verbeet : ddrawex: Correctly retrieve the "outer" surface in IDirectDraw3Impl_GetSurfaceFromDC().

Alexandre Julliard julliard at winehq.org
Mon Mar 29 09:58:00 CDT 2010


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Mon Mar 29 13:31:09 2010 +0200

ddrawex: Correctly retrieve the "outer" surface in IDirectDraw3Impl_GetSurfaceFromDC().

---

 dlls/ddrawex/ddraw.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/dlls/ddrawex/ddraw.c b/dlls/ddrawex/ddraw.c
index 8c6b937..353ec8b 100644
--- a/dlls/ddrawex/ddraw.c
+++ b/dlls/ddrawex/ddraw.c
@@ -1333,17 +1333,30 @@ IDirectDraw3Impl_GetSurfaceFromDC(IDirectDraw3 *iface,
                                   IDirectDrawSurface **Surface)
 {
     IDirectDrawImpl *This = impl_from_dd3(iface);
-    IDirectDrawSurface4 *surf4;
+    IDirectDrawSurface4 *surf4, *outer;
+    IDirectDrawSurface *inner;
     HRESULT hr;
     TRACE("(%p)->(%p, %p): Thunking to IDirectDraw4\n", This, hdc, Surface);
 
-    hr = IDirectDraw4_GetSurfaceFromDC(dd4_from_impl(This), hdc, &surf4);
+    if (!Surface) return E_POINTER;
+
+    hr = IDirectDraw4_GetSurfaceFromDC(This->parent, hdc, (IDirectDrawSurface4 **)&inner);
     if(FAILED(hr))
     {
         *Surface = NULL;
         return hr;
     }
-    IDirectDrawSurface4_QueryInterface(surf4, &IID_IDirectDrawSurface, (void **) Surface);
+
+    hr = IDirectDrawSurface_QueryInterface(inner, &IID_IDirectDrawSurface4, (void **)&surf4);
+    IDirectDrawSurface_Release(inner);
+    if (FAILED(hr))
+    {
+        *Surface = NULL;
+        return hr;
+    }
+
+    outer = dds_get_outer(surf4);
+    hr = IDirectDrawSurface4_QueryInterface(outer, &IID_IDirectDrawSurface, (void **)Surface);
     IDirectDrawSurface4_Release(surf4);
     return hr;
 }




More information about the wine-cvs mailing list