[PATCH] Fix the condition in D3DXMatrixIsIdentity

Adam David (none) david at localhost.
Tue Oct 30 08:18:51 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 021dfe4..33a60dc 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -140,6 +140,10 @@ static void D3DXMatrixTest(void)
     expected =3D TRUE;
     got =3D D3DXMatrixIsIdentity(&mat);
     ok(expected =3D=3D got, "Expected : %d, Got : %d\n", expected, got);
+    U(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);
     /* Test the NULL case */
     expected =3D FALSE;
     got =3D D3DXMatrixIsIdentity(NULL);
diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl
index 22684a0..cdcea06 100644
--- a/include/d3dx8math.inl
+++ b/include/d3dx8math.inl
@@ -351,7 +351,6 @@ static inline BOOL D3DXMatrixIsIdentity(D3DXMATRIX *pm)
 {
     int i,j;
     D3DXMATRIX testmatrix;
-    BOOL equal=3DTRUE;
=20
     if ( !pm ) return FALSE;
     D3DXMatrixIdentity(&testmatrix);
@@ -359,10 +358,10 @@ static inline BOOL D3DXMatrixIsIdentity(D3DXMATRIX *pm=
)
     {
      for (j=3D0; j<4; j++)
      {
-      if ( fabs(D3DX_U(*pm).m[i][j] - D3DX_U(testmatrix).m[i][j]) > 0.0001 =
) equal =3D FALSE;
+      if ( D3DX_U(*pm).m[i][j] !=3D D3DX_U(testmatrix).m[i][j] ) return FAL=
SE;
      }
     }
-    return equal;
+    return TRUE;
 }
 #undef D3DX_U
=20
--=20
1.5.3.2


--=_4em32d4bbksg--



More information about the wine-patches mailing list