Henri Verbeet : wined3d: Just return the surface from wined3d_device_get_surface_from_dc().

Alexandre Julliard julliard at winehq.org
Wed Oct 3 13:20:35 CDT 2012


Module: wine
Branch: master
Commit: 50c61959ebb7c4604430e39ef828f5f2ef1137d4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=50c61959ebb7c4604430e39ef828f5f2ef1137d4

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Oct  2 22:15:38 2012 +0200

wined3d: Just return the surface from wined3d_device_get_surface_from_dc().

---

 dlls/ddraw/ddraw.c        |    4 +---
 dlls/wined3d/device.c     |   12 +++++-------
 dlls/wined3d/wined3d.spec |    2 +-
 include/wine/wined3d.h    |    3 +--
 4 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 1530685..e83091e 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 c03537d..8a7d6d5 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 a885746..865bf90 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 a5465fb..8db9357 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);




More information about the wine-cvs mailing list