David Adam : d3dx8: Implement D3DXPlaneColorScale.

Alexandre Julliard julliard at winehq.org
Wed Oct 24 11:04:50 CDT 2007


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

Author: David Adam <David.Adam at math.cnrs.fr>
Date:   Tue Oct 23 13:06:51 2007 +0200

d3dx8: Implement D3DXPlaneColorScale.

---

 dlls/d3dx8/tests/math.c |   10 ++++++++++
 include/d3dx8math.inl   |   10 ++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index c00eb4c..0d091ce 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -86,6 +86,16 @@ static void D3DXColorTest(void)
     ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
     funcpointer = D3DXColorNegative(NULL,NULL);
     ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
+
+/*_______________D3DXColorScale________________*/
+    expected.r = 0.06f; expected.g = 0.225f; expected.b = 0.123f; expected.a = 0.279f;
+    D3DXColorScale(&got,&color,scale);
+    expect_color(expected,got);
+    /* Test the NULL case */
+    funcpointer = D3DXColorScale(&got,NULL,scale);
+    ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
+    funcpointer = D3DXColorScale(NULL,NULL,scale);
+    ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
 }
 
 static void D3DXPlaneTest(void)
diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl
index 21e8fc8..50a1144 100644
--- a/include/d3dx8math.inl
+++ b/include/d3dx8math.inl
@@ -51,6 +51,16 @@ static inline D3DXCOLOR* D3DXColorNegative(D3DXCOLOR *pout, CONST D3DXCOLOR *pc)
     return pout;
 }
 
+static inline D3DXCOLOR* D3DXColorScale(D3DXCOLOR *pout, CONST D3DXCOLOR *pc, FLOAT s)
+{
+    if ( !pout || !pc ) return NULL;
+    pout->r = s* (pc->r);
+    pout->g = s* (pc->g);
+    pout->b = s* (pc->b);
+    pout->a = s* (pc->a);
+    return pout;
+}
+
 /*_______________D3DXVECTOR2________________________*/
 
 static inline D3DXVECTOR2* D3DXVec2Add(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2)




More information about the wine-cvs mailing list