wined3d: Just return the surface from wined3d_device_get_surface_from_dc().

This commit is contained in:
Henri Verbeet 2012-10-02 22:15:38 +02:00 committed by Alexandre Julliard
parent e4df956f95
commit 50c61959eb
4 changed files with 8 additions and 13 deletions

View File

@ -2422,14 +2422,12 @@ static HRESULT WINAPI ddraw7_GetSurfaceFromDC(IDirectDraw7 *iface, HDC hdc,
struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
struct wined3d_surface *wined3d_surface;
struct ddraw_surface *surface_impl;
HRESULT hr;
TRACE("iface %p, dc %p, surface %p.\n", iface, hdc, Surface);
if (!Surface) return E_INVALIDARG;
hr = wined3d_device_get_surface_from_dc(ddraw->wined3d_device, hdc, &wined3d_surface);
if (FAILED(hr))
if (!(wined3d_surface = wined3d_device_get_surface_from_dc(ddraw->wined3d_device, hdc)))
{
TRACE("No surface found for dc %p.\n", hdc);
*Surface = NULL;

View File

@ -5417,15 +5417,14 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
TRACE("Resource released.\n");
}
HRESULT CDECL wined3d_device_get_surface_from_dc(const struct wined3d_device *device,
HDC dc, struct wined3d_surface **surface)
struct wined3d_surface * CDECL wined3d_device_get_surface_from_dc(const struct wined3d_device *device, HDC dc)
{
struct wined3d_resource *resource;
TRACE("device %p, dc %p, surface %p.\n", device, dc, surface);
TRACE("device %p, dc %p.\n", device, dc);
if (!dc)
return WINED3DERR_INVALIDCALL;
return NULL;
LIST_FOR_EACH_ENTRY(resource, &device->resources, struct wined3d_resource, resource_list_entry)
{
@ -5436,13 +5435,12 @@ HRESULT CDECL wined3d_device_get_surface_from_dc(const struct wined3d_device *de
if (s->hDC == dc)
{
TRACE("Found surface %p for dc %p.\n", s, dc);
*surface = s;
return WINED3D_OK;
return s;
}
}
}
return WINED3DERR_INVALIDCALL;
return NULL;
}
HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,

View File

@ -82,7 +82,7 @@
@ cdecl wined3d_device_get_software_vertex_processing(ptr)
@ cdecl wined3d_device_get_stream_source(ptr long ptr ptr ptr)
@ cdecl wined3d_device_get_stream_source_freq(ptr long ptr)
@ cdecl wined3d_device_get_surface_from_dc(ptr ptr ptr)
@ cdecl wined3d_device_get_surface_from_dc(ptr ptr)
@ cdecl wined3d_device_get_swapchain(ptr long)
@ cdecl wined3d_device_get_swapchain_count(ptr)
@ cdecl wined3d_device_get_texture(ptr long)

View File

@ -2152,8 +2152,7 @@ HRESULT __cdecl wined3d_device_get_stream_source(const struct wined3d_device *de
UINT stream_idx, struct wined3d_buffer **buffer, UINT *offset, UINT *stride);
HRESULT __cdecl wined3d_device_get_stream_source_freq(const struct wined3d_device *device,
UINT stream_idx, UINT *divider);
HRESULT __cdecl wined3d_device_get_surface_from_dc(const struct wined3d_device *device,
HDC dc, struct wined3d_surface **surface);
struct wined3d_surface * __cdecl wined3d_device_get_surface_from_dc(const struct wined3d_device *device, HDC dc);
struct wined3d_swapchain * __cdecl wined3d_device_get_swapchain(const struct wined3d_device *device,
UINT swapchain_idx);
UINT __cdecl wined3d_device_get_swapchain_count(const struct wined3d_device *device);