Commit 2f370204 authored by David Adam's avatar David Adam Committed by Alexandre Julliard

d3dx8: Implement D3DXPlaneColorLerp.

parent 6ebc5cef
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment