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.
This commit is contained in:
Alexander Dorofeyev 2008-02-17 17:36:46 -08:00 committed by Alexandre Julliard
parent ddd0ec1670
commit ed44f9d130
1 changed files with 3 additions and 7 deletions

View File

@ -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);
}