From f3303081451b49764d881f00b7709a289a62a640 Mon Sep 17 00:00:00 2001 From: capehill Date: Sat, 30 Sep 2023 13:40:21 +0300 Subject: [PATCH] Revert "Fix endian-related testautomation issues (invalid surface pitch and surface comparison errors)" This reverts commit 22ef755705c14f3fecd0e736c2d598ee207620a5. --- src/test/SDL_test_imageBlit.c | 43 +++++++------------ src/test/SDL_test_imageBlitBlend.c | 53 +++++++++++------------- src/test/SDL_test_imagePrimitives.c | 12 +++--- src/test/SDL_test_imagePrimitivesBlend.c | 12 +++--- 4 files changed, 50 insertions(+), 70 deletions(-) diff --git a/src/test/SDL_test_imageBlit.c b/src/test/SDL_test_imageBlit.c index b0c88c7c910c0..6e4a923321940 100644 --- a/src/test/SDL_test_imageBlit.c +++ b/src/test/SDL_test_imageBlit.c @@ -22,19 +22,6 @@ #include "SDL_test.h" -/* Test surface is 32-bit, reference surface 24-bit and surface comparison doesn't work in big endian. - Convert reference surfaces to 32-bit. */ -SDL_Surface* -SDLTest_ConvertToRGBA(SDL_Surface * surface) -{ - SDL_Surface* converted = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_RGBA8888, 0); - if (converted) { - SDL_FreeSurface(surface); - surface = converted; - } - return surface; -} - /* GIMP RGB C-Source image dump (blit.c) */ static const SDLTest_SurfaceImage_t SDLTest_imageBlit = { @@ -562,10 +549,10 @@ SDL_Surface *SDLTest_ImageBlit() SDLTest_imageBlit.bytes_per_pixel * 8, SDLTest_imageBlit.width * SDLTest_imageBlit.bytes_per_pixel, #if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0x00ff0000, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x000000ff, /* Blue bit mask. */ - 0x00000000 /* Alpha bit mask. */ + 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. */ @@ -573,7 +560,7 @@ SDL_Surface *SDLTest_ImageBlit() 0xff000000 /* Alpha bit mask. */ #endif ); - return SDLTest_ConvertToRGBA(surface); + return surface; } static const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = { @@ -1047,10 +1034,10 @@ SDL_Surface *SDLTest_ImageBlitColor() SDLTest_imageBlitColor.bytes_per_pixel * 8, SDLTest_imageBlitColor.width * SDLTest_imageBlitColor.bytes_per_pixel, #if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0x00ff0000, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x000000ff, /* Blue bit mask. */ - 0x00000000 /* Alpha bit mask. */ + 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. */ @@ -1058,7 +1045,7 @@ SDL_Surface *SDLTest_ImageBlitColor() 0xff000000 /* Alpha bit mask. */ #endif ); - return SDLTest_ConvertToRGBA(surface); + return surface; } static const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = { @@ -1695,10 +1682,10 @@ SDL_Surface *SDLTest_ImageBlitAlpha() SDLTest_imageBlitAlpha.bytes_per_pixel * 8, SDLTest_imageBlitAlpha.width * SDLTest_imageBlitAlpha.bytes_per_pixel, #if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0x00ff0000, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x000000ff, /* Blue bit mask. */ - 0x00000000 /* Alpha bit mask. */ + 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. */ @@ -1706,7 +1693,7 @@ SDL_Surface *SDLTest_ImageBlitAlpha() 0xff000000 /* Alpha bit mask. */ #endif ); - return SDLTest_ConvertToRGBA(surface); + return surface; } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/test/SDL_test_imageBlitBlend.c b/src/test/SDL_test_imageBlitBlend.c index 55f93a474f47f..6f447fbe8f9a2 100644 --- a/src/test/SDL_test_imageBlitBlend.c +++ b/src/test/SDL_test_imageBlitBlend.c @@ -22,8 +22,6 @@ #include "SDL_test.h" -extern SDL_Surface* SDLTest_ConvertToRGBA(SDL_Surface * surface); - /* GIMP RGB C-Source image dump (alpha.c) */ static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd = { @@ -591,10 +589,10 @@ SDL_Surface *SDLTest_ImageBlitBlendAdd() SDLTest_imageBlitBlendAdd.bytes_per_pixel * 8, SDLTest_imageBlitBlendAdd.width * SDLTest_imageBlitBlendAdd.bytes_per_pixel, #if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0x00ff0000, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x000000ff, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ + 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. */ @@ -602,8 +600,7 @@ SDL_Surface *SDLTest_ImageBlitBlendAdd() 0xff000000 /* Alpha bit mask. */ #endif ); - - return SDLTest_ConvertToRGBA(surface); + return surface; } static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = { @@ -1194,10 +1191,10 @@ SDL_Surface *SDLTest_ImageBlitBlend() SDLTest_imageBlitBlend.bytes_per_pixel * 8, SDLTest_imageBlitBlend.width * SDLTest_imageBlitBlend.bytes_per_pixel, #if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0x00ff0000, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x000000ff, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ + 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. */ @@ -1205,7 +1202,7 @@ SDL_Surface *SDLTest_ImageBlitBlend() 0xff000000 /* Alpha bit mask. */ #endif ); - return SDLTest_ConvertToRGBA(surface); + return surface; } static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = { @@ -1626,10 +1623,10 @@ SDL_Surface *SDLTest_ImageBlitBlendMod() SDLTest_imageBlitBlendMod.bytes_per_pixel * 8, SDLTest_imageBlitBlendMod.width * SDLTest_imageBlitBlendMod.bytes_per_pixel, #if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0x00ff0000, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x000000ff, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ + 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. */ @@ -1637,7 +1634,7 @@ SDL_Surface *SDLTest_ImageBlitBlendMod() 0xff000000 /* Alpha bit mask. */ #endif ); - return SDLTest_ConvertToRGBA(surface); + return surface; } static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = { @@ -2441,10 +2438,10 @@ SDL_Surface *SDLTest_ImageBlitBlendNone() SDLTest_imageBlitBlendNone.bytes_per_pixel * 8, SDLTest_imageBlitBlendNone.width * SDLTest_imageBlitBlendNone.bytes_per_pixel, #if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0x00ff0000, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x000000ff, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ + 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. */ @@ -2452,7 +2449,7 @@ SDL_Surface *SDLTest_ImageBlitBlendNone() 0xff000000 /* Alpha bit mask. */ #endif ); - return SDLTest_ConvertToRGBA(surface); + return surface; } static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = { @@ -2988,10 +2985,10 @@ SDL_Surface *SDLTest_ImageBlitBlendAll() SDLTest_imageBlitBlendAll.bytes_per_pixel * 8, SDLTest_imageBlitBlendAll.width * SDLTest_imageBlitBlendAll.bytes_per_pixel, #if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0x00ff0000, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x000000ff, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ + 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. */ @@ -2999,7 +2996,7 @@ SDL_Surface *SDLTest_ImageBlitBlendAll() 0xff000000 /* Alpha bit mask. */ #endif ); - return SDLTest_ConvertToRGBA(surface); + return surface; } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/test/SDL_test_imagePrimitives.c b/src/test/SDL_test_imagePrimitives.c index be545651450e3..248e0d37fb789 100644 --- a/src/test/SDL_test_imagePrimitives.c +++ b/src/test/SDL_test_imagePrimitives.c @@ -22,8 +22,6 @@ #include "SDL_test.h" -extern SDL_Surface* SDLTest_ConvertToRGBA(SDL_Surface * surface); - /* GIMP RGB C-Source image dump (primitives.c) */ static const SDLTest_SurfaceImage_t SDLTest_imagePrimitives = { @@ -515,10 +513,10 @@ SDL_Surface *SDLTest_ImagePrimitives() SDLTest_imagePrimitives.bytes_per_pixel * 8, SDLTest_imagePrimitives.width * SDLTest_imagePrimitives.bytes_per_pixel, #if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0x00ff0000, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x000000ff, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ + 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. */ @@ -526,7 +524,7 @@ SDL_Surface *SDLTest_ImagePrimitives() 0xff000000 /* Alpha bit mask. */ #endif ); - return SDLTest_ConvertToRGBA(surface); + return surface; } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/test/SDL_test_imagePrimitivesBlend.c b/src/test/SDL_test_imagePrimitivesBlend.c index 8a8f483d9057e..2bb67faf29c36 100644 --- a/src/test/SDL_test_imagePrimitivesBlend.c +++ b/src/test/SDL_test_imagePrimitivesBlend.c @@ -22,8 +22,6 @@ #include "SDL_test.h" -extern SDL_Surface* SDLTest_ConvertToRGBA(SDL_Surface * surface); - /* GIMP RGB C-Source image dump (alpha.c) */ static const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend = { @@ -688,10 +686,10 @@ SDL_Surface *SDLTest_ImagePrimitivesBlend() SDLTest_imagePrimitivesBlend.bytes_per_pixel * 8, SDLTest_imagePrimitivesBlend.width * SDLTest_imagePrimitivesBlend.bytes_per_pixel, #if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0x00ff0000, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x000000ff, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ + 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. */ @@ -699,7 +697,7 @@ SDL_Surface *SDLTest_ImagePrimitivesBlend() 0xff000000 /* Alpha bit mask. */ #endif ); - return SDLTest_ConvertToRGBA(surface); + return surface; } /* vi: set ts=4 sw=4 expandtab: */