[PATCH] Fix the condition in D3DX8MatrixIsIdentity with a test
David Adam
David.Adam at math.cnrs.fr
Fri Oct 26 09:15:19 CDT 2007
---
dlls/d3dx8/tests/math.c | 4 ++++
include/d3dx8math.inl | 5 ++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index 0e70183..4fd1960 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -141,6 +141,10 @@ static void D3DXMatrixTest(void)
expected =3D TRUE;
got =3D D3DXMatrixIsIdentity(&mat);
ok(expected =3D=3D got, "Expected : %d, Got : %d\n", expected, got);
+ mat.m[1][1] =3D 0.000009f;
+ expected =3D FALSE;
+ got =3D D3DXMatrixIsIdentity(&mat);
+ ok(expected =3D=3D got, "Expected : %d, Got : %d\n", expected, got);
/* Test the NULL case */
expected =3D FALSE;
got =3D D3DXMatrixIsIdentity(NULL);
diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl
index 4df1f9e..26d409a 100644
--- a/include/d3dx8math.inl
+++ b/include/d3dx8math.inl
@@ -346,7 +346,6 @@ static inline BOOL D3DXMatrixIsIdentity(D3DXMATRIX *pm)
{
int i,j;
D3DXMATRIX testmatrix;
- BOOL equal=3DTRUE;
=20
if ( !pm ) return FALSE;
D3DXMatrixIdentity(&testmatrix);
@@ -354,10 +353,10 @@ static inline BOOL D3DXMatrixIsIdentity(D3DXMATRIX *pm=
)
{
for (j=3D0; j<4; j++)
{
- if ( fabs(pm->m[i][j] - testmatrix.m[i][j]) > 0.0001 ) equal =3D FALS=
E;
+ if ( pm->m[i][j] !=3D testmatrix.m[i][j] ) return FALSE;
}
}
- return equal;
+ return TRUE;
}
=20
/*__________________D3DXPLANE____________________*/
--=20
1.5.3.2
--=_4rieh0gf9wcg--
More information about the wine-patches
mailing list