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 committed 2018-09-24 16:41:55 -07:00
1 parent cd90e2ca58
commit ef34704875
5 files changed
+24 -1

No files matched your search

+1 -1
View File
@@ -649,7 +649,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface)
/* See what the best texture format is */
fmt = surface->format;
if (fmt->Amask || SDL_GetColorKey(surface, NULL) == 0) {
if (fmt->Amask || (SDL_HasColorKey(surface) && SDL_GetColorKey(surface, NULL) == 0)) {
needAlpha = SDL_TRUE;
} else {
needAlpha = SDL_FALSE;