David Adam : d3dx9: Fix D3DXVec2TransformCoord to make tests pass in Windows.
Alexandre Julliard
julliard at winehq.org
Mon Jul 20 07:36:41 CDT 2009
Module: wine
Branch: master
Commit: e37aff31b460fde0219a75d5057f8db91fd2e0a6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e37aff31b460fde0219a75d5057f8db91fd2e0a6
Author: David Adam <david.adam.cnrs at gmail.com>
Date: Fri Jul 17 18:14:32 2009 +0200
d3dx9: Fix D3DXVec2TransformCoord to make tests pass in Windows.
---
dlls/d3dx9_36/math.c | 17 ++++++-----------
dlls/d3dx9_36/tests/math.c | 7 +------
2 files changed, 7 insertions(+), 17 deletions(-)
diff --git a/dlls/d3dx9_36/math.c b/dlls/d3dx9_36/math.c
index 30f7ec9..31078e5 100644
--- a/dlls/d3dx9_36/math.c
+++ b/dlls/d3dx9_36/math.c
@@ -1440,20 +1440,15 @@ D3DXVECTOR4* WINAPI D3DXVec2TransformArray(D3DXVECTOR4* out, UINT outstride, CON
D3DXVECTOR2* WINAPI D3DXVec2TransformCoord(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv, CONST D3DXMATRIX *pm)
{
+ D3DXVECTOR2 v;
FLOAT norm;
+ v = *pv;
norm = pm->u.m[0][3] * pv->x + pm->u.m[1][3] * pv->y + pm->u.m[3][3];
- if ( norm )
- {
- CONST D3DXVECTOR2 v = *pv;
- pout->x = (pm->u.m[0][0] * v.x + pm->u.m[1][0] * v.y + pm->u.m[3][0]) / norm;
- pout->y = (pm->u.m[0][1] * v.x + pm->u.m[1][1] * v.y + pm->u.m[3][1]) / norm;
- }
- else
- {
- pout->x = 0.0f;
- pout->y = 0.0f;
- }
+
+ pout->x = (pm->u.m[0][0] * v.x + pm->u.m[1][0] * v.y + pm->u.m[3][0]) / norm;
+ pout->y = (pm->u.m[0][1] * v.x + pm->u.m[1][1] * v.y + pm->u.m[3][1]) / norm;
+
return pout;
}
diff --git a/dlls/d3dx9_36/tests/math.c b/dlls/d3dx9_36/tests/math.c
index 6e9f25d..8879e1c 100644
--- a/dlls/d3dx9_36/tests/math.c
+++ b/dlls/d3dx9_36/tests/math.c
@@ -950,7 +950,7 @@ static void D3DXQuaternionTest(void)
static void D3DXVector2Test(void)
{
- D3DXVECTOR2 expectedvec, gotvec, nul, nulproj, u, v, w, x;
+ D3DXVECTOR2 expectedvec, gotvec, nul, u, v, w, x;
LPD3DXVECTOR2 funcpointer;
D3DXVECTOR4 expectedtrans, gottrans;
D3DXMATRIX mat;
@@ -1105,11 +1105,6 @@ static void D3DXVector2Test(void)
expectedvec.x = 0.6f; expectedvec.y = 11.0f/15.0f;
D3DXVec2TransformCoord(&gotvec,&u,&mat);
expect_vec(expectedvec,gotvec);
- /* Test the nul projected vector */
- nulproj.x = -2.0f; nulproj.y = -1.0f;
- expectedvec.x = 0.0f; expectedvec.y = 0.0f;
- D3DXVec2TransformCoord(&gotvec,&nulproj,&mat);
- expect_vec(expectedvec,gotvec);
/*_______________D3DXVec2TransformNormal______________________*/
expectedvec.x = 23.0f; expectedvec.y = 30.0f;
More information about the wine-cvs
mailing list