[PATCH 2/2] ddraw/tests: Use SetRect() instead of open coding it.
Michael Stefaniuc
mstefani at redhat.de
Tue Mar 22 04:36:46 CDT 2016
Signed-off-by: Michael Stefaniuc <mstefani at redhat.de>
---
dlls/ddraw/tests/d3d.c | 35 +++++++----------------------------
dlls/ddraw/tests/visual.c | 35 ++++++++++-------------------------
2 files changed, 17 insertions(+), 53 deletions(-)
diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c
index d877020..fa2a8e3 100644
--- a/dlls/ddraw/tests/d3d.c
+++ b/dlls/ddraw/tests/d3d.c
@@ -1837,19 +1837,13 @@ static void DeviceLoadTest(void)
ok(hr==DDERR_INVALIDPARAMS, "IDirect3DDevice7_Load returned: %x\n",hr);
loadpoint.x = loadpoint.y = 50;
- loadrect.left = 0;
- loadrect.top = 0;
- loadrect.right = 100;
- loadrect.bottom = 100;
+ SetRect(&loadrect, 0, 0, 100, 100);
hr = IDirect3DDevice7_Load(lpD3DDevice, texture_levels[1][0], &loadpoint, texture_levels[0][0], &loadrect, 0);
ok(hr==DDERR_INVALIDPARAMS, "IDirect3DDevice7_Load returned: %x\n",hr);
/* Test actual loading. */
loadpoint.x = loadpoint.y = 31;
- loadrect.left = 30;
- loadrect.top = 20;
- loadrect.right = 93;
- loadrect.bottom = 52;
+ SetRect(&loadrect, 30, 20, 93, 52);
hr = IDirect3DDevice7_Load(lpD3DDevice, texture_levels[1][0], &loadpoint, texture_levels[0][0], &loadrect, 0);
ok(hr==D3D_OK, "IDirect3DDevice7_Load returned: %x\n",hr);
@@ -2057,10 +2051,7 @@ static void DeviceLoadTest(void)
}
loadpoint.x = loadpoint.y = 10;
- loadrect.left = 30;
- loadrect.top = 20;
- loadrect.right = 93;
- loadrect.bottom = 52;
+ SetRect(&loadrect, 30, 20, 93, 52);
hr = IDirect3DDevice7_Load(lpD3DDevice, cube_face_levels[1][0][0], &loadpoint, cube_face_levels[0][0][0], &loadrect,
DDSCAPS2_CUBEMAP_ALLFACES);
@@ -2069,10 +2060,7 @@ static void DeviceLoadTest(void)
for (i = 0; i < 6; i++)
{
loadpoint.x = loadpoint.y = 10;
- loadrect.left = 30;
- loadrect.top = 20;
- loadrect.right = 93;
- loadrect.bottom = 52;
+ SetRect(&loadrect, 30, 20, 93, 52);
for (i1 = 0; i1 < 8; i1++)
{
@@ -2258,10 +2246,7 @@ static void DeviceLoadTest(void)
}
loadpoint.x = loadpoint.y = 31;
- loadrect.left = 30;
- loadrect.top = 20;
- loadrect.right = 93;
- loadrect.bottom = 52;
+ SetRect(&loadrect, 30, 20, 93, 52);
/* Destination mip levels are a subset of source mip levels. */
hr = IDirect3DDevice7_Load(lpD3DDevice, texture_levels[1][0], &loadpoint, texture_levels[0][0], &loadrect, 0);
@@ -2418,10 +2403,7 @@ static void DeviceLoadTest(void)
ok(hr == DD_OK, "IDirectDrawSurface7_Blt failed with %08x\n", hr);
loadpoint.x = loadpoint.y = 32;
- loadrect.left = 32;
- loadrect.top = 32;
- loadrect.right = 96;
- loadrect.bottom = 96;
+ SetRect(&loadrect, 32, 32, 96, 96);
hr = IDirect3DDevice7_Load(lpD3DDevice, texture_levels[1][0], &loadpoint, texture_levels[0][0], &loadrect, 0);
ok(hr==D3D_OK, "IDirect3DDevice7_Load returned: %x\n",hr);
@@ -2593,10 +2575,7 @@ static void DeviceLoadTest(void)
}
loadpoint.x = loadpoint.y = 0;
- loadrect.left = 0;
- loadrect.top = 0;
- loadrect.right = 64;
- loadrect.bottom = 64;
+ SetRect(&loadrect, 0, 0, 64, 64);
hr = IDirect3DDevice7_Load(lpD3DDevice, texture_levels[1][0], &loadpoint, texture_levels[0][0], &loadrect, 0);
ok(hr==D3D_OK, "IDirect3DDevice7_Load returned: %x\n",hr);
diff --git a/dlls/ddraw/tests/visual.c b/dlls/ddraw/tests/visual.c
index 7332bae..fbdbee3 100644
--- a/dlls/ddraw/tests/visual.c
+++ b/dlls/ddraw/tests/visual.c
@@ -608,26 +608,20 @@ static void blt_test(IDirect3DDevice7 *device)
ok(hr == DD_OK, "IDirectDrawSurface7_Blt returned %08x\n", hr);
/* Overlapped blit */
- dst_rect.left = 0; dst_rect.right = 480;
- dst_rect.top = 0; dst_rect.bottom = 480;
- src_rect.left = 160; src_rect.right = 640;
- src_rect.top = 0; src_rect.bottom = 480;
+ SetRect(&dst_rect, 0, 0, 480, 480);
+ SetRect(&src_rect, 160, 0, 640, 480);
hr = IDirectDrawSurface_Blt(offscreen, &dst_rect, offscreen, &src_rect, 0, NULL);
ok(hr == DD_OK, "IDirectDrawSurface7_Blt returned %08x\n", hr);
/* Overlapped blit, flip-y through source rectangle (not allowed) */
- dst_rect.left = 0; dst_rect.right = 480;
- dst_rect.top = 0; dst_rect.bottom = 480;
- src_rect.left = 160; src_rect.right = 640;
- src_rect.top = 480; src_rect.bottom = 0;
+ SetRect(&dst_rect, 0, 0, 480, 480);
+ SetRect(&src_rect, 160, 480, 640, 0);
hr = IDirectDrawSurface_Blt(offscreen, &dst_rect, offscreen, &src_rect, 0, NULL);
ok(hr == DDERR_INVALIDRECT, "IDirectDrawSurface7_Blt returned %08x\n", hr);
/* Overlapped blit, with shrinking in x */
- dst_rect.left = 0; dst_rect.right = 480;
- dst_rect.top = 0; dst_rect.bottom = 480;
- src_rect.left = 160; src_rect.right = 480;
- src_rect.top = 0; src_rect.bottom = 480;
+ SetRect(&dst_rect, 0, 0, 480, 480);
+ SetRect(&src_rect, 160, 0, 480, 480);
hr = IDirectDrawSurface_Blt(offscreen, &dst_rect, offscreen, &src_rect, 0, NULL);
ok(hr == DD_OK, "IDirectDrawSurface7_Blt returned %08x\n", hr);
}
@@ -645,10 +639,8 @@ static void blt_test(IDirect3DDevice7 *device)
ok(hr == DD_OK, "fullscreen Blt from backbuffer => texture failed with hr = %08x\n", hr);
/* backbuffer ==> texture, full surface blits, no scaling */
- dst_rect.left = 0; dst_rect.right = 640;
- dst_rect.top = 0; dst_rect.bottom = 480;
- src_rect.left = 0; src_rect.right = 640;
- src_rect.top = 0; src_rect.bottom = 480;
+ SetRect(&dst_rect, 0, 0, 640, 480);
+ SetRect(&src_rect, 0, 0, 640, 480);
hr = IDirectDrawSurface_Blt(offscreen, &dst_rect, backbuffer, &src_rect, 0, NULL);
ok(hr == DD_OK, "fullscreen Blt from backbuffer => texture failed with hr = %08x\n", hr);
@@ -1523,11 +1515,7 @@ static void p8_primary_test(void)
"got R %02X G %02X B %02X, expected R 00 G 00 B FF\n",
GetRValue(color), GetGValue(color), GetBValue(color));
- rect.left = 100;
- rect.top = 200;
- rect.right = 116;
- rect.bottom = 216;
-
+ SetRect(&rect, 100, 200, 116, 216);
memset(&ddbltfx, 0, sizeof(ddbltfx));
ddbltfx.dwSize = sizeof(ddbltfx);
ddbltfx.ddckSrcColorkey.dwColorSpaceLowValue = ddbltfx.ddckSrcColorkey.dwColorSpaceHighValue = 2;
@@ -1608,10 +1596,7 @@ static void p8_primary_test(void)
ok(hr==DD_OK, "IDirectDrawSurface_UnLock returned: %x\n", hr);
/* Offscreen surface data will have to be converted and uploaded to texture. */
- rect.left = 0;
- rect.top = 0;
- rect.right = 16;
- rect.bottom = 16;
+ SetRect(&rect, 0, 0, 16, 16);
hr = IDirectDrawSurface_BltFast(offscreen, 600, 400, Surface1, &rect, 0);
ok(hr==DD_OK, "IDirectDrawSurface_BltFast returned: %x\n", hr);
--
2.4.3
More information about the wine-patches
mailing list