Commit 4cffa0e2 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

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

parent 74a923c3
......@@ -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);
......
......@@ -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))
{
......
......@@ -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,
......
......@@ -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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment