Stefan Dösinger : ddraw: Do not access the surface connection structure directly in SetPalette.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Apr 30 07:11:16 CDT 2007


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Mon Apr 23 21:28:06 2007 +0200

ddraw: Do not access the surface connection structure directly in SetPalette.

---

 dlls/ddraw/surface.c |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index 4d62362..e6e316e 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -2238,13 +2238,30 @@ IDirectDrawSurfaceImpl_SetPalette(IDirectDrawSurface7 *iface,
     /* Release the old palette */
     if(oldPal) IDirectDrawPalette_Release(oldPal);
 
-    /* If this is a front buffer, also update the back buffers */
+    /* If this is a front buffer, also update the back buffers
+     * TODO: How do things work for palettized cube textures?
+     */
     if(This->surface_desc.ddsCaps.dwCaps & DDSCAPS_FRONTBUFFER)
     {
-        for(surf = This->next_complex; surf != NULL; surf = surf->next_complex)
+        /* For primary surfaces the tree is just a list, so the simpler scheme fits too */
+        DDSCAPS2 caps2 = { DDSCAPS_PRIMARYSURFACE, 0, 0, 0 };
+
+        surf = This;
+        while(1)
         {
-            IDirectDrawSurface7_SetPalette(ICOM_INTERFACE(surf, IDirectDrawSurface7),
+            IDirectDrawSurface7 *attach;
+            HRESULT hr;
+            hr = IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(surf, IDirectDrawSurface7),
+                                                        &caps2, &attach);
+            if(hr != DD_OK)
+            {
+                break;
+            }
+
+            IDirectDrawSurface7_SetPalette(attach,
                                            Pal);
+            surf = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, attach);
+            IDirectDrawSurface7_Release(attach);
         }
     }
 




More information about the wine-cvs mailing list