=?UTF-8?Q?Andr=C3=A9=20Hentschel=20?=: d3drm: Add SceneBackground handling.

Alexandre Julliard julliard at winehq.org
Mon Aug 13 13:21:19 CDT 2012


Module: wine
Branch: master
Commit: c10d95b64ac4ac77998bacd5cec9cf20185c3132
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c10d95b64ac4ac77998bacd5cec9cf20185c3132

Author: André Hentschel <nerv at dawncrow.de>
Date:   Sun Aug  5 17:44:46 2012 +0200

d3drm: Add SceneBackground handling.

---

 dlls/d3drm/frame.c       |   32 ++++++++++++++++++++------------
 dlls/d3drm/tests/d3drm.c |   15 +++++++++++++++
 2 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/dlls/d3drm/frame.c b/dlls/d3drm/frame.c
index 025c955..6cab5fa 100644
--- a/dlls/d3drm/frame.c
+++ b/dlls/d3drm/frame.c
@@ -55,6 +55,7 @@ struct IDirect3DRMFrameImpl {
     ULONG lights_capacity;
     IDirect3DRMLight** lights;
     D3DRMMATRIX4D transform;
+    D3DCOLOR scenebackground;
 };
 
 typedef struct {
@@ -981,9 +982,9 @@ static D3DCOLOR WINAPI IDirect3DRMFrame2Impl_GetSceneBackground(IDirect3DRMFrame
 {
     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
 
-    FIXME("(%p/%p)->(): stub\n", iface, This);
+    TRACE("(%p/%p)->()\n", iface, This);
 
-    return 0;
+    return IDirect3DRMFrame3_GetSceneBackground(&This->IDirect3DRMFrame3_iface);
 }
 
 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetSceneBackgroundDepth(IDirect3DRMFrame2* iface,
@@ -1040,9 +1041,9 @@ static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneBackground(IDirect3DRMFrame2
 {
     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
 
-    FIXME("(%p/%p)->(%u): stub\n", iface, This, color);
+    TRACE("(%p/%p)->(%u)\n", iface, This, color);
 
-    return E_NOTIMPL;
+    return IDirect3DRMFrame3_SetSceneBackground(&This->IDirect3DRMFrame3_iface, color);
 }
 
 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneBackgroundRGB(IDirect3DRMFrame2* iface,
@@ -1051,9 +1052,9 @@ static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneBackgroundRGB(IDirect3DRMFra
 {
     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(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;
+    return IDirect3DRMFrame3_SetSceneBackgroundRGB(&This->IDirect3DRMFrame3_iface, red, green, blue);
 }
 
 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneBackgroundDepth(IDirect3DRMFrame2* iface,
@@ -2078,9 +2079,9 @@ static D3DCOLOR WINAPI IDirect3DRMFrame3Impl_GetSceneBackground(IDirect3DRMFrame
 {
     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
 
-    FIXME("(%p/%p)->(): stub\n", iface, This);
+    TRACE("(%p/%p)->()\n", iface, This);
 
-    return 0;
+    return This->scenebackground;
 }
 
 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetSceneBackgroundDepth(IDirect3DRMFrame3* iface,
@@ -2137,9 +2138,11 @@ static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneBackground(IDirect3DRMFrame3
 {
     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
 
-    FIXME("(%p/%p)->(%u): stub\n", iface, This, color);
+    TRACE("(%p/%p)->(%u)\n", iface, This, color);
 
-    return E_NOTIMPL;
+    This->scenebackground = color;
+
+    return D3DRM_OK;
 }
 
 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneBackgroundRGB(IDirect3DRMFrame3* iface,
@@ -2148,9 +2151,13 @@ static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneBackgroundRGB(IDirect3DRMFra
 {
     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(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->scenebackground = D3DCOLOR_ARGB(0xff, (BYTE)(red   * 255.0f),
+                                                (BYTE)(green * 255.0f),
+                                                (BYTE)(blue  * 255.0f));
+
+    return D3DRM_OK;
 }
 
 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneBackgroundDepth(IDirect3DRMFrame3* iface,
@@ -2685,6 +2692,7 @@ HRESULT Direct3DRMFrame_create(REFIID riid, IUnknown* parent, IUnknown** ret_ifa
     object->IDirect3DRMFrame2_iface.lpVtbl = &Direct3DRMFrame2_Vtbl;
     object->IDirect3DRMFrame3_iface.lpVtbl = &Direct3DRMFrame3_Vtbl;
     object->ref = 1;
+    object->scenebackground = D3DCOLOR_ARGB(0xff, 0, 0, 0);
 
     memcpy(&object->transform[0][0], &identity[0][0], sizeof(D3DRMMATRIX4D));
 
diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c
index 91dd095..a257aea 100644
--- a/dlls/d3drm/tests/d3drm.c
+++ b/dlls/d3drm/tests/d3drm.c
@@ -602,6 +602,7 @@ static void test_Frame(void)
     LPDIRECT3DRMLIGHT pLight1;
     LPDIRECT3DRMLIGHT pLightTmp;
     LPDIRECT3DRMLIGHTARRAY pLightArray;
+    D3DCOLOR color;
     DWORD count;
     CHAR cname[64] = {0};
 
@@ -895,6 +896,20 @@ static void test_Frame(void)
     CHECK_REFCOUNT(pFrameP1, 3);
     IDirect3DRMLight_Release(pLight1);
 
+    /* Test SceneBackground on first parent */
+    color = IDirect3DRMFrame_GetSceneBackground(pFrameP1);
+    ok(color == 0xff000000, "wrong color (%x)\n", color);
+
+    hr = IDirect3DRMFrame_SetSceneBackground(pFrameP1, 0xff180587);
+    ok(hr == D3DRM_OK, "Cannot set color (hr = %x)\n", hr);
+    color = IDirect3DRMFrame_GetSceneBackground(pFrameP1);
+    ok(color == 0xff180587, "wrong color (%x)\n", color);
+
+    hr = IDirect3DRMFrame_SetSceneBackgroundRGB(pFrameP1, 0.5, 0.5, 0.5);
+    ok(hr == D3DRM_OK, "Cannot set color (hr = %x)\n", hr);
+    color = IDirect3DRMFrame_GetSceneBackground(pFrameP1);
+    ok(color == 0xff7f7f7f, "wrong color (%x)\n", color);
+
     /* Cleanup */
     IDirect3DRMFrame_Release(pFrameP2);
     CHECK_REFCOUNT(pFrameC, 2);




More information about the wine-cvs mailing list