Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/d3d8/tests/device.c | 1 - dlls/d3d9/tests/device.c | 1 - dlls/wined3d/device.c | 13 +++++++++---- 3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index c96adfc7481..6bb8ab3a02b 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -1027,7 +1027,6 @@ static void test_cursor(void) expected_hr = D3D_OK; else expected_hr = D3DERR_INVALIDCALL; - todo_wine_if(expected_hr == D3DERR_INVALIDCALL) ok(hr == expected_hr, "Test %u: Expect SetCursorProperties return %#x, got %#x.\n", test_idx, expected_hr, hr); IDirect3DSurface8_Release(cursor); diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 0b6668d12b9..efcd630e2df 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -1839,7 +1839,6 @@ static void test_cursor(void) expected_hr = D3D_OK; else expected_hr = D3DERR_INVALIDCALL; - todo_wine_if(expected_hr == D3DERR_INVALIDCALL) ok(hr == expected_hr, "Test %u: Expect SetCursorProperties return %#x, got %#x.\n", test_idx, expected_hr, hr); IDirect3DSurface9_Release(cursor); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index f8caa0c23c6..05087fee244 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4934,14 +4934,21 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device return WINED3DERR_INVALIDCALL; }
+ /* Cursor width and height must all be powers of two */ + cursor_width = wined3d_texture_get_level_width(texture, texture_level); + cursor_height = wined3d_texture_get_level_height(texture, texture_level); + if ((cursor_width & (cursor_width - 1)) || (cursor_height & (cursor_height - 1))) + { + WARN("Cursor size %ux%u are not all powers of two.\n", cursor_width, cursor_height); + return WINED3DERR_INVALIDCALL; + } + if (FAILED(hr = wined3d_output_get_display_mode(&device->adapter->outputs[0], &mode, NULL))) { ERR("Failed to get display mode, hr %#x.\n", hr); return WINED3DERR_INVALIDCALL; }
- cursor_width = wined3d_texture_get_level_width(texture, texture_level); - cursor_height = wined3d_texture_get_level_height(texture, texture_level); if (cursor_width > mode.width || cursor_height > mode.height) { WARN("Texture %p, sub-resource %u dimensions are %ux%u, but screen dimensions are %ux%u.\n", @@ -4949,8 +4956,6 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device return WINED3DERR_INVALIDCALL; }
- /* TODO: MSDN: Cursor sizes must be a power of 2 */ - /* Do not store the surface's pointer because the application may * release it after setting the cursor image. Windows doesn't * addref the set surface, so we can't do this either without