ddraw: Don't allow setting palette on non root surfaces.

This commit is contained in:
Ričardas Barkauskas 2011-08-08 01:26:00 +03:00 committed by Alexandre Julliard
parent 1a609ecab8
commit abf8728e1f
2 changed files with 6 additions and 1 deletions

View File

@ -4233,6 +4233,11 @@ static HRESULT WINAPI ddraw_surface7_SetPalette(IDirectDrawSurface7 *iface, IDir
return DDERR_INVALIDPIXELFORMAT; return DDERR_INVALIDPIXELFORMAT;
} }
if (!This->is_complex_root)
{
return DDERR_NOTONMIPMAPSUBLEVEL;
}
/* Find the old palette */ /* Find the old palette */
EnterCriticalSection(&ddraw_cs); EnterCriticalSection(&ddraw_cs);
hr = IDirectDrawSurface_GetPalette(iface, &oldPal); hr = IDirectDrawSurface_GetPalette(iface, &oldPal);

View File

@ -3006,7 +3006,7 @@ static void DeviceLoadTest(void)
ok(hr==DDERR_NOPALETTEATTACHED, "IDirectDrawSurface7_GetPalette returned: %x\n", hr); ok(hr==DDERR_NOPALETTEATTACHED, "IDirectDrawSurface7_GetPalette returned: %x\n", hr);
hr = IDirectDrawSurface7_SetPalette(texture_levels[0][1], palettes[1]); hr = IDirectDrawSurface7_SetPalette(texture_levels[0][1], palettes[1]);
todo_wine ok(hr==DDERR_NOTONMIPMAPSUBLEVEL, "IDirectDrawSurface7_SetPalette returned: %x\n", hr); ok(hr==DDERR_NOTONMIPMAPSUBLEVEL, "IDirectDrawSurface7_SetPalette returned: %x\n", hr);
hr = IDirectDrawSurface7_SetPalette(texture_levels[1][0], palettes[2]); hr = IDirectDrawSurface7_SetPalette(texture_levels[1][0], palettes[2]);
ok(hr==DD_OK, "IDirectDrawSurface7_SetPalette returned: %x\n", hr); ok(hr==DD_OK, "IDirectDrawSurface7_SetPalette returned: %x\n", hr);