David Adam : d3dx8: Implement D3DXPlaneColorLerp.
Alexandre Julliard
julliard at winehq.org
Wed Oct 24 11:04:50 CDT 2007
Module: wine
Branch: master
Commit: 2f3702043e255cce9e2ac6db8239925ef7e908c1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2f3702043e255cce9e2ac6db8239925ef7e908c1
Author: David Adam <David.Adam at math.cnrs.fr>
Date: Tue Oct 23 11:54:32 2007 +0200
d3dx8: Implement D3DXPlaneColorLerp.
---
dlls/d3dx8/tests/math.c | 15 +++++++++++++++
include/d3dx8math.inl | 12 ++++++++++++
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index 7c74b65..fbb8ab3 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -36,8 +36,23 @@ static void D3DXColorTest(void)
{
D3DXCOLOR color, color1, expected, got;
LPD3DXCOLOR funcpointer;
+ FLOAT scale;
color.r = 0.2f; color.g = 0.75f; color.b = 0.41f; color.a = 0.93f;
+ scale = 0.3f;
+
+/*_______________D3DXColorLerp________________*/
+ color1.r = 0.6f; color1.g = 0.55f; color1.b = 0.23f; color1.a = 0.82f;
+ expected.r = 0.32f; expected.g = 0.69f; expected.b = 0.356f; expected.a = 0.897f;
+ D3DXColorLerp(&got,&color,&color1,scale);
+ expect_color(expected,got);
+ /* Test the NULL case */
+ funcpointer = D3DXColorLerp(&got,NULL,&color1,scale);
+ ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
+ funcpointer = D3DXColorLerp(NULL,NULL,&color1,scale);
+ ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
+ funcpointer = D3DXColorLerp(NULL,NULL,NULL,scale);
+ ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXColorNegative________________*/
expected.r = 0.8f; expected.g = 0.25f; expected.b = 0.59f; expected.a = 0.93f;
diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl
index d4ddb14..da11f31 100644
--- a/include/d3dx8math.inl
+++ b/include/d3dx8math.inl
@@ -19,6 +19,18 @@
#ifndef __D3DX8MATH_INL__
#define __D3DX8MATH_INL__
+/*_______________D3DXCOLOR_____________________*/
+
+static inline D3DXCOLOR* D3DXColorLerp(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1, CONST D3DXCOLOR *pc2, FLOAT s)
+{
+ if ( !pout || !pc1 || !pc2 ) return NULL;
+ pout->r = (1-s) * (pc1->r) + s *(pc2->r);
+ pout->g = (1-s) * (pc1->g) + s *(pc2->g);
+ pout->b = (1-s) * (pc1->b) + s *(pc2->b);
+ pout->a = (1-s) * (pc1->a) + s *(pc2->a);
+ return pout;
+}
+
static inline D3DXCOLOR* D3DXColorNegative(D3DXCOLOR *pout, CONST D3DXCOLOR *pc)
{
if ( !pout || !pc ) return NULL;
More information about the wine-cvs
mailing list