Module: wine Branch: master Commit: 8389eab6b7b1c9be60426a743fa095205898e1a1 URL: http://source.winehq.org/git/wine.git/?a=commit;h=8389eab6b7b1c9be60426a743f...
Author: David Adam David.Adam@math.cnrs.fr Date: Mon Nov 19 15:26:22 2007 +0100
d3dx8: Implement D3DXColorAdjustSaturation.
---
dlls/d3dx8/d3dx8.spec | 2 +- dlls/d3dx8/math.c | 14 ++++++++++++++ dlls/d3dx8/tests/math.c | 7 ++++++- include/d3dx8math.h | 1 + 4 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dx8/d3dx8.spec b/dlls/d3dx8/d3dx8.spec index 3a27e1a..ab796af 100644 --- a/dlls/d3dx8/d3dx8.spec +++ b/dlls/d3dx8/d3dx8.spec @@ -66,7 +66,7 @@ @ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr) @ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr) @ stdcall D3DXPlaneTransform(ptr ptr ptr) -@ stub D3DXColorAdjustSaturation +@ stdcall D3DXColorAdjustSaturation(ptr ptr long) @ stub D3DXColorAdjustContrast @ stub D3DXCreateMatrixStack @ stdcall D3DXCreateFont(ptr ptr ptr) diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c index 6372271..ac66481 100644 --- a/dlls/d3dx8/math.c +++ b/dlls/d3dx8/math.c @@ -32,6 +32,20 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3dx8);
+/*_________________D3DXColor____________________*/ + +D3DXCOLOR* WINAPI D3DXColorAdjustSaturation(D3DXCOLOR *pout, CONST D3DXCOLOR *pc, FLOAT s) +{ + FLOAT grey; + + grey = pc->r * 0.2125f + pc->g * 0.7154f + pc->b * 0.0721f; + pout->r = grey + s * (pc->r - grey); + pout->g = grey + s * (pc->g - grey); + pout->b = grey + s * (pc->b - grey); + pout->a = pc->a; + return pout; +} + /*_________________D3DXMatrix____________________*/
D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *pout, float scaling, D3DXVECTOR3 *rotationcenter, D3DXQUATERNION *rotation, D3DXVECTOR3 *translation) diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index cb72b31..f349a28 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -67,6 +67,7 @@ static void D3DXColorTest(void) 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;
/*_______________D3DXColorAdd________________*/ @@ -81,6 +82,11 @@ static void D3DXColorTest(void) funcpointer = D3DXColorAdd(NULL,NULL,NULL); ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
+/*_______________D3DXColorAdjustSaturation______*/ + expected.r = 0.486028f; expected.g = 0.651028f; expected.b = 0.549028f, expected.a = 0.93f; + D3DXColorAdjustSaturation(&got,&color,scale); + expect_color(expected,got); + /*_______________D3DXColorLerp________________*/ expected.r = 0.32f; expected.g = 0.69f; expected.b = 0.356f; expected.a = 0.897f; D3DXColorLerp(&got,&color,&color1,scale); @@ -436,7 +442,6 @@ static void D3DXMatrixTest(void)
static void D3DXPlaneTest(void) { - D3DXMATRIX mat; D3DXPLANE expectedplane, gotplane, nulplane, plane; D3DXVECTOR3 expectedvec, gotvec, vec1, vec2, vec3; diff --git a/include/d3dx8math.h b/include/d3dx8math.h index 06bc562..28c1bbe 100644 --- a/include/d3dx8math.h +++ b/include/d3dx8math.h @@ -263,6 +263,7 @@ typedef struct D3DXCOLOR extern "C" { #endif
+D3DXCOLOR* WINAPI D3DXColorAdjustSaturation(D3DXCOLOR *pout, CONST D3DXCOLOR *pc, FLOAT s); D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *pout, float scaling, D3DXVECTOR3 *rotationcenter, D3DXQUATERNION *rotation, D3DXVECTOR3 *translation); FLOAT WINAPI D3DXMatrixfDeterminant(CONST D3DXMATRIX *pm); D3DXMATRIX* WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant, CONST D3DXMATRIX *pm);