Matteo Bruni : ddraw: Make sure AddLight properly activates lights.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Mar 31 10:38:50 CDT 2015


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

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Mon Mar 30 20:18:01 2015 +0200

ddraw: Make sure AddLight properly activates lights.

---

 dlls/ddraw/viewport.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/dlls/ddraw/viewport.c b/dlls/ddraw/viewport.c
index 84c1b14..5ebc41e 100644
--- a/dlls/ddraw/viewport.c
+++ b/dlls/ddraw/viewport.c
@@ -672,8 +672,8 @@ static HRESULT WINAPI d3d_viewport_Clear(IDirect3DViewport3 *iface,
                     This->background->mat.u.diffuse.u4.a);
     }
 
-    /* Need to temporarily activate viewport to clear it. Previously active one will be restored
-        afterwards. */
+    /* Need to temporarily activate the viewport to clear it. The previously
+     * active one will be restored afterwards. */
     viewport_activate(This, TRUE);
 
     hr = IDirect3DDevice7_Clear(&This->active_device->IDirect3DDevice7_iface, rect_count, rects,
@@ -740,8 +740,12 @@ static HRESULT WINAPI d3d_viewport_AddLight(IDirect3DViewport3 *iface, IDirect3D
     light_impl->active_viewport = This;
 
     /* If active, activate the light */
-    if (This->active_device)
+    if (This->active_device && light_impl->light.dwFlags & D3DLIGHT_ACTIVE)
+    {
+        /* Disable the flag so that light_activate actually does its job. */
+        light_impl->light.dwFlags &= ~D3DLIGHT_ACTIVE;
         light_activate(light_impl);
+    }
 
     wined3d_mutex_unlock();
 




More information about the wine-cvs mailing list