Module: wine Branch: master Commit: d2a52d1e17bc2500744824e6801a7fdb7e6bce05 URL: http://source.winehq.org/git/wine.git/?a=commit;h=d2a52d1e17bc2500744824e680...
Author: André Hentschel nerv@dawncrow.de Date: Sun May 27 15:52:32 2012 +0200
d3drm: Implement IDirect3DRMLight_[Get|Set]Color and IDirect3DRMLight_SetColorRGB.
---
dlls/d3drm/light.c | 21 +++++++++++++++------ dlls/d3drm/tests/d3drm.c | 10 +++++----- 2 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/dlls/d3drm/light.c b/dlls/d3drm/light.c index 620fb97..0e3b5af 100644 --- a/dlls/d3drm/light.c +++ b/dlls/d3drm/light.c @@ -29,10 +29,13 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
+#define D3DCOLOR_ARGB(a,r,g,b) ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff))) + typedef struct { IDirect3DRMLight IDirect3DRMLight_iface; LONG ref; D3DRMLIGHTTYPE type; + D3DCOLOR color; } IDirect3DRMLightImpl;
static inline IDirect3DRMLightImpl *impl_from_IDirect3DRMLight(IDirect3DRMLight *iface) @@ -186,9 +189,11 @@ static HRESULT WINAPI IDirect3DRMLightImpl_SetColor(IDirect3DRMLight* iface, D3D { IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
- FIXME("(%p/%p)->(%u): stub\n", iface, This, color); + TRACE("(%p/%p)->(%u)\n", iface, This, color);
- return E_NOTIMPL; + This->color = color; + + return D3DRM_OK; }
static HRESULT WINAPI IDirect3DRMLightImpl_SetColorRGB(IDirect3DRMLight* iface, @@ -196,9 +201,13 @@ static HRESULT WINAPI IDirect3DRMLightImpl_SetColorRGB(IDirect3DRMLight* iface, { IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
- FIXME("(%p/%p)->(%f,%f,%f): stub\n", iface, This, red, green, blue); + TRACE("(%p/%p)->(%f,%f,%f)\n", iface, This, red, green, blue);
- return E_NOTIMPL; + This->color = D3DCOLOR_ARGB(0xff, (BYTE)(red * 255.0f), + (BYTE)(green * 255.0f), + (BYTE)(blue * 255.0f)); + + return D3DRM_OK; }
static HRESULT WINAPI IDirect3DRMLightImpl_SetRange(IDirect3DRMLight* iface, D3DVALUE range) @@ -316,9 +325,9 @@ static D3DCOLOR WINAPI IDirect3DRMLightImpl_GetColor(IDirect3DRMLight* iface) { IDirect3DRMLightImpl *This = impl_from_IDirect3DRMLight(iface);
- FIXME("(%p/%p)->(): stub\n", iface, This); + TRACE("(%p/%p)->()\n", iface, This);
- return 0; + return This->color; }
static D3DRMLIGHTTYPE WINAPI IDirect3DRMLightImpl_GetType(IDirect3DRMLight* iface) diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 16db2c2..b6ed51a 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -842,7 +842,7 @@ static void test_Light(void) ok(type == D3DRMLIGHT_SPOT, "wrong type (%u)\n", type);
color = IDirect3DRMLight_GetColor(pLight); - todo_wine ok(color == 0xff7f7f7f, "wrong color (%x)\n", color); + ok(color == 0xff7f7f7f, "wrong color (%x)\n", color);
hr = IDirect3DRMLight_SetType(pLight, D3DRMLIGHT_POINT); ok(hr == D3DRM_OK, "Cannot set type (hr = %x)\n", hr); @@ -850,14 +850,14 @@ static void test_Light(void) ok(type == D3DRMLIGHT_POINT, "wrong type (%u)\n", type);
hr = IDirect3DRMLight_SetColor(pLight, 0xff180587); - todo_wine ok(hr == D3DRM_OK, "Cannot set color (hr = %x)\n", hr); + ok(hr == D3DRM_OK, "Cannot set color (hr = %x)\n", hr); color = IDirect3DRMLight_GetColor(pLight); - todo_wine ok(color == 0xff180587, "wrong color (%x)\n", color); + ok(color == 0xff180587, "wrong color (%x)\n", color);
hr = IDirect3DRMLight_SetColorRGB(pLight, 0.5, 0.5, 0.5); - todo_wine ok(hr == D3DRM_OK, "Cannot set color (hr = %x)\n", hr); + ok(hr == D3DRM_OK, "Cannot set color (hr = %x)\n", hr); color = IDirect3DRMLight_GetColor(pLight); - todo_wine ok(color == 0xff7f7f7f, "wrong color (%x)\n", color); + ok(color == 0xff7f7f7f, "wrong color (%x)\n", color);
IDirect3DRMLight_Release(pLight);