From 1634a4cc30df793e9e2e498e6894bf4d7c5f628a Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 10 Jan 2024 10:26:47 +0000 Subject: [PATCH] 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 --- src/test/SDL_test_imageFace.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/test/SDL_test_imageFace.c b/src/test/SDL_test_imageFace.c index d4c778ca9..255acadde 100644 --- a/src/test/SDL_test_imageFace.c +++ b/src/test/SDL_test_imageFace.c @@ -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; }