| Summary: | SDL_CreateTextureFromSurface generates error message but returns ok | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Anthony @ POW Games <ant> |
| Component: | render | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | minor | ||
| Priority: | P2 | CC: | sezeroz, sylvain.becker |
| Version: | 2.0.8 | ||
| Hardware: | All | ||
| OS: | All | ||
|
Description
Anthony @ POW Games
2018-09-20 10:14:01 UTC
This only started since 2.0.8 Generally you should ignore any error message if the function you're calling doesn't return a failure. However, I went ahead and added an API function to fix this: https://hg.libsdl.org/SDL/rev/5486557ca8d9 Hi,
In file src/render/SDL_render.c, no need of
- if (fmt->Amask || SDL_GetColorKey(surface, NULL) == 0) {
+ if (fmt->Amask || (SDL_HasColorKey(surface) && SDL_GetColorKey(surface, NULL) == 0)) {
because GetColorKey is not used to retrieve the color key, so only:
- if (fmt->Amask || SDL_GetColorKey(surface, NULL) == 0) {
+ if (fmt->Amask || SDL_HasColorKey(surface)) {
Oh good catch, thanks! https://hg.libsdl.org/SDL/rev/90162273424f |