mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-04 19:55:19 +00:00
Allow setting NULL palette on any surface
Fixes https://github.com/libsdl-org/SDL/issues/15654
This commit is contained in:
parent
f19dca3ca0
commit
cfed9b3aca
1 changed files with 5 additions and 1 deletions
|
|
@ -423,10 +423,14 @@ SDL_Palette *SDL_CreateSurfacePalette(SDL_Surface *surface)
|
|||
|
||||
bool SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette)
|
||||
{
|
||||
CHECK_PARAM(!SDL_SurfaceValid(surface) || !SDL_ISPIXELFORMAT_INDEXED(surface->format)) {
|
||||
CHECK_PARAM(!SDL_SurfaceValid(surface)) {
|
||||
return SDL_InvalidParamError("surface");
|
||||
}
|
||||
|
||||
CHECK_PARAM(palette && !SDL_ISPIXELFORMAT_INDEXED(surface->format)) {
|
||||
return SDL_SetError("Surface doesn't use a palette");
|
||||
}
|
||||
|
||||
CHECK_PARAM(palette && palette->ncolors > (1 << SDL_BITSPERPIXEL(surface->format))) {
|
||||
return SDL_SetError("Palette doesn't match surface format");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue