ddraw: Make SetPalette fail for non-palettized surfaces.

This commit is contained in:
Alexander Dorofeyev 2008-03-23 01:59:01 +02:00 committed by Alexandre Julliard
parent cb9252db36
commit 4b53dde0f5
1 changed files with 5 additions and 0 deletions

View File

@ -2501,6 +2501,11 @@ IDirectDrawSurfaceImpl_SetPalette(IDirectDrawSurface7 *iface,
HRESULT hr;
TRACE("(%p)->(%p)\n", This, Pal);
if (!(This->surface_desc.u4.ddpfPixelFormat.dwFlags & (DDPF_PALETTEINDEXED1 | DDPF_PALETTEINDEXED2 |
DDPF_PALETTEINDEXED4 | DDPF_PALETTEINDEXED8 | DDPF_PALETTEINDEXEDTO8))) {
return DDERR_INVALIDPIXELFORMAT;
}
/* Find the old palette */
EnterCriticalSection(&ddraw_cs);
hr = IDirectDrawSurface_GetPalette(iface, &oldPal);