From 7eaf1fe2f5abc2cd290d59144ec5ebabe16945a6 Mon Sep 17 00:00:00 2001 From: David Adam Date: Sun, 20 May 2007 16:27:30 +0200 Subject: [PATCH] d3drm: Implement D3DRMCreateColorRGB. --- dlls/d3drm/d3drm.spec | 2 +- dlls/d3drm/math.c | 5 +++++ dlls/d3drm/tests/vector.c | 10 ++++++++++ include/d3drmdef.h | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dlls/d3drm/d3drm.spec b/dlls/d3drm/d3drm.spec index 69da8b641d8..141f933c6b7 100644 --- a/dlls/d3drm/d3drm.spec +++ b/dlls/d3drm/d3drm.spec @@ -2,7 +2,7 @@ @ stdcall D3DRMColorGetBlue(long) @ stdcall D3DRMColorGetGreen(long) @ stdcall D3DRMColorGetRed(long) -@ stub D3DRMCreateColorRGB +@ stdcall D3DRMCreateColorRGB(long long long) @ stdcall D3DRMCreateColorRGBA(long long long long) @ stdcall D3DRMMatrixFromQuaternion(ptr ptr) @ stdcall D3DRMQuaternionFromRotation(ptr ptr long) diff --git a/dlls/d3drm/math.c b/dlls/d3drm/math.c index a06c0246724..76b73c033e0 100644 --- a/dlls/d3drm/math.c +++ b/dlls/d3drm/math.c @@ -34,6 +34,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3drm); +/* Create a RGB color from its components */ +D3DCOLOR WINAPI D3DRMCreateColorRGB(D3DVALUE red, D3DVALUE green, D3DVALUE blue) +{ + return (D3DRMCreateColorRGBA(red, green, blue, 255.0)); +} /* Create a RGBA color from its components */ D3DCOLOR WINAPI D3DRMCreateColorRGBA(D3DVALUE red, D3DVALUE green, D3DVALUE blue, D3DVALUE alpha) { diff --git a/dlls/d3drm/tests/vector.c b/dlls/d3drm/tests/vector.c index 8448879a6df..7e2690cb37f 100644 --- a/dlls/d3drm/tests/vector.c +++ b/dlls/d3drm/tests/vector.c @@ -79,6 +79,7 @@ static LPD3DVECTOR (WINAPI * pD3DRMVectorScale)(LPD3DVECTOR, LPD3DVECTOR, D3DVAL static LPD3DVECTOR (WINAPI * pD3DRMVectorSubtract)(LPD3DVECTOR, LPD3DVECTOR, LPD3DVECTOR); static LPD3DRMQUATERNION (WINAPI * pD3DRMQuaternionFromRotation)(LPD3DRMQUATERNION, LPD3DVECTOR, D3DVALUE); static LPD3DRMQUATERNION (WINAPI * pD3DRMQuaternionSlerp)(LPD3DRMQUATERNION, LPD3DRMQUATERNION, LPD3DRMQUATERNION, D3DVALUE); +static D3DCOLOR (WINAPI * pD3DRMCreateColorRGB)(D3DVALUE, D3DVALUE, D3DVALUE); static D3DCOLOR (WINAPI * pD3DRMCreateColorRGBA)(D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE); static D3DVALUE (WINAPI * pD3DRMColorGetAlpha)(D3DCOLOR); static D3DVALUE (WINAPI * pD3DRMColorGetBlue)(D3DCOLOR); @@ -115,6 +116,7 @@ static BOOL InitFunctionPtrs(void) D3DRM_GET_PROC(D3DRMVectorSubtract) D3DRM_GET_PROC(D3DRMQuaternionFromRotation) D3DRM_GET_PROC(D3DRMQuaternionSlerp) + D3DRM_GET_PROC(D3DRMCreateColorRGB) D3DRM_GET_PROC(D3DRMCreateColorRGBA) D3DRM_GET_PROC(D3DRMColorGetAlpha) D3DRM_GET_PROC(D3DRMColorGetBlue) @@ -261,6 +263,14 @@ static void ColorTest(void) D3DCOLOR color, expected_color, got_color; D3DVALUE expected, got, red, green, blue, alpha; +/*___________D3DRMCreateColorRGB_________________________*/ + red=0.8; + green=0.3; + blue=0.55; + expected_color=0xffcc4c8c; + got_color=pD3DRMCreateColorRGB(red,green,blue); + ok((expected_color==got_color),"Expected color=%x, Got color=%x\n",expected_color,got_color); + /*___________D3DRMCreateColorRGBA________________________*/ red=0.1; green=0.4; diff --git a/include/d3drmdef.h b/include/d3drmdef.h index bd94924ebad..6f769f4af3f 100644 --- a/include/d3drmdef.h +++ b/include/d3drmdef.h @@ -54,6 +54,7 @@ LPD3DVECTOR WINAPI D3DRMVectorReflect(LPD3DVECTOR, LPD3DVECTOR, LPD3DVECTOR); LPD3DVECTOR WINAPI D3DRMVectorScale(LPD3DVECTOR, LPD3DVECTOR, D3DVALUE); LPD3DVECTOR WINAPI D3DRMVectorSubtract(LPD3DVECTOR, LPD3DVECTOR, LPD3DVECTOR); +D3DCOLOR WINAPI D3DRMCreateColorRGB(D3DVALUE, D3DVALUE, D3DVALUE); D3DCOLOR WINAPI D3DRMCreateColorRGBA(D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE); D3DVALUE WINAPI D3DRMColorGetAlpha(D3DCOLOR); D3DVALUE WINAPI D3DRMColorGetBlue(D3DCOLOR);