mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 20:23:38 +00:00
ddraw/tests: Use ARRAY_SIZE() in the ddraw4 tests.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
71443a5e12
commit
1677711d6e
|
@ -1833,7 +1833,7 @@ static void test_ck_rgba(void)
|
|||
hr = IDirect3DDevice3_GetRenderTarget(device, &rt);
|
||||
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(tests); ++i)
|
||||
{
|
||||
hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_COLORKEYENABLE, tests[i].color_key);
|
||||
ok(SUCCEEDED(hr), "Failed to enable color keying, hr %#x.\n", hr);
|
||||
|
@ -2271,7 +2271,7 @@ static void test_surface_qi(void)
|
|||
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
||||
|
||||
test_qi("surface_qi", (IUnknown *)surface, &IID_IDirectDrawSurface4, tests, sizeof(tests) / sizeof(*tests));
|
||||
test_qi("surface_qi", (IUnknown *)surface, &IID_IDirectDrawSurface4, tests, ARRAY_SIZE(tests));
|
||||
|
||||
IDirectDrawSurface4_Release(surface);
|
||||
IDirectDraw4_Release(ddraw);
|
||||
|
@ -2337,7 +2337,7 @@ static void test_device_qi(void)
|
|||
return;
|
||||
}
|
||||
|
||||
test_qi("device_qi", (IUnknown *)device, &IID_IDirect3DDevice3, tests, sizeof(tests) / sizeof(*tests));
|
||||
test_qi("device_qi", (IUnknown *)device, &IID_IDirect3DDevice3, tests, ARRAY_SIZE(tests));
|
||||
|
||||
IDirect3DDevice3_Release(device);
|
||||
DestroyWindow(window);
|
||||
|
@ -4060,7 +4060,7 @@ static void test_lighting(void)
|
|||
hr = IDirect3DLight_SetLight(light, (D3DLIGHT *)&light_desc);
|
||||
ok(SUCCEEDED(hr), "Failed to set light, hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(tests); ++i)
|
||||
{
|
||||
hr = IDirect3DDevice3_SetTransform(device, D3DTRANSFORMSTATE_WORLD, tests[i].world_matrix);
|
||||
ok(SUCCEEDED(hr), "Failed to set world transformation, hr %#x.\n", hr);
|
||||
|
@ -4257,20 +4257,13 @@ static void test_specular_lighting(void)
|
|||
{
|
||||
/* D3DRENDERSTATE_LOCALVIEWER does not exist in D3D < 7 (the behavior is
|
||||
* the one you get on newer D3D versions with it set as TRUE). */
|
||||
{&directional, FALSE, 30.0f, expected_directional,
|
||||
sizeof(expected_directional) / sizeof(expected_directional[0])},
|
||||
{&directional, TRUE, 30.0f, expected_directional,
|
||||
sizeof(expected_directional) / sizeof(expected_directional[0])},
|
||||
{&point, TRUE, 30.0f, expected_point,
|
||||
sizeof(expected_point) / sizeof(expected_point[0])},
|
||||
{&spot, TRUE, 30.0f, expected_spot,
|
||||
sizeof(expected_spot) / sizeof(expected_spot[0])},
|
||||
{¶llelpoint, TRUE, 30.0f, expected_parallelpoint,
|
||||
sizeof(expected_parallelpoint) / sizeof(expected_parallelpoint[0])},
|
||||
{&point_side, TRUE, 0.0f, expected_point_side,
|
||||
sizeof(expected_point_side) / sizeof(expected_point_side[0])},
|
||||
{&point_far, TRUE, 1.0f, expected_point_far,
|
||||
sizeof(expected_point_far) / sizeof(expected_point_far[0])},
|
||||
{&directional, FALSE, 30.0f, expected_directional, ARRAY_SIZE(expected_directional)},
|
||||
{&directional, TRUE, 30.0f, expected_directional, ARRAY_SIZE(expected_directional)},
|
||||
{&point, TRUE, 30.0f, expected_point, ARRAY_SIZE(expected_point)},
|
||||
{&spot, TRUE, 30.0f, expected_spot, ARRAY_SIZE(expected_spot)},
|
||||
{¶llelpoint, TRUE, 30.0f, expected_parallelpoint, ARRAY_SIZE(expected_parallelpoint)},
|
||||
{&point_side, TRUE, 0.0f, expected_point_side, ARRAY_SIZE(expected_point_side)},
|
||||
{&point_far, TRUE, 1.0f, expected_point_far, ARRAY_SIZE(expected_point_far)},
|
||||
};
|
||||
IDirect3D3 *d3d;
|
||||
IDirect3DDevice3 *device;
|
||||
|
@ -4357,7 +4350,7 @@ static void test_specular_lighting(void)
|
|||
hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_SPECULARENABLE, TRUE);
|
||||
ok(SUCCEEDED(hr), "Failed to enable specular lighting, hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(tests); ++i)
|
||||
{
|
||||
tests[i].light->dwFlags = D3DLIGHT_ACTIVE;
|
||||
hr = IDirect3DLight_SetLight(light, (D3DLIGHT *)tests[i].light);
|
||||
|
@ -4753,7 +4746,7 @@ static void test_lighting_interface_versions(void)
|
|||
ok(SUCCEEDED(hr), "Failed to get specularenable render state, hr %#x.\n", hr);
|
||||
ok(rs == FALSE, "Initial D3DRENDERSTATE_SPECULARENABLE is %#x, expected FALSE.\n", rs);
|
||||
|
||||
for (i = 0; i < sizeof(tests) / sizeof(*tests); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(tests); i++)
|
||||
{
|
||||
hr = IDirect3DViewport3_Clear2(viewport, 1, &clear_rect, D3DCLEAR_TARGET, 0xff202020, 0.0f, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
|
||||
|
@ -4985,7 +4978,7 @@ static void test_texturemanage(void)
|
|||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(tests) / sizeof(*tests); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(tests); i++)
|
||||
{
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
|
@ -5188,7 +5181,7 @@ static void test_block_formats_creation(void)
|
|||
ok(SUCCEEDED(hr), "Failed to get fourcc codes %#x.\n", hr);
|
||||
for (i = 0; i < num_fourcc_codes; i++)
|
||||
{
|
||||
for (j = 0; j < sizeof(formats) / sizeof(*formats); j++)
|
||||
for (j = 0; j < ARRAY_SIZE(formats); j++)
|
||||
{
|
||||
if (fourcc_codes[i] == formats[j].fourcc)
|
||||
supported_overlay_fmts |= formats[j].support_flag;
|
||||
|
@ -5203,9 +5196,9 @@ static void test_block_formats_creation(void)
|
|||
|
||||
mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 2 * 2 * 16 + 1);
|
||||
|
||||
for (i = 0; i < sizeof(formats) / sizeof(*formats); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(formats); i++)
|
||||
{
|
||||
for (j = 0; j < sizeof(types) / sizeof(*types); j++)
|
||||
for (j = 0; j < ARRAY_SIZE(types); j++)
|
||||
{
|
||||
BOOL support;
|
||||
|
||||
|
@ -5269,7 +5262,7 @@ static void test_block_formats_creation(void)
|
|||
if (formats[i].overlay)
|
||||
continue;
|
||||
|
||||
for (j = 0; j < sizeof(user_mem_tests) / sizeof(*user_mem_tests); ++j)
|
||||
for (j = 0; j < ARRAY_SIZE(user_mem_tests); ++j)
|
||||
{
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
|
@ -5398,13 +5391,13 @@ static void test_unsupported_formats(void)
|
|||
ok(SUCCEEDED(hr), "Failed to get ddraw interface, hr %#x.\n", hr);
|
||||
IDirect3D3_Release(d3d);
|
||||
|
||||
for (i = 0; i < sizeof(formats) / sizeof(*formats); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(formats); i++)
|
||||
{
|
||||
struct format_support_check check = {&formats[i].fmt, FALSE};
|
||||
hr = IDirect3DDevice3_EnumTextureFormats(device, test_unsupported_formats_cb, &check);
|
||||
ok(SUCCEEDED(hr), "Failed to enumerate texture formats %#x.\n", hr);
|
||||
|
||||
for (j = 0; j < sizeof(caps) / sizeof(*caps); j++)
|
||||
for (j = 0; j < ARRAY_SIZE(caps); j++)
|
||||
{
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
|
@ -5668,7 +5661,7 @@ static void test_rt_caps(void)
|
|||
hr = IDirectDraw4_CreatePalette(ddraw, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, palette_entries, &palette, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(test_data); ++i)
|
||||
{
|
||||
IDirectDrawSurface4 *surface, *rt, *expected_rt, *tmp;
|
||||
DDSURFACEDESC2 surface_desc;
|
||||
|
@ -5890,7 +5883,7 @@ static void test_primary_caps(void)
|
|||
ddraw = create_ddraw();
|
||||
ok(!!ddraw, "Failed to create a ddraw object.\n");
|
||||
|
||||
for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(test_data); ++i)
|
||||
{
|
||||
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, test_data[i].coop_level);
|
||||
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
|
||||
|
@ -6024,7 +6017,7 @@ static void test_surface_lock(void)
|
|||
goto done;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(tests) / sizeof(*tests); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(tests); i++)
|
||||
{
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
|
@ -6113,7 +6106,7 @@ static void test_surface_discard(void)
|
|||
hr = IDirect3DDevice3_GetRenderTarget(device, &target);
|
||||
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < sizeof(tests) / sizeof(*tests); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(tests); i++)
|
||||
{
|
||||
BOOL discarded;
|
||||
|
||||
|
@ -6225,7 +6218,7 @@ static void test_flip(void)
|
|||
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
||||
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(test_data); ++i)
|
||||
{
|
||||
/* Creating a flippable texture induces a BSoD on some versions of the
|
||||
* Intel graphics driver. At least Intel GMA 950 with driver version
|
||||
|
@ -6679,7 +6672,7 @@ static void test_set_surface_desc(void)
|
|||
/* SetSurfaceDesc needs systemmemory surfaces.
|
||||
*
|
||||
* As a sidenote, fourcc surfaces aren't allowed in sysmem, thus testing DDSD_LINEARSIZE is moot. */
|
||||
for (i = 0; i < sizeof(invalid_caps_tests) / sizeof(*invalid_caps_tests); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(invalid_caps_tests); i++)
|
||||
{
|
||||
reset_ddsd(&ddsd);
|
||||
ddsd.dwFlags = DDSD_CAPS;
|
||||
|
@ -7731,7 +7724,7 @@ static void test_create_surface_pitch(void)
|
|||
|
||||
mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ((63 * 4) + 8) * 63);
|
||||
|
||||
for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(test_data); ++i)
|
||||
{
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
|
@ -7840,7 +7833,7 @@ static void test_mipmap(void)
|
|||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(tests); ++i)
|
||||
{
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
|
@ -8111,7 +8104,7 @@ static void test_p8_blit(void)
|
|||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
for (x = 0; x < sizeof(expected) / sizeof(*expected); x++)
|
||||
for (x = 0; x < ARRAY_SIZE(expected); x++)
|
||||
{
|
||||
color = get_surface_color(dst, x, 0);
|
||||
todo_wine ok(compare_color(color, expected[x], 0),
|
||||
|
@ -8234,7 +8227,7 @@ static void test_material(void)
|
|||
ok(SUCCEEDED(hr), "Failed to get light state, hr %#x.\n", hr);
|
||||
ok(!tmp, "Got unexpected material handle %#x.\n", tmp);
|
||||
|
||||
for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(test_data); ++i)
|
||||
{
|
||||
hr = IDirect3DViewport3_Clear2(viewport, 1, &clear_rect,
|
||||
D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff0000ff, 1.0f, 0);
|
||||
|
@ -8389,16 +8382,16 @@ static void test_palette_gdi(void)
|
|||
"Got unexpected palette %p, expected %p.\n",
|
||||
ddraw_palette_handle, GetStockObject(DEFAULT_PALETTE));
|
||||
|
||||
i = GetDIBColorTable(dc, 0, sizeof(rgbquad) / sizeof(*rgbquad), rgbquad);
|
||||
ok(i == sizeof(rgbquad) / sizeof(*rgbquad), "Expected count 255, got %u.\n", i);
|
||||
for (i = 0; i < sizeof(expected1) / sizeof(*expected1); i++)
|
||||
i = GetDIBColorTable(dc, 0, ARRAY_SIZE(rgbquad), rgbquad);
|
||||
ok(i == ARRAY_SIZE(rgbquad), "Expected count 255, got %u.\n", i);
|
||||
for (i = 0; i < ARRAY_SIZE(expected1); i++)
|
||||
{
|
||||
ok(!memcmp(&rgbquad[i], &expected1[i], sizeof(rgbquad[i])),
|
||||
"Got color table entry %u r=%#x g=%#x b=%#x, expected r=%#x g=%#x b=%#x.\n",
|
||||
i, rgbquad[i].rgbRed, rgbquad[i].rgbGreen, rgbquad[i].rgbBlue,
|
||||
expected1[i].rgbRed, expected1[i].rgbGreen, expected1[i].rgbBlue);
|
||||
}
|
||||
for (; i < sizeof(rgbquad) / sizeof(*rgbquad); i++)
|
||||
for (; i < ARRAY_SIZE(rgbquad); i++)
|
||||
{
|
||||
ok(!memcmp(&rgbquad[i], &rgb_zero, sizeof(rgbquad[i])),
|
||||
"Got color table entry %u r=%#x g=%#x b=%#x, expected r=0 g=0 b=0.\n",
|
||||
|
@ -8438,16 +8431,16 @@ static void test_palette_gdi(void)
|
|||
/* Refresh the DC. This updates the palette. */
|
||||
hr = IDirectDrawSurface4_GetDC(surface, &dc);
|
||||
ok(SUCCEEDED(hr), "Failed to get DC, hr %#x.\n", hr);
|
||||
i = GetDIBColorTable(dc, 0, sizeof(rgbquad) / sizeof(*rgbquad), rgbquad);
|
||||
ok(i == sizeof(rgbquad) / sizeof(*rgbquad), "Expected count 255, got %u.\n", i);
|
||||
for (i = 0; i < sizeof(expected2) / sizeof(*expected2); i++)
|
||||
i = GetDIBColorTable(dc, 0, ARRAY_SIZE(rgbquad), rgbquad);
|
||||
ok(i == ARRAY_SIZE(rgbquad), "Expected count 255, got %u.\n", i);
|
||||
for (i = 0; i < ARRAY_SIZE(expected2); i++)
|
||||
{
|
||||
ok(!memcmp(&rgbquad[i], &expected2[i], sizeof(rgbquad[i])),
|
||||
"Got color table entry %u r=%#x g=%#x b=%#x, expected r=%#x g=%#x b=%#x.\n",
|
||||
i, rgbquad[i].rgbRed, rgbquad[i].rgbGreen, rgbquad[i].rgbBlue,
|
||||
expected2[i].rgbRed, expected2[i].rgbGreen, expected2[i].rgbBlue);
|
||||
}
|
||||
for (; i < sizeof(rgbquad) / sizeof(*rgbquad); i++)
|
||||
for (; i < ARRAY_SIZE(rgbquad); i++)
|
||||
{
|
||||
ok(!memcmp(&rgbquad[i], &rgb_zero, sizeof(rgbquad[i])),
|
||||
"Got color table entry %u r=%#x g=%#x b=%#x, expected r=0 g=0 b=0.\n",
|
||||
|
@ -8511,16 +8504,16 @@ static void test_palette_gdi(void)
|
|||
* the system palette are not included pending an application that depends on this.
|
||||
* The relation between those causes problems on Windows Vista and newer for games
|
||||
* like Age of Empires or StarCraft. Don't emulate it without a real need. */
|
||||
i = GetDIBColorTable(dc, 0, sizeof(rgbquad) / sizeof(*rgbquad), rgbquad);
|
||||
ok(i == sizeof(rgbquad) / sizeof(*rgbquad), "Expected count 255, got %u.\n", i);
|
||||
for (i = 0; i < sizeof(expected2) / sizeof(*expected2); i++)
|
||||
i = GetDIBColorTable(dc, 0, ARRAY_SIZE(rgbquad), rgbquad);
|
||||
ok(i == ARRAY_SIZE(rgbquad), "Expected count 255, got %u.\n", i);
|
||||
for (i = 0; i < ARRAY_SIZE(expected2); i++)
|
||||
{
|
||||
ok(!memcmp(&rgbquad[i], &expected2[i], sizeof(rgbquad[i])),
|
||||
"Got color table entry %u r=%#x g=%#x b=%#x, expected r=%#x g=%#x b=%#x.\n",
|
||||
i, rgbquad[i].rgbRed, rgbquad[i].rgbGreen, rgbquad[i].rgbBlue,
|
||||
expected2[i].rgbRed, expected2[i].rgbGreen, expected2[i].rgbBlue);
|
||||
}
|
||||
for (; i < sizeof(rgbquad) / sizeof(*rgbquad); i++)
|
||||
for (; i < ARRAY_SIZE(rgbquad); i++)
|
||||
{
|
||||
ok(!memcmp(&rgbquad[i], &rgb_zero, sizeof(rgbquad[i])),
|
||||
"Got color table entry %u r=%#x g=%#x b=%#x, expected r=0 g=0 b=0.\n",
|
||||
|
@ -8542,16 +8535,16 @@ static void test_palette_gdi(void)
|
|||
* but in all likelihood it is actually the system palette. */
|
||||
hr = IDirectDrawSurface4_GetDC(surface, &dc);
|
||||
ok(SUCCEEDED(hr), "Failed to get DC, hr %#x.\n", hr);
|
||||
i = GetDIBColorTable(dc, 0, sizeof(rgbquad) / sizeof(*rgbquad), rgbquad);
|
||||
ok(i == sizeof(rgbquad) / sizeof(*rgbquad), "Expected count 255, got %u.\n", i);
|
||||
for (i = 0; i < sizeof(expected2) / sizeof(*expected2); i++)
|
||||
i = GetDIBColorTable(dc, 0, ARRAY_SIZE(rgbquad), rgbquad);
|
||||
ok(i == ARRAY_SIZE(rgbquad), "Expected count 255, got %u.\n", i);
|
||||
for (i = 0; i < ARRAY_SIZE(expected2); i++)
|
||||
{
|
||||
ok(!memcmp(&rgbquad[i], &expected2[i], sizeof(rgbquad[i])),
|
||||
"Got color table entry %u r=%#x g=%#x b=%#x, expected r=%#x g=%#x b=%#x.\n",
|
||||
i, rgbquad[i].rgbRed, rgbquad[i].rgbGreen, rgbquad[i].rgbBlue,
|
||||
expected2[i].rgbRed, expected2[i].rgbGreen, expected2[i].rgbBlue);
|
||||
}
|
||||
for (; i < sizeof(rgbquad) / sizeof(*rgbquad); i++)
|
||||
for (; i < ARRAY_SIZE(rgbquad); i++)
|
||||
{
|
||||
ok(!memcmp(&rgbquad[i], &rgb_zero, sizeof(rgbquad[i])),
|
||||
"Got color table entry %u r=%#x g=%#x b=%#x, expected r=0 g=0 b=0.\n",
|
||||
|
@ -8582,16 +8575,16 @@ static void test_palette_gdi(void)
|
|||
* palette. */
|
||||
hr = IDirectDrawSurface4_GetDC(surface, &dc);
|
||||
ok(SUCCEEDED(hr), "Failed to get DC, hr %#x.\n", hr);
|
||||
i = GetDIBColorTable(dc, 0, sizeof(rgbquad) / sizeof(*rgbquad), rgbquad);
|
||||
ok(i == sizeof(rgbquad) / sizeof(*rgbquad), "Expected count 255, got %u.\n", i);
|
||||
for (i = 0; i < sizeof(expected3) / sizeof(*expected3); i++)
|
||||
i = GetDIBColorTable(dc, 0, ARRAY_SIZE(rgbquad), rgbquad);
|
||||
ok(i == ARRAY_SIZE(rgbquad), "Expected count 255, got %u.\n", i);
|
||||
for (i = 0; i < ARRAY_SIZE(expected3); i++)
|
||||
{
|
||||
ok(!memcmp(&rgbquad[i], &expected3[i], sizeof(rgbquad[i])),
|
||||
"Got color table entry %u r=%#x g=%#x b=%#x, expected r=%#x g=%#x b=%#x.\n",
|
||||
i, rgbquad[i].rgbRed, rgbquad[i].rgbGreen, rgbquad[i].rgbBlue,
|
||||
expected3[i].rgbRed, expected3[i].rgbGreen, expected3[i].rgbBlue);
|
||||
}
|
||||
for (; i < sizeof(rgbquad) / sizeof(*rgbquad); i++)
|
||||
for (; i < ARRAY_SIZE(rgbquad); i++)
|
||||
{
|
||||
ok(!memcmp(&rgbquad[i], &rgb_zero, sizeof(rgbquad[i])),
|
||||
"Got color table entry %u r=%#x g=%#x b=%#x, expected r=0 g=0 b=0.\n",
|
||||
|
@ -8698,7 +8691,7 @@ static void test_palette_alpha(void)
|
|||
ok(palette_entries[3].peFlags == 0x00, "Got unexpected peFlags 0x%02x, expected 0x00.\n",
|
||||
palette_entries[3].peFlags);
|
||||
|
||||
for (i = 0; i < sizeof(test_data) / sizeof(*test_data); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(test_data); i++)
|
||||
{
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
|
@ -8802,7 +8795,7 @@ static void test_vb_writeonly(void)
|
|||
desc.dwSize = sizeof(desc);
|
||||
desc.dwCaps = D3DVBCAPS_WRITEONLY;
|
||||
desc.dwFVF = D3DFVF_XYZRHW;
|
||||
desc.dwNumVertices = sizeof(quad) / sizeof(*quad);
|
||||
desc.dwNumVertices = ARRAY_SIZE(quad);
|
||||
hr = IDirect3D3_CreateVertexBuffer(d3d, &desc, &buffer, 0, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create vertex buffer, hr %#x.\n", hr);
|
||||
|
||||
|
@ -9568,7 +9561,7 @@ static void test_signed_formats(void)
|
|||
hr = IDirect3DDevice3_SetTextureStageState(device, 0, D3DTSS_COLORARG2, D3DTA_TFACTOR);
|
||||
ok(SUCCEEDED(hr), "Failed to set texture stage state, hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < sizeof(formats) / sizeof(*formats); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(formats); i++)
|
||||
{
|
||||
for (width = 1; width < 5; width += 3)
|
||||
{
|
||||
|
@ -9876,7 +9869,7 @@ static void test_color_fill(void)
|
|||
if (!(supported_fmts & (SUPPORT_YUY2 | SUPPORT_UYVY)) || !(hal_caps.dwCaps & DDCAPS_OVERLAY))
|
||||
skip("Overlays or some YUV formats not supported, skipping YUV colorfill tests.\n");
|
||||
|
||||
for (i = 0; i < sizeof(tests) / sizeof(*tests); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(tests); i++)
|
||||
{
|
||||
DWORD expected_broken = tests[i].result;
|
||||
|
||||
|
@ -10104,7 +10097,7 @@ static void test_color_fill(void)
|
|||
hr = IDirectDrawSurface4_Blt(surface, &rect, NULL, NULL, DDBLT_COLORFILL | DDBLT_ROP | DDBLT_WAIT, &fx);
|
||||
ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < sizeof(rops) / sizeof(*rops); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(rops); i++)
|
||||
{
|
||||
fx.dwROP = rops[i].rop;
|
||||
hr = IDirectDrawSurface4_Blt(surface, NULL, surface2, NULL, DDBLT_ROP | DDBLT_WAIT, &fx);
|
||||
|
@ -10496,7 +10489,7 @@ static void test_colorkey_precision(void)
|
|||
memset(&lock_desc, 0, sizeof(lock_desc));
|
||||
lock_desc.dwSize = sizeof(lock_desc);
|
||||
|
||||
for (t = 0; t < sizeof(tests) / sizeof(*tests); ++t)
|
||||
for (t = 0; t < ARRAY_SIZE(tests); ++t)
|
||||
{
|
||||
if (is_nvidia && tests[t].skip_nv)
|
||||
{
|
||||
|
@ -10879,7 +10872,7 @@ static void test_shademode(void)
|
|||
desc.dwSize = sizeof(desc);
|
||||
desc.dwCaps = D3DVBCAPS_WRITEONLY;
|
||||
desc.dwFVF = D3DFVF_XYZ | D3DFVF_DIFFUSE;
|
||||
desc.dwNumVertices = sizeof(quad_strip) / sizeof(*quad_strip);
|
||||
desc.dwNumVertices = ARRAY_SIZE(quad_strip);
|
||||
hr = IDirect3D3_CreateVertexBuffer(d3d, &desc, &vb_strip, 0, NULL);
|
||||
ok(hr == D3D_OK, "Failed to create vertex buffer, hr %#x.\n", hr);
|
||||
hr = IDirect3DVertexBuffer_Lock(vb_strip, 0, &data, NULL);
|
||||
|
@ -10888,7 +10881,7 @@ static void test_shademode(void)
|
|||
hr = IDirect3DVertexBuffer_Unlock(vb_strip);
|
||||
ok(hr == D3D_OK, "Failed to unlock vertex buffer, hr %#x.\n", hr);
|
||||
|
||||
desc.dwNumVertices = sizeof(quad_list) / sizeof(*quad_list);
|
||||
desc.dwNumVertices = ARRAY_SIZE(quad_list);
|
||||
hr = IDirect3D3_CreateVertexBuffer(d3d, &desc, &vb_list, 0, NULL);
|
||||
ok(hr == D3D_OK, "Failed to create vertex buffer, hr %#x.\n", hr);
|
||||
hr = IDirect3DVertexBuffer_Lock(vb_list, 0, &data, NULL);
|
||||
|
@ -10900,7 +10893,7 @@ static void test_shademode(void)
|
|||
/* Try it first with a TRIANGLESTRIP. Do it with different geometry because
|
||||
* the color fixups we have to do for FLAT shading will be dependent on that. */
|
||||
|
||||
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(tests); ++i)
|
||||
{
|
||||
hr = IDirect3DViewport3_Clear2(viewport, 1, &clear_rect, D3DCLEAR_TARGET, 0xffffffff, 0.0f, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
|
||||
|
@ -11004,7 +10997,7 @@ static void test_lockrect_invalid(void)
|
|||
goto done;
|
||||
}
|
||||
|
||||
for (r = 0; r < sizeof(resources) / sizeof(*resources); ++r)
|
||||
for (r = 0; r < ARRAY_SIZE(resources); ++r)
|
||||
{
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
|
@ -11026,7 +11019,7 @@ static void test_lockrect_invalid(void)
|
|||
hr = IDirectDrawSurface4_Lock(surface, NULL, NULL, DDLOCK_WAIT, NULL);
|
||||
ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x, type %s.\n", hr, resources[r].name);
|
||||
|
||||
for (i = 0; i < sizeof(valid) / sizeof(*valid); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(valid); ++i)
|
||||
{
|
||||
RECT *rect = &valid[i];
|
||||
|
||||
|
@ -11041,7 +11034,7 @@ static void test_lockrect_invalid(void)
|
|||
ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x, type %s.\n", hr, resources[r].name);
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(invalid) / sizeof(*invalid); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(invalid); ++i)
|
||||
{
|
||||
RECT *rect = &invalid[i];
|
||||
|
||||
|
@ -11453,7 +11446,7 @@ static void test_blt(void)
|
|||
hr = IDirectDrawSurface4_Blt(surface, NULL, rt, NULL, 0, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(test_data); ++i)
|
||||
{
|
||||
hr = IDirectDrawSurface4_Blt(surface, &test_data[i].dst_rect,
|
||||
surface, &test_data[i].src_rect, DDBLT_WAIT, NULL);
|
||||
|
@ -11554,7 +11547,7 @@ static void test_blt_z_alpha(void)
|
|||
fx.dwAlphaSrcConstBitDepth = 8;
|
||||
U4(fx).dwAlphaSrcConst = 0x22;
|
||||
|
||||
for (i = 0; i < sizeof(blt_flags) / sizeof(*blt_flags); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(blt_flags); ++i)
|
||||
{
|
||||
fx.dwFillColor = 0x3300ff00;
|
||||
hr = IDirectDrawSurface4_Blt(src_surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
|
||||
|
@ -11744,7 +11737,7 @@ static void test_getdc(void)
|
|||
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
|
||||
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < (sizeof(test_data) / sizeof(*test_data)); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(test_data); ++i)
|
||||
{
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
|
@ -13119,7 +13112,7 @@ static void test_surface_desc_size(void)
|
|||
hr = IDirectDraw4_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL);
|
||||
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < sizeof(surface_caps) / sizeof(*surface_caps); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(surface_caps); ++i)
|
||||
{
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
|
@ -13138,7 +13131,7 @@ static void test_surface_desc_size(void)
|
|||
ok(hr == DD_OK, "Failed to query IDirectDrawSurface3, hr %#x, type %s.\n", hr, surface_caps[i].name);
|
||||
|
||||
/* GetSurfaceDesc() */
|
||||
for (j = 0; j < sizeof(desc_sizes) / sizeof(*desc_sizes); ++j)
|
||||
for (j = 0; j < ARRAY_SIZE(desc_sizes); ++j)
|
||||
{
|
||||
memset(&desc, 0, sizeof(desc));
|
||||
desc.dwSize = desc_sizes[j];
|
||||
|
@ -13163,7 +13156,7 @@ static void test_surface_desc_size(void)
|
|||
}
|
||||
|
||||
/* Lock() */
|
||||
for (j = 0; j < sizeof(desc_sizes) / sizeof(*desc_sizes); ++j)
|
||||
for (j = 0; j < ARRAY_SIZE(desc_sizes); ++j)
|
||||
{
|
||||
const BOOL valid_size = desc_sizes[j] == sizeof(DDSURFACEDESC)
|
||||
|| desc_sizes[j] == sizeof(DDSURFACEDESC2);
|
||||
|
@ -13974,7 +13967,7 @@ static void test_compute_sphere_visibility(void)
|
|||
|
||||
IDirect3DDevice3_SetTransform(device, D3DTRANSFORMSTATE_WORLD, &identity);
|
||||
|
||||
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(tests); ++i)
|
||||
{
|
||||
IDirect3DDevice3_SetTransform(device, D3DTRANSFORMSTATE_VIEW, tests[i].view);
|
||||
IDirect3DDevice3_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, tests[i].proj);
|
||||
|
|
Loading…
Reference in a new issue