Module: wine Branch: master Commit: 2567bd8a98a2b776fc275d2a61c24ed91ff1e5c2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=2567bd8a98a2b776fc275d2a61...
Author: David Adam David.Adam@math.cnrs.fr Date: Tue Oct 23 13:14:19 2007 +0200
d3dx8: Implement D3DXPlaneColorAdd.
---
dlls/d3dx8/tests/math.c | 12 ++++++++++++ include/d3dx8math.inl | 10 ++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index 0d091ce..2f6633f 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -43,6 +43,18 @@ static void D3DXColorTest(void) color2.r = 0.3f; color2.g = 0.5f; color2.b = 0.76f; color2.a = 0.11f; scale = 0.3f;
+/*_______________D3DXColorAdd________________*/ + expected.r = 0.9f; expected.g = 1.05f; expected.b = 0.99f, expected.a = 0.93f; + D3DXColorAdd(&got,&color1,&color2); + expect_color(expected,got); + /* Test the NULL case */ + funcpointer = D3DXColorAdd(&got,NULL,&color2); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + funcpointer = D3DXColorAdd(NULL,NULL,&color2); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + funcpointer = D3DXColorAdd(NULL,NULL,NULL); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + /*_______________D3DXColorLerp________________*/ expected.r = 0.32f; expected.g = 0.69f; expected.b = 0.356f; expected.a = 0.897f; D3DXColorLerp(&got,&color,&color1,scale); diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl index 50a1144..78ef7c5 100644 --- a/include/d3dx8math.inl +++ b/include/d3dx8math.inl @@ -21,6 +21,16 @@
/*_______________D3DXCOLOR_____________________*/
+static inline D3DXCOLOR* D3DXColorAdd(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1, CONST D3DXCOLOR *pc2) +{ + if ( !pout || !pc1 || !pc2 ) return NULL; + pout->r = (pc1->r) + (pc2->r); + pout->g = (pc1->g) + (pc2->g); + pout->b = (pc1->b) + (pc2->b); + pout->a = (pc1->a) + (pc2->a); + return pout; +} + static inline D3DXCOLOR* D3DXColorLerp(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1, CONST D3DXCOLOR *pc2, FLOAT s) { if ( !pout || !pc1 || !pc2 ) return NULL;