David Adam : d3dx8: Fix the condition in D3DXMatrixIsIdentity.

Alexandre Julliard julliard at winehq.org
Wed Oct 31 08:35:23 CDT 2007


Module: wine
Branch: master
Commit: 08d17fd27f63ca42a1f6ff362600b876be3a376d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=08d17fd27f63ca42a1f6ff362600b876be3a376d

Author: David Adam <David.Adam at math.cnrs.fr>
Date:   Tue Oct 30 14:18:51 2007 +0100

d3dx8: Fix the condition in D3DXMatrixIsIdentity.

---

 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 = TRUE;
     got = D3DXMatrixIsIdentity(&mat);
     ok(expected == got, "Expected : %d, Got : %d\n", expected, got);
+    U(mat).m[0][0] = 0.000009f;
+    expected = FALSE;
+    got = D3DXMatrixIsIdentity(&mat);
+    ok(expected == got, "Expected : %d, Got : %d\n", expected, got);
     /* Test the NULL case */
     expected = FALSE;
     got = 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=TRUE;
 
     if ( !pm ) return FALSE;
     D3DXMatrixIdentity(&testmatrix);
@@ -359,10 +358,10 @@ static inline BOOL D3DXMatrixIsIdentity(D3DXMATRIX *pm)
     {
      for (j=0; j<4; j++)
      {
-      if ( fabs(D3DX_U(*pm).m[i][j] - D3DX_U(testmatrix).m[i][j]) > 0.0001 ) equal = FALSE;
+      if ( D3DX_U(*pm).m[i][j] != D3DX_U(testmatrix).m[i][j] ) return FALSE;
      }
     }
-    return equal;
+    return TRUE;
 }
 #undef D3DX_U
 




More information about the wine-cvs mailing list