Skip to content

Commit

Permalink
Revert "Fix endian-related testautomation issues (invalid surface pit…
Browse files Browse the repository at this point in the history
…ch and surface comparison errors)"

This reverts commit 22ef755.
  • Loading branch information
capehill committed Oct 4, 2023
1 parent b191712 commit f330308
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 70 deletions.
43 changes: 15 additions & 28 deletions src/test/SDL_test_imageBlit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -562,18 +549,18 @@ 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. */
0x00ff0000, /* Blue bit mask. */
0xff000000 /* Alpha bit mask. */
#endif
);
return SDLTest_ConvertToRGBA(surface);
return surface;
}

static const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = {
Expand Down Expand Up @@ -1047,18 +1034,18 @@ 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. */
0x00ff0000, /* Blue bit mask. */
0xff000000 /* Alpha bit mask. */
#endif
);
return SDLTest_ConvertToRGBA(surface);
return surface;
}

static const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = {
Expand Down Expand Up @@ -1695,18 +1682,18 @@ 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. */
0x00ff0000, /* Blue bit mask. */
0xff000000 /* Alpha bit mask. */
#endif
);
return SDLTest_ConvertToRGBA(surface);
return surface;
}

/* vi: set ts=4 sw=4 expandtab: */
53 changes: 25 additions & 28 deletions src/test/SDL_test_imageBlitBlend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -591,19 +589,18 @@ 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. */
0x00ff0000, /* Blue bit mask. */
0xff000000 /* Alpha bit mask. */
#endif
);

return SDLTest_ConvertToRGBA(surface);
return surface;
}

static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = {
Expand Down Expand Up @@ -1194,18 +1191,18 @@ 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. */
0x00ff0000, /* Blue bit mask. */
0xff000000 /* Alpha bit mask. */
#endif
);
return SDLTest_ConvertToRGBA(surface);
return surface;
}

static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = {
Expand Down Expand Up @@ -1626,18 +1623,18 @@ 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. */
0x00ff0000, /* Blue bit mask. */
0xff000000 /* Alpha bit mask. */
#endif
);
return SDLTest_ConvertToRGBA(surface);
return surface;
}

static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = {
Expand Down Expand Up @@ -2441,18 +2438,18 @@ 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. */
0x00ff0000, /* Blue bit mask. */
0xff000000 /* Alpha bit mask. */
#endif
);
return SDLTest_ConvertToRGBA(surface);
return surface;
}

static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = {
Expand Down Expand Up @@ -2988,18 +2985,18 @@ 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. */
0x00ff0000, /* Blue bit mask. */
0xff000000 /* Alpha bit mask. */
#endif
);
return SDLTest_ConvertToRGBA(surface);
return surface;
}

/* vi: set ts=4 sw=4 expandtab: */
12 changes: 5 additions & 7 deletions src/test/SDL_test_imagePrimitives.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -515,18 +513,18 @@ 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. */
0x00ff0000, /* Blue bit mask. */
0xff000000 /* Alpha bit mask. */
#endif
);
return SDLTest_ConvertToRGBA(surface);
return surface;
}

/* vi: set ts=4 sw=4 expandtab: */
12 changes: 5 additions & 7 deletions src/test/SDL_test_imagePrimitivesBlend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -688,18 +686,18 @@ 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. */
0x00ff0000, /* Blue bit mask. */
0xff000000 /* Alpha bit mask. */
#endif
);
return SDLTest_ConvertToRGBA(surface);
return surface;
}

/* vi: set ts=4 sw=4 expandtab: */

0 comments on commit f330308

Please sign in to comment.