Fixed bug 4264 - SDL_CreateTextureFromSurface generates error message but returns ok

Anthony @ POW Games

SDL_CreateTextureFromSurface makes an internal call to SDL_GetColorKey which can return an error and spams the error log with "Surface doesn't have a colorkey" even though the original function didn't return an error.
This commit is contained in:
Sam Lantinga 2018-09-24 16:41:55 -07:00
parent e5786b21c3
commit 3845ca6792
5 changed files with 24 additions and 1 deletions

View file

@ -292,6 +292,20 @@ SDL_SetColorKey(SDL_Surface * surface, int flag, Uint32 key)
return 0;
}
SDL_bool
SDL_HasColorKey(SDL_Surface * surface)
{
if (!surface) {
return SDL_FALSE;
}
if (!(surface->map->info.flags & SDL_COPY_COLORKEY)) {
return SDL_FALSE;
}
return SDL_TRUE;
}
int
SDL_GetColorKey(SDL_Surface * surface, Uint32 * key)
{