d3dx8: Implement D3DXPlaneColorModulate.

This commit is contained in:
David Adam 2007-10-23 12:09:02 +02:00 committed by Alexandre Julliard
parent 2f3702043e
commit 03e92443d7
2 changed files with 25 additions and 2 deletions

View File

@ -34,15 +34,16 @@
static void D3DXColorTest(void)
{
D3DXCOLOR color, color1, expected, got;
D3DXCOLOR color, color1, color2, expected, got;
LPD3DXCOLOR funcpointer;
FLOAT scale;
color.r = 0.2f; color.g = 0.75f; color.b = 0.41f; color.a = 0.93f;
color1.r = 0.6f; color1.g = 0.55f; color1.b = 0.23f; color1.a = 0.82f;
color2.r = 0.3f; color2.g = 0.5f; color2.b = 0.76f; color2.a = 0.11f;
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);
@ -54,6 +55,18 @@ static void D3DXColorTest(void)
funcpointer = D3DXColorLerp(NULL,NULL,NULL,scale);
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXColorModulate________________*/
expected.r = 0.18f; expected.g = 0.275f; expected.b = 0.1748f; expected.a = 0.0902f;
D3DXColorModulate(&got,&color1,&color2);
expect_color(expected,got);
/* Test the NULL case */
funcpointer = D3DXColorModulate(&got,NULL,&color2);
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
funcpointer = D3DXColorModulate(NULL,NULL,&color2);
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
funcpointer = D3DXColorModulate(NULL,NULL,NULL);
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;
D3DXColorNegative(&got,&color);

View File

@ -31,6 +31,16 @@ static inline D3DXCOLOR* D3DXColorLerp(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1, CO
return pout;
}
static inline D3DXCOLOR* D3DXColorModulate(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* D3DXColorNegative(D3DXCOLOR *pout, CONST D3DXCOLOR *pc)
{
if ( !pout || !pc ) return NULL;