[PATCH 7/7] wined3d: Pass a struct wined3d_output pointer to wined3d_device_set_cursor_properties().

Zhiyi Zhang zzhang at codeweavers.com
Mon Mar 30 02:20:04 CDT 2020


Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/d3d8/device.c        | 5 ++++-
 dlls/d3d9/device.c        | 5 ++++-
 dlls/wined3d/device.c     | 5 +++--
 dlls/wined3d/wined3d.spec | 2 +-
 include/wine/wined3d.h    | 3 ++-
 5 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 44a81ba672..25067512f9 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -740,6 +740,7 @@ static HRESULT WINAPI d3d8_device_SetCursorProperties(IDirect3DDevice8 *iface,
 {
     struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
     struct d3d8_surface *bitmap_impl = unsafe_impl_from_IDirect3DSurface8(bitmap);
+    unsigned int output_idx;
     HRESULT hr;
 
     TRACE("iface %p, hotspot_x %u, hotspot_y %u, bitmap %p.\n",
@@ -752,8 +753,10 @@ static HRESULT WINAPI d3d8_device_SetCursorProperties(IDirect3DDevice8 *iface,
     }
 
     wined3d_mutex_lock();
+    output_idx = device->adapter_ordinal;
     hr = wined3d_device_set_cursor_properties(device->wined3d_device,
-            hotspot_x, hotspot_y, bitmap_impl->wined3d_texture, bitmap_impl->sub_resource_idx);
+            device->d3d_parent->wined3d_outputs[output_idx], hotspot_x, hotspot_y,
+            bitmap_impl->wined3d_texture, bitmap_impl->sub_resource_idx);
     wined3d_mutex_unlock();
 
     return hr;
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 61cb505d77..8204376106 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -787,6 +787,7 @@ static HRESULT WINAPI d3d9_device_SetCursorProperties(IDirect3DDevice9Ex *iface,
 {
     struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
     struct d3d9_surface *bitmap_impl = unsafe_impl_from_IDirect3DSurface9(bitmap);
+    unsigned int output_idx;
     HRESULT hr;
 
     TRACE("iface %p, hotspot_x %u, hotspot_y %u, bitmap %p.\n",
@@ -799,8 +800,10 @@ static HRESULT WINAPI d3d9_device_SetCursorProperties(IDirect3DDevice9Ex *iface,
     }
 
     wined3d_mutex_lock();
+    output_idx = device->adapter_ordinal;
     hr = wined3d_device_set_cursor_properties(device->wined3d_device,
-            hotspot_x, hotspot_y, bitmap_impl->wined3d_texture, bitmap_impl->sub_resource_idx);
+            device->d3d_parent->wined3d_outputs[output_idx], hotspot_x, hotspot_y,
+            bitmap_impl->wined3d_texture, bitmap_impl->sub_resource_idx);
     wined3d_mutex_unlock();
 
     return hr;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 9d5025518d..b345e7e6bf 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4906,7 +4906,8 @@ static struct wined3d_texture *wined3d_device_create_cursor_texture(struct wined
 }
 
 HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device,
-        UINT x_hotspot, UINT y_hotspot, struct wined3d_texture *texture, unsigned int sub_resource_idx)
+        struct wined3d_output *output, unsigned int x_hotspot, unsigned int y_hotspot,
+        struct wined3d_texture *texture, unsigned int sub_resource_idx)
 {
     unsigned int texture_level = sub_resource_idx % texture->level_count;
     unsigned int cursor_width, cursor_height;
@@ -4945,7 +4946,7 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device
     }
 
     /* Cursor size must not exceed display mode */
-    if (FAILED(hr = wined3d_output_get_display_mode(&device->adapter->outputs[0], &mode, NULL)))
+    if (FAILED(hr = wined3d_output_get_display_mode(output, &mode, NULL)))
     {
         ERR("Failed to get display mode, hr %#x.\n", hr);
         return WINED3DERR_INVALIDCALL;
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 22a9a9dd74..a7ba855865 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -115,7 +115,7 @@
 @ cdecl wined3d_device_set_cs_sampler(ptr long ptr)
 @ cdecl wined3d_device_set_cs_uav(ptr long ptr long)
 @ cdecl wined3d_device_set_cursor_position(ptr long long long)
-@ cdecl wined3d_device_set_cursor_properties(ptr long long ptr long)
+@ cdecl wined3d_device_set_cursor_properties(ptr ptr long long ptr long)
 @ cdecl wined3d_device_set_depth_stencil_view(ptr ptr)
 @ cdecl wined3d_device_set_dialog_box_mode(ptr long)
 @ cdecl wined3d_device_set_domain_shader(ptr ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 0b3b41896e..c8616652af 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2435,7 +2435,8 @@ void __cdecl wined3d_device_set_cs_uav(struct wined3d_device *device, unsigned i
 void __cdecl wined3d_device_set_cursor_position(struct wined3d_device *device,
         int x_screen_space, int y_screen_space, DWORD flags);
 HRESULT __cdecl wined3d_device_set_cursor_properties(struct wined3d_device *device,
-        UINT x_hotspot, UINT y_hotspot, struct wined3d_texture *texture, unsigned int sub_resource_idx);
+        struct wined3d_output *output, unsigned int x_hotspot, unsigned int y_hotspot,
+        struct wined3d_texture *texture, unsigned int sub_resource_idx);
 HRESULT __cdecl wined3d_device_set_depth_stencil_view(struct wined3d_device *device,
         struct wined3d_rendertarget_view *view);
 HRESULT __cdecl wined3d_device_set_dialog_box_mode(struct wined3d_device *device, BOOL enable_dialogs);
-- 
2.20.1



More information about the wine-devel mailing list