diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index c00eb4c2d3e..0d091ce6d91 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 21e8fc8a1c2..50a1144c8e8 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)