Fixed bug 2923 - Add SDL_PIXELFORMAT_RGBA32 for byte-wise 32bit RGBA data

Daniel Gibson

Ok, I followed the simple approach of just making SDL_PIXELFORMAT_RGBA32 an alias of SDL_PIXELFORMAT_RGBA8888/SDL_PIXELFORMAT_ABGR8888, depending on endianess. And I did the same for SDL_PIXELFORMAT_ARGB32, .._BGRA, .._ABGR.

SDL_GetPixelFormatName() will of course return SDL_PIXELFORMAT_RGBA8888 (or SDL_PIXELFORMAT_ABGR8888) instead of SDL_PIXELFORMAT_RGBA32, but as long as that's mentioned in the docs it shouldn't be a problem.
This commit is contained in:
Sam Lantinga 2016-10-11 23:19:05 -07:00
parent 8a0704d15f
commit 36e40d30fc
4 changed files with 17 additions and 22 deletions

View file

@ -444,14 +444,7 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery,
*/
rz_src = src;
} else {
Uint32 format = SDL_MasksToPixelFormatEnum(32,
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000
#else
0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff
#endif
);
rz_src = SDL_ConvertSurfaceFormat(src, format, src->flags);
rz_src = SDL_ConvertSurfaceFormat(src, SDL_PIXELFORMAT_ARGB32, src->flags);
if (rz_src == NULL) {
return NULL;
}