diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 1530685b431..e83091eed0b 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -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; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index c03537dcfa4..8a7d6d5c434 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -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, diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index a8857464de8..865bf90f15b 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -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) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index a5465fbb527..8db93579160 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -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);