Patch for or deficiency with getPixelColor in dlls/ddraw/tests/visual.c?
Gerald Pfeifer
gerald at pfeifer.com
Sun Jan 6 11:02:10 CST 2008
I noticed that getPixelColor in dlls/ddraw/tests/visual.c does not
use its first parameter (device) and the patch below simplifies that
file accordingly.
Stefan, as the main author of this file: is this patch correct or
does it actually point to a deficiency with these tests?
Gerald
ChangeLog:
Simplify based on us not using the first parameter to getPixelColor().
Index: dlls/ddraw/tests/visual.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/tests/visual.c,v
retrieving revision 1.13
diff -u -3 -p -r1.13 visual.c
--- dlls/ddraw/tests/visual.c 10 Dec 2007 14:55:49 -0000 1.13
+++ dlls/ddraw/tests/visual.c 6 Jan 2008 16:54:38 -0000
@@ -117,7 +117,7 @@ static void releaseObjects(void)
DestroyWindow(window);
}
-static DWORD getPixelColor(IDirect3DDevice7 *device, UINT x, UINT y)
+static DWORD getPixelColor(UINT x, UINT y)
{
DWORD ret;
HRESULT hr;
@@ -292,13 +292,13 @@ static void lighting_test(IDirect3DDevic
ok(hr == D3D_OK, "IDirect3DDevice7_EndScene failed with %08x\n", hr);
}
- color = getPixelColor(device, 160, 360); /* lower left quad - unlit without normals */
+ color = getPixelColor(160, 360); /* lower left quad - unlit without normals */
ok(color == 0x00ff0000, "Unlit quad without normals has color %08x\n", color);
- color = getPixelColor(device, 160, 120); /* upper left quad - lit without normals */
+ color = getPixelColor(160, 120); /* upper left quad - lit without normals */
ok(color == 0x00000000, "Lit quad without normals has color %08x\n", color);
- color = getPixelColor(device, 480, 360); /* lower left quad - unlit width normals */
+ color = getPixelColor(480, 360); /* lower left quad - unlit width normals */
ok(color == 0x000000ff, "Unlit quad width normals has color %08x\n", color);
- color = getPixelColor(device, 480, 120); /* upper left quad - lit width normals */
+ color = getPixelColor(480, 120); /* upper left quad - lit width normals */
ok(color == 0x00000000, "Lit quad width normals has color %08x\n", color);
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE);
@@ -341,13 +341,13 @@ static void clear_test(IDirect3DDevice7
hr = IDirect3DDevice7_Clear(device, 1, &rect_negneg, D3DCLEAR_TARGET, 0xff00ff00, 0.0, 0);
ok(hr == D3D_OK, "IDirect3DDevice7_Clear failed with %08x\n", hr);
- color = getPixelColor(device, 160, 360); /* lower left quad */
+ color = getPixelColor(160, 360); /* lower left quad */
ok(color == 0x00ffffff, "Clear rectangle 3(pos, neg) has color %08x\n", color);
- color = getPixelColor(device, 160, 120); /* upper left quad */
+ color = getPixelColor(160, 120); /* upper left quad */
ok(color == 0x00ff0000, "Clear rectangle 1(pos, pos) has color %08x\n", color);
- color = getPixelColor(device, 480, 360); /* lower right quad */
+ color = getPixelColor(480, 360); /* lower right quad */
ok(color == 0x00ffffff, "Clear rectangle 4(NULL) has color %08x\n", color);
- color = getPixelColor(device, 480, 120); /* upper right quad */
+ color = getPixelColor(480, 120); /* upper right quad */
ok(color == 0x00ffffff, "Clear rectangle 4(neg, neg) has color %08x\n", color);
}
@@ -468,15 +468,15 @@ static void fog_test(IDirect3DDevice7 *d
ok(FALSE, "BeginScene failed\n");
}
- color = getPixelColor(device, 160, 360);
+ color = getPixelColor(160, 360);
ok(color == 0x00FF0000, "Untransformed vertex with no table or vertex fog has color %08x\n", color);
- color = getPixelColor(device, 160, 120);
+ color = getPixelColor(160, 120);
ok(color == 0x0000FF00, "Untransformed vertex with linear vertex fog has color %08x\n", color);
- color = getPixelColor(device, 480, 120);
+ color = getPixelColor(480, 120);
ok(color == 0x00FFFF00, "Transformed vertex with linear vertex fog has color %08x\n", color);
if(caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGTABLE)
{
- color = getPixelColor(device, 480, 360);
+ color = getPixelColor(480, 360);
ok(color == 0x0000FF00, "Transformed vertex with linear table fog has color %08x\n", color);
}
else
@@ -484,7 +484,7 @@ static void fog_test(IDirect3DDevice7 *d
/* Without fog table support the vertex fog is still applied, even though table fog is turned on.
* The settings above result in no fogging with vertex fog
*/
- color = getPixelColor(device, 480, 120);
+ color = getPixelColor(480, 120);
ok(color == 0x00FFFF00, "Transformed vertex with linear vertex fog has color %08x\n", color);
trace("Info: Table fog not supported by this device\n");
}
@@ -564,20 +564,20 @@ static void offscreen_test(IDirect3DDevi
}
/* Center quad - should be white */
- color = getPixelColor(device, 320, 240);
+ color = getPixelColor(320, 240);
ok(color == 0x00ffffff, "Offscreen failed: Got color 0x%08x, expected 0x00ffffff.\n", color);
/* Some quad in the cleared part of the texture */
- color = getPixelColor(device, 170, 240);
+ color = getPixelColor(170, 240);
ok(color == 0x00ff00ff, "Offscreen failed: Got color 0x%08x, expected 0x00ff00ff.\n", color);
/* Part of the originally cleared back buffer */
- color = getPixelColor(device, 10, 10);
+ color = getPixelColor(10, 10);
ok(color == 0x00ff0000, "Offscreen failed: Got color 0x%08x, expected 0x00ff0000.\n", color);
if(0) {
/* Lower left corner of the screen, where back buffer offscreen rendering draws the offscreen texture.
* It should be red, but the offscreen texture may leave some junk there. Not tested yet. Depending on
* the offscreen rendering mode this test would succeed or fail
*/
- color = getPixelColor(device, 10, 470);
+ color = getPixelColor(10, 470);
ok(color == 0x00ff0000, "Offscreen failed: Got color 0x%08x, expected 0x00ff0000.\n", color);
}
@@ -728,28 +728,28 @@ static void alpha_test(IDirect3DDevice7
ok(hr == D3D_OK, "IDirect3DDevice7_EndScene failed, hr = %08x\n", hr);
}
- color = getPixelColor(device, 160, 360);
+ color = getPixelColor(160, 360);
red = (color & 0x00ff0000) >> 16;
green = (color & 0x0000ff00) >> 8;
blue = (color & 0x000000ff);
ok(red >= 0xbe && red <= 0xc0 && green >= 0x39 && green <= 0x41 && blue == 0x00,
"SRCALPHA on frame buffer returned color %08x, expected 0x00bf4000\n", color);
- color = getPixelColor(device, 160, 120);
+ color = getPixelColor(160, 120);
red = (color & 0x00ff0000) >> 16;
green = (color & 0x0000ff00) >> 8;
blue = (color & 0x000000ff);
ok(red == 0x00 && green == 0x00 && blue >= 0xfe && blue <= 0xff ,
"DSTALPHA on frame buffer returned color %08x, expected 0x00ff0000\n", color);
- color = getPixelColor(device, 480, 360);
+ color = getPixelColor(480, 360);
red = (color & 0x00ff0000) >> 16;
green = (color & 0x0000ff00) >> 8;
blue = (color & 0x000000ff);
ok(red >= 0xbe && red <= 0xc0 && green >= 0x39 && green <= 0x41 && blue == 0x00,
"SRCALPHA on texture returned color %08x, expected bar\n", color);
- color = getPixelColor(device, 480, 120);
+ color = getPixelColor(480, 120);
red = (color & 0x00ff0000) >> 16;
green = (color & 0x0000ff00) >> 8;
blue = (color & 0x000000ff);
@@ -779,7 +779,7 @@ START_TEST(visual)
goto cleanup;
}
- color = getPixelColor(Direct3DDevice, 1, 1);
+ color = getPixelColor(1, 1);
if(color !=0x00ff0000)
{
trace("Sanity check returned an incorrect color(%08x), can't assure the correctness of the tests, skipping\n", color);
@@ -793,7 +793,7 @@ START_TEST(visual)
goto cleanup;
}
- color = getPixelColor(Direct3DDevice, 639, 479);
+ color = getPixelColor(639, 479);
if(color != 0x0000ddee)
{
trace("Sanity check returned an incorrect color(%08x), can't assure the correctness of the tests, skipping\n", color);
More information about the wine-patches
mailing list