Alexander Dorofeyev : ddraw: Fix palette handling in IDirect3DTexture_Load.

Alexandre Julliard julliard at winehq.org
Tue Feb 19 08:05:13 CST 2008


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

Author: Alexander Dorofeyev <alexd4 at inbox.lv>
Date:   Sun Feb 17 17:36:46 2008 -0800

ddraw: Fix palette handling in IDirect3DTexture_Load.

This fixes a potential refcounting problem and makes the function fail with NULL
destination texture's palette and non-NULL source palette like it does on native.

---

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

diff --git a/dlls/ddraw/texture.c b/dlls/ddraw/texture.c
index 7542ef2..5d5bd52 100644
--- a/dlls/ddraw/texture.c
+++ b/dlls/ddraw/texture.c
@@ -365,15 +365,11 @@ IDirect3DTextureImpl_Load(IDirect3DTexture2 *iface,
             }
         }
 
-        /* After seeing some logs, not sure at all about this... */
-        if (pal == NULL)
-        {
-            IWineD3DSurface_SetPalette(This->WineD3DSurface, wine_pal);
-            if (pal_src != NULL) IDirectDrawPalette_AddRef(pal_src);
-        }
-        else if (pal_src != NULL)
+        if (pal_src != NULL)
         {
             PALETTEENTRY palent[256];
+
+            if (pal == NULL) return DDERR_NOPALETTEATTACHED;
             IDirectDrawPalette_GetEntries(pal_src, 0, 0, 256, palent);
             IDirectDrawPalette_SetEntries(pal, 0, 0, 256, palent);
         }




More information about the wine-cvs mailing list