test: Use SDL_CreateRGBSurfaceWithFormatFrom for SDLTest_ImageFace

Unlike the test images in the previous commit, this one is
4-bytes-per-pixel RGBA32, so the masks used here appear to be correct
for both endiannesses. Converting it to SDL_PIXELFORMAT_RGBA32 just
makes it more concise.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2024-01-10 10:26:47 +00:00 committed by Sam Lantinga
parent feaf52dba6
commit 1634a4cc30
1 changed files with 2 additions and 13 deletions

View File

@ -225,24 +225,13 @@ static const SDLTest_SurfaceImage_t SDLTest_imageFace = {
*/
SDL_Surface *SDLTest_ImageFace()
{
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom(
(void *)SDLTest_imageFace.pixel_data,
SDLTest_imageFace.width,
SDLTest_imageFace.height,
SDLTest_imageFace.bytes_per_pixel * 8,
SDLTest_imageFace.width * SDLTest_imageFace.bytes_per_pixel,
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
0xff000000, /* Red bit mask. */
0x00ff0000, /* Green bit mask. */
0x0000ff00, /* Blue bit mask. */
0x000000ff /* Alpha bit mask. */
#else
0x000000ff, /* Red bit mask. */
0x0000ff00, /* Green bit mask. */
0x00ff0000, /* Blue bit mask. */
0xff000000 /* Alpha bit mask. */
#endif
);
SDL_PIXELFORMAT_RGBA32);
return surface;
}