Nikolay Sivov : dxgi: Added partial implementation of GetDC()/ReleaseDC().

Alexandre Julliard julliard at winehq.org
Thu Sep 8 10:39:21 CDT 2016


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Sep  8 13:26:52 2016 +0300

dxgi: Added partial implementation of GetDC()/ReleaseDC().

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d10_1/tests/d3d10_1.c |  4 ++--
 dlls/d3d11/tests/d3d11.c     |  6 +++---
 dlls/dxgi/dxgi_private.h     |  1 +
 dlls/dxgi/surface.c          | 32 ++++++++++++++++++++++++++++----
 4 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/dlls/d3d10_1/tests/d3d10_1.c b/dlls/d3d10_1/tests/d3d10_1.c
index f70b4ff..6007a3b 100644
--- a/dlls/d3d10_1/tests/d3d10_1.c
+++ b/dlls/d3d10_1/tests/d3d10_1.c
@@ -720,7 +720,7 @@ static void test_getdc(void)
     todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
 
     hr = IDXGISurface1_GetDC(surface1, FALSE, &dc);
-    todo_wine ok(SUCCEEDED(hr), "Failed to get DC, hr %#x.\n", hr);
+    ok(SUCCEEDED(hr), "Failed to get DC, hr %#x.\n", hr);
 
     /* One more time. */
     dc = (HDC)0xdeadbeef;
@@ -729,7 +729,7 @@ static void test_getdc(void)
     ok(dc == (HDC)0xdeadbeef, "Got unexpected dc %p.\n", dc);
 
     hr = IDXGISurface1_ReleaseDC(surface1, NULL);
-    todo_wine ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr);
+    ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr);
 
     hr = IDXGISurface1_ReleaseDC(surface1, NULL);
     todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 43e43db..b53de3b 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -8426,10 +8426,10 @@ static void test_getdc(void)
     todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
 
     hr = IDXGISurface1_GetDC(surface, FALSE, &dc);
-    todo_wine ok(SUCCEEDED(hr), "Failed to get DC, hr %#x.\n", hr);
+    ok(SUCCEEDED(hr), "Failed to get DC, hr %#x.\n", hr);
 
     hr = IDXGISurface1_ReleaseDC(surface, NULL);
-    todo_wine ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr);
+    ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr);
 
     IDXGISurface1_Release(surface);
     ID3D11Texture2D_Release(texture);
@@ -8481,7 +8481,7 @@ static void test_getdc(void)
 
         dc = (void *)0x1234;
         hr = IDXGISurface1_GetDC(surface, FALSE, &dc);
-        todo_wine ok(SUCCEEDED(hr), "Got unexpected hr %#x for format %s.\n", hr, testdata[i].name);
+        ok(SUCCEEDED(hr), "Got unexpected hr %#x for format %s.\n", hr, testdata[i].name);
 
         if (FAILED(hr))
         {
diff --git a/dlls/dxgi/dxgi_private.h b/dlls/dxgi/dxgi_private.h
index 86ba34a..06892e2 100644
--- a/dlls/dxgi/dxgi_private.h
+++ b/dlls/dxgi/dxgi_private.h
@@ -184,6 +184,7 @@ struct dxgi_surface
     struct wined3d_private_store private_store;
     IDXGIDevice *device;
     struct wined3d_texture *wined3d_texture;
+    HDC dc;
 };
 
 HRESULT dxgi_surface_init(struct dxgi_surface *surface, IDXGIDevice *device,
diff --git a/dlls/dxgi/surface.c b/dlls/dxgi/surface.c
index 687caaa..36fc1e6 100644
--- a/dlls/dxgi/surface.c
+++ b/dlls/dxgi/surface.c
@@ -197,16 +197,39 @@ static HRESULT STDMETHODCALLTYPE dxgi_surface_Unmap(IDXGISurface1 *iface)
 /* IDXGISurface1 methods */
 static HRESULT STDMETHODCALLTYPE dxgi_surface_GetDC(IDXGISurface1 *iface, BOOL discard, HDC *hdc)
 {
-    FIXME("iface %p, discard %d, hdc %p stub!\n", iface, discard, hdc);
+    struct dxgi_surface *surface = impl_from_IDXGISurface1(iface);
+    HRESULT hr;
 
-    return E_NOTIMPL;
+    FIXME("iface %p, discard %d, hdc %p semi-stub!\n", iface, discard, hdc);
+
+    if (!hdc)
+        return E_INVALIDARG;
+
+    wined3d_mutex_lock();
+    hr = wined3d_texture_get_dc(surface->wined3d_texture, 0, hdc);
+    wined3d_mutex_unlock();
+
+    if (SUCCEEDED(hr))
+       surface->dc = *hdc;
+
+    return hr;
 }
 
 static HRESULT STDMETHODCALLTYPE dxgi_surface_ReleaseDC(IDXGISurface1 *iface, RECT *dirty_rect)
 {
-    FIXME("iface %p, rect %p stub!\n", iface, dirty_rect);
+    struct dxgi_surface *surface = impl_from_IDXGISurface1(iface);
+    HRESULT hr;
 
-    return E_NOTIMPL;
+    TRACE("iface %p, rect %s\n", iface, wine_dbgstr_rect(dirty_rect));
+
+    if (!IsRectEmpty(dirty_rect))
+        FIXME("dirty rectangle is ignored.\n");
+
+    wined3d_mutex_lock();
+    hr = wined3d_texture_release_dc(surface->wined3d_texture, 0, surface->dc);
+    wined3d_mutex_unlock();
+
+    return hr;
 }
 
 static const struct IDXGISurface1Vtbl dxgi_surface_vtbl =
@@ -249,6 +272,7 @@ HRESULT dxgi_surface_init(struct dxgi_surface *surface, IDXGIDevice *device,
     surface->outer_unknown = outer ? outer : &surface->IUnknown_iface;
     surface->device = device;
     surface->wined3d_texture = wined3d_texture;
+    surface->dc = NULL;
 
     return S_OK;
 }




More information about the wine-cvs mailing list