SDL/src/dynapi
Sam Lantinga d2676c2985 Fixed bug 2924 - SDL_CreateRGBSurface[From] versions that take SDL_PIXELFORMAT enum
Daniel Gibson

Currently, SDL_CreateRGBSurface() and SDL_CreateRGBSurfaceFrom() take Uint32 masks for RGBA to "describe" the Pixelformat of the surface.
Internally those value are only used to map to one of the SDL_PIXELFORMAT_* enum values that are used for further processing.

I think it would be both handy and more efficient to be able to specify SDL_PIXELFORMAT_* yourself without using SDL_PixelFormatEnumToMasks() to create masks first, so I implemented functions that do that:
SDL_CreateRGBSurfaceWithFormat() and SDL_CreateRGBSurfaceWithFormatFrom() which are like the versions without "WithFormat" but instead of taking 4 Uint32s for R/G/B/A masks, they take one for a SDL_PIXELFORMAT_* enum value.

Together with https://bugzilla.libsdl.org/show_bug.cgi?id=2923 creating a SDL_Surface* from RGBA data (e.g. from stb_image)  is as easy as
  surf = SDL_SDL_CreateRGBSurfaceWithFormat(0, w, h, bppToUse*8, SDL_PIXELFORMAT_RGBA32);
2016-10-07 17:04:58 -07:00
..
gendynapi.pl Updated copyright to 2016 2016-01-02 10:10:34 -08:00
SDL_dynapi.c Remove almost all instances of "volatile" keyword. 2016-01-03 06:50:50 -05:00
SDL_dynapi.h Fixed compile warnings about evaluating undefined identifiers. 2016-07-17 20:32:44 +02:00
SDL_dynapi_overrides.h Fixed bug 2924 - SDL_CreateRGBSurface[From] versions that take SDL_PIXELFORMAT enum 2016-10-07 17:04:58 -07:00
SDL_dynapi_procs.h Fixed bug 2924 - SDL_CreateRGBSurface[From] versions that take SDL_PIXELFORMAT enum 2016-10-07 17:04:58 -07:00