[PATCH] Make the condition in D3DXMatrixIsIdentity less with a tesT

David Adam David.Adam at math.cnrs.fr
Thu Oct 25 04:17:02 CDT 2007


---
 dlls/d3dx8/tests/math.c |    5 +++++
 include/d3dx8math.inl   |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index db87078..99aa94e 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -140,6 +140,11 @@ 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[0][0] =3D 0.000009f;
+    expected =3D FALSE;
+    got =3D D3DXMatrixIsIdentity(&mat);
+    ok(expected =3D=3D got, "Expected : %d, Got : %d\n", expected, got);
+    D3DXMatrixIdentity(&mat);
     /* Test the NULL case */
     expected =3D FALSE;
     got =3D D3DXMatrixIsIdentity(NULL);
diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl
index 4df1f9e..51d4434 100644
--- a/include/d3dx8math.inl
+++ b/include/d3dx8math.inl
@@ -354,7 +354,7 @@ 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])) equal =3D FALSE;
      }
     }
     return equal;
--=20
1.5.3.2


--=_42eotn4qglk4--



More information about the wine-patches mailing list