We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3306

Summary: Any Blitting from a 16-Color Palette Always Fails
Product: SDL Reporter: LRFLEW <lrflew>
Component: videoAssignee: Sam Lantinga <slouken>
Status: NEW --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.4   
Hardware: All   
OS: All   

Description LRFLEW 2016-04-11 08:07:32 UTC
I ran into a problem trying to use an image stored using a 16-Color (4-bit) palette as a texture. No matter what I did, the resulting texture was empty. This issue continued even if I first used SDL_ConvertSurface or even SDL_BlitSurface. I ended up stepping through the code to find the problem. In SDL_CalculateBlit, it will first try to use SDL_CalculateBlit0 to get a blit function for the surface, but since the first thing that function does is return NULL if it isn't a 2-Color (1-bit) palette. The rest of SDL_CalculateBlit will attempt to find a relevant function, but can only search RGB-based format conversions. The blit fails with the error "Blit combination not supported".

Since the format is a core format in the library, it would make sense to me to implement it. If, however, there are no plans to implement it, then this issue should at least cover the fact that both SDL_ConvertSurface and SDL_CreateTextureFromSurface don't provide any indication when the blit fails. They both return non-null empty images when the blit fails, instead of the error-indicating NULL value.