David Adam : d3dx8: Implement D3DXVec2Maximize with a test.
Alexandre Julliard
julliard at winehq.org
Tue Oct 16 07:59:58 CDT 2007
Module: wine
Branch: master
Commit: f453d737a115945bcc44e390638f5b61ccef06c0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f453d737a115945bcc44e390638f5b61ccef06c0
Author: David Adam <David.Adam at math.cnrs.fr>
Date: Sun Oct 14 20:04:59 2007 +0200
d3dx8: Implement D3DXVec2Maximize with a test.
---
dlls/d3dx8/tests/math.c | 11 +++++++++++
include/d3dx8math.h | 1 +
include/d3dx8math.inl | 8 ++++++++
3 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index 37d8cdb..aefb55c 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -87,6 +87,17 @@ static void D3X8Vector2Test(void)
got = D3DXVec2LengthSq(NULL);
ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
+/*_______________D3DXVec2Maximize__________________________*/
+ expectedvec.x = 3.0f; expectedvec.y = 9.0f;
+ /*gotvec.x=0.0f; gotvec.y=0.0f;*/
+ D3DXVec2Maximize(&gotvec,&u,&v);
+ expect_vec(expectedvec,gotvec);
+ /* Tests the case NULL */
+ funcpointer = D3DXVec2Maximize(&gotvec,NULL,&v);
+ ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
+ funcpointer = D3DXVec2Maximize(NULL,NULL,NULL);
+ ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
+
/*_______________D3DXVec2Minimize__________________________*/
expectedvec.x = -7.0f; expectedvec.y = 4.0f;
/*vecgot.x=0.0f; vecgot.y=0.0f;*/
diff --git a/include/d3dx8math.h b/include/d3dx8math.h
index d71c015..04528e9 100644
--- a/include/d3dx8math.h
+++ b/include/d3dx8math.h
@@ -63,6 +63,7 @@ FLOAT D3DXVec2CCW(CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2);
FLOAT D3DXVec2Dot(CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2);
FLOAT D3DXVec2Length(CONST D3DXVECTOR2 *pv);
FLOAT D3DXVec2LengthSq(CONST D3DXVECTOR2 *pv);
+D3DXVECTOR2* D3DXVec2Maximize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2);
D3DXVECTOR2* D3DXVec2Minimize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2);
D3DXVECTOR2* D3DXVec2Subtract(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2);
diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl
index 0c39d91..4852f5f 100644
--- a/include/d3dx8math.inl
+++ b/include/d3dx8math.inl
@@ -51,6 +51,14 @@ extern inline FLOAT D3DXVec2LengthSq(CONST D3DXVECTOR2 *pv)
return( (pv->x) * (pv->x) + (pv->y) * (pv->y) );
}
+extern inline D3DXVECTOR2* D3DXVec2Maximize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2)
+{
+ if ( !pout || !pv1 || !pv2) return NULL;
+ pout->x = max(pv1->x , pv2->x);
+ pout->y = max(pv1->y , pv2->y);
+ return pout;
+}
+
extern inline D3DXVECTOR2* D3DXVec2Minimize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
More information about the wine-cvs
mailing list