Skip to content

Commit

Permalink
SDL3 supports blitting with palette alpha now
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Dec 28, 2023
1 parent c6f46fe commit f201ed2
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/IMG_stb.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,7 @@ SDL_Surface *IMG_LoadSTB_RW(SDL_RWops *src)
}
}
if (has_alpha) {
#if 1 /* SDL doesn't support blitting with the palette alpha, so expand the palette */
SDL_Surface *converted = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_RGBA32);
SDL_DestroySurface(surface);
surface = converted;
#else
SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND);
#endif
} else if (has_colorkey) {
SDL_SetSurfaceColorKey(surface, SDL_TRUE, colorkey_index);
}
Expand All @@ -189,9 +183,7 @@ SDL_Surface *IMG_LoadSTB_RW(SDL_RWops *src)
* https://github.com/nothings/stb/issues/58
* -flibit
*/
if (surface) {
surface->flags &= ~SDL_PREALLOC;
}
surface->flags &= ~SDL_PREALLOC;
}

} else if (format == STBI_grey || format == STBI_rgb || format == STBI_rgb_alpha) {
Expand Down

0 comments on commit f201ed2

Please sign in to comment.