=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: d3d9/tests: Do not assume surface size and format in get_pixel_color().
Alexandre Julliard
julliard at winehq.org
Thu Jan 5 14:09:05 CST 2017
Module: wine
Branch: master
Commit: 0cf81686b6c66b2ba5d874cba7399fff1fe86a8d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0cf81686b6c66b2ba5d874cba7399fff1fe86a8d
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Thu Jan 5 11:50:54 2017 +0100
d3d9/tests: Do not assume surface size and format in get_pixel_color().
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3d9/tests/d3d9ex.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c
index 54699ca..b40a979 100644
--- a/dlls/d3d9/tests/d3d9ex.c
+++ b/dlls/d3d9/tests/d3d9ex.c
@@ -63,25 +63,28 @@ static BOOL color_match(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff)
static DWORD get_pixel_color(IDirect3DDevice9Ex *device, unsigned int x, unsigned int y)
{
- DWORD ret;
IDirect3DSurface9 *surf = NULL, *target = NULL;
- HRESULT hr;
- D3DLOCKED_RECT locked_rect;
RECT rect = {x, y, x + 1, y + 1};
-
- hr = IDirect3DDevice9Ex_CreateOffscreenPlainSurface(device, 640, 480,
- D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &surf, NULL);
- if (FAILED(hr) || !surf)
- {
- trace("Can't create an offscreen plain surface to read the render target data, hr %#x.\n", hr);
- return 0xdeadbeef;
- }
+ D3DLOCKED_RECT locked_rect;
+ D3DSURFACE_DESC desc;
+ HRESULT hr;
+ DWORD ret;
hr = IDirect3DDevice9Ex_GetRenderTarget(device, 0, &target);
if (FAILED(hr))
{
trace("Can't get the render target, hr %#x.\n", hr);
- ret = 0xdeadbeed;
+ return 0xdeadbeed;
+ }
+
+ hr = IDirect3DSurface9_GetDesc(target, &desc);
+ ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr);
+ hr = IDirect3DDevice9Ex_CreateOffscreenPlainSurface(device, desc.Width, desc.Height,
+ desc.Format, D3DPOOL_SYSTEMMEM, &surf, NULL);
+ if (FAILED(hr) || !surf)
+ {
+ trace("Can't create an offscreen plain surface to read the render target data, hr %#x.\n", hr);
+ ret = 0xdeadbeef;
goto out;
}
More information about the wine-cvs
mailing list