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

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-09-08 13:26:52 +03:00 committed by Alexandre Julliard
parent 74a923c31e
commit 4cffa0e263
4 changed files with 34 additions and 9 deletions

View File

@ -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);

View File

@ -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))
{

View File

@ -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,

View File

@ -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;
}