Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed endianness of the face image surface
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Nov 18, 2009
1 parent 58629b5 commit 78c8da2
Showing 1 changed file with 61 additions and 6 deletions.
67 changes: 61 additions & 6 deletions test/automated/render/render.c
Expand Up @@ -74,7 +74,7 @@ static int render_compare( const char *msg, const SurfaceImage_t *s )

/* Create surface. */
testsur = SDL_CreateRGBSurfaceFrom( pix, 80, 60, 32, 80*4,
RMASK, GMASK, BMASK, AMASK );
RMASK, GMASK, BMASK, AMASK);
if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", testsur!=NULL ))
return 1;

Expand Down Expand Up @@ -204,7 +204,18 @@ static SDL_TextureID render_loadTestFace (void)
/* Create face surface. */
face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
img_face.width, img_face.height, 32, img_face.width*4,
RMASK, GMASK, BMASK, AMASK );
#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
);
if (face == NULL)
return 0;
tface = SDL_CreateTextureFromSurface( 0, face );
Expand Down Expand Up @@ -547,7 +558,18 @@ static int render_testBlit (void)
/* Create face surface. */
face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
img_face.width, img_face.height, 32, img_face.width*4,
RMASK, GMASK, BMASK, AMASK );
#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
);
if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
return -1;
tface = SDL_CreateTextureFromSurface( 0, face );
Expand Down Expand Up @@ -608,7 +630,18 @@ static int render_testBlitColour (void)
/* Create face surface. */
face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
img_face.width, img_face.height, 32, img_face.width*4,
RMASK, GMASK, BMASK, AMASK );
#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
);
if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
return -1;
tface = SDL_CreateTextureFromSurface( 0, face );
Expand Down Expand Up @@ -675,7 +708,18 @@ static int render_testBlitAlpha (void)
/* Create face surface. */
face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
img_face.width, img_face.height, 32, img_face.width*4,
RMASK, GMASK, BMASK, AMASK );
#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
);
if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
return -1;
tface = SDL_CreateTextureFromSurface( 0, face );
Expand Down Expand Up @@ -789,7 +833,18 @@ static int render_testBlitBlend (void)
/* Create face surface. */
face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
img_face.width, img_face.height, 32, img_face.width*4,
RMASK, GMASK, BMASK, AMASK );
#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
);
if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
return -1;
tface = SDL_CreateTextureFromSurface( 0, face );
Expand Down

0 comments on commit 78c8da2

Please sign in to comment.