wined3d: Check cursor sizes are powers of two.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
73d0f23638
commit
47f3afb971
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue