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:
parent
74a923c31e
commit
4cffa0e263
|
@ -720,7 +720,7 @@ static void test_getdc(void)
|
||||||
todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
|
todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = IDXGISurface1_GetDC(surface1, FALSE, &dc);
|
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. */
|
/* One more time. */
|
||||||
dc = (HDC)0xdeadbeef;
|
dc = (HDC)0xdeadbeef;
|
||||||
|
@ -729,7 +729,7 @@ static void test_getdc(void)
|
||||||
ok(dc == (HDC)0xdeadbeef, "Got unexpected dc %p.\n", dc);
|
ok(dc == (HDC)0xdeadbeef, "Got unexpected dc %p.\n", dc);
|
||||||
|
|
||||||
hr = IDXGISurface1_ReleaseDC(surface1, NULL);
|
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);
|
hr = IDXGISurface1_ReleaseDC(surface1, NULL);
|
||||||
todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
|
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);
|
todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = IDXGISurface1_GetDC(surface, FALSE, &dc);
|
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);
|
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);
|
IDXGISurface1_Release(surface);
|
||||||
ID3D11Texture2D_Release(texture);
|
ID3D11Texture2D_Release(texture);
|
||||||
|
@ -8481,7 +8481,7 @@ static void test_getdc(void)
|
||||||
|
|
||||||
dc = (void *)0x1234;
|
dc = (void *)0x1234;
|
||||||
hr = IDXGISurface1_GetDC(surface, FALSE, &dc);
|
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))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
|
|
|
@ -184,6 +184,7 @@ struct dxgi_surface
|
||||||
struct wined3d_private_store private_store;
|
struct wined3d_private_store private_store;
|
||||||
IDXGIDevice *device;
|
IDXGIDevice *device;
|
||||||
struct wined3d_texture *wined3d_texture;
|
struct wined3d_texture *wined3d_texture;
|
||||||
|
HDC dc;
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT dxgi_surface_init(struct dxgi_surface *surface, IDXGIDevice *device,
|
HRESULT dxgi_surface_init(struct dxgi_surface *surface, IDXGIDevice *device,
|
||||||
|
|
|
@ -197,16 +197,39 @@ static HRESULT STDMETHODCALLTYPE dxgi_surface_Unmap(IDXGISurface1 *iface)
|
||||||
/* IDXGISurface1 methods */
|
/* IDXGISurface1 methods */
|
||||||
static HRESULT STDMETHODCALLTYPE dxgi_surface_GetDC(IDXGISurface1 *iface, BOOL discard, HDC *hdc)
|
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)
|
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 =
|
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->outer_unknown = outer ? outer : &surface->IUnknown_iface;
|
||||||
surface->device = device;
|
surface->device = device;
|
||||||
surface->wined3d_texture = wined3d_texture;
|
surface->wined3d_texture = wined3d_texture;
|
||||||
|
surface->dc = NULL;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue