[PATCH] Implement D3DXColorAdjustContrast with a test
David Adam
David.Adam at math.cnrs.fr
Mon Nov 19 08:38:34 CST 2007
---
dlls/d3dx8/d3dx8.spec | 2 +-
dlls/d3dx8/math.c | 9 +++++++++
dlls/d3dx8/tests/math.c | 5 +++++
include/d3dx8math.h | 2 ++
4 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/dlls/d3dx8/d3dx8.spec b/dlls/d3dx8/d3dx8.spec
index ab796af..4a6d26c 100644
--- a/dlls/d3dx8/d3dx8.spec
+++ b/dlls/d3dx8/d3dx8.spec
@@ -67,7 +67,7 @@
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneTransform(ptr ptr ptr)
@ stdcall D3DXColorAdjustSaturation(ptr ptr long)
-@ stub D3DXColorAdjustContrast
+@ stdcall D3DXColorAdjustContrast(ptr ptr long)
@ stub D3DXCreateMatrixStack
@ stdcall D3DXCreateFont(ptr ptr ptr)
@ stub D3DXCreateFontIndirect
diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c
index ac66481..3cff34f 100644
--- a/dlls/d3dx8/math.c
+++ b/dlls/d3dx8/math.c
@@ -34,6 +34,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3dx8);
=20
/*_________________D3DXColor____________________*/
=20
+D3DXCOLOR* WINAPI D3DXColorAdjustContrast(D3DXCOLOR *pout, CONST D3DXCOLOR =
*pc, FLOAT s)
+{
+ pout->r =3D 0.5f + s * (pc->r - 0.5f);
+ pout->g =3D 0.5f + s * (pc->g - 0.5f);
+ pout->b =3D 0.5f + s * (pc->b - 0.5f);
+ pout->a =3D pc->a;
+ return pout;
+}
+
D3DXCOLOR* WINAPI D3DXColorAdjustSaturation(D3DXCOLOR *pout, CONST D3DXCOLO=
R *pc, FLOAT s)
{
FLOAT grey;
diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index f349a28..f62bd80 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -82,6 +82,11 @@ static void D3DXColorTest(void)
funcpointer =3D D3DXColorAdd(NULL,NULL,NULL);
ok(funcpointer =3D=3D NULL, "Expected: %p, Got: %p\n", NULL, funcpointe=
r);
=20
+/*_______________D3DXColorAdjustContrast______*/
+ expected.r =3D 0.41f; expected.g =3D 0.575f; expected.b =3D 0.473f, exp=
ected.a =3D 0.93f;
+ D3DXColorAdjustContrast(&got,&color,scale);
+ expect_color(expected,got);
+
/*_______________D3DXColorAdjustSaturation______*/
expected.r =3D 0.486028f; expected.g =3D 0.651028f; expected.b =3D 0.54=
9028f, expected.a =3D 0.93f;
D3DXColorAdjustSaturation(&got,&color,scale);
diff --git a/include/d3dx8math.h b/include/d3dx8math.h
index 28c1bbe..a3eca67 100644
--- a/include/d3dx8math.h
+++ b/include/d3dx8math.h
@@ -263,7 +263,9 @@ typedef struct D3DXCOLOR
extern "C" {
#endif
=20
+D3DXCOLOR* WINAPI D3DXColorAdjustContrast(D3DXCOLOR *pout, CONST D3DXCOLOR =
*pc, FLOAT s);
D3DXCOLOR* WINAPI D3DXColorAdjustSaturation(D3DXCOLOR *pout, CONST D3DXCOLO=
R *pc, FLOAT s);
+
D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *pout, float s=
caling, D3DXVECTOR3 *rotationcenter, D3DXQUATERNION *rotation, D3DXVECTOR3 *=
translation);
FLOAT WINAPI D3DXMatrixfDeterminant(CONST D3DXMATRIX *pm);
D3DXMATRIX* WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant,=
CONST D3DXMATRIX *pm);
--=20
1.5.3.2
--=_1lgtfamy57r4--
More information about the wine-patches
mailing list