Commit 86dbbd0d authored by Sam Lantinga's avatar Sam Lantinga

Fixed endianness of the face image surface

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404185
parent 87442cb4
...@@ -74,7 +74,7 @@ static int render_compare( const char *msg, const SurfaceImage_t *s ) ...@@ -74,7 +74,7 @@ static int render_compare( const char *msg, const SurfaceImage_t *s )
/* Create surface. */ /* Create surface. */
testsur = SDL_CreateRGBSurfaceFrom( pix, 80, 60, 32, 80*4, testsur = SDL_CreateRGBSurfaceFrom( pix, 80, 60, 32, 80*4,
RMASK, GMASK, BMASK, AMASK ); RMASK, GMASK, BMASK, AMASK);
if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", testsur!=NULL )) if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", testsur!=NULL ))
return 1; return 1;
...@@ -204,7 +204,18 @@ static SDL_TextureID render_loadTestFace (void) ...@@ -204,7 +204,18 @@ static SDL_TextureID render_loadTestFace (void)
/* Create face surface. */ /* Create face surface. */
face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data, face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
img_face.width, img_face.height, 32, img_face.width*4, 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) if (face == NULL)
return 0; return 0;
tface = SDL_CreateTextureFromSurface( 0, face ); tface = SDL_CreateTextureFromSurface( 0, face );
...@@ -547,7 +558,18 @@ static int render_testBlit (void) ...@@ -547,7 +558,18 @@ static int render_testBlit (void)
/* Create face surface. */ /* Create face surface. */
face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data, face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
img_face.width, img_face.height, 32, img_face.width*4, 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)) if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
return -1; return -1;
tface = SDL_CreateTextureFromSurface( 0, face ); tface = SDL_CreateTextureFromSurface( 0, face );
...@@ -608,7 +630,18 @@ static int render_testBlitColour (void) ...@@ -608,7 +630,18 @@ static int render_testBlitColour (void)
/* Create face surface. */ /* Create face surface. */
face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data, face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
img_face.width, img_face.height, 32, img_face.width*4, 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)) if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
return -1; return -1;
tface = SDL_CreateTextureFromSurface( 0, face ); tface = SDL_CreateTextureFromSurface( 0, face );
...@@ -675,7 +708,18 @@ static int render_testBlitAlpha (void) ...@@ -675,7 +708,18 @@ static int render_testBlitAlpha (void)
/* Create face surface. */ /* Create face surface. */
face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data, face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
img_face.width, img_face.height, 32, img_face.width*4, 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)) if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
return -1; return -1;
tface = SDL_CreateTextureFromSurface( 0, face ); tface = SDL_CreateTextureFromSurface( 0, face );
...@@ -789,7 +833,18 @@ static int render_testBlitBlend (void) ...@@ -789,7 +833,18 @@ static int render_testBlitBlend (void)
/* Create face surface. */ /* Create face surface. */
face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data, face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
img_face.width, img_face.height, 32, img_face.width*4, 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)) if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
return -1; return -1;
tface = SDL_CreateTextureFromSurface( 0, face ); tface = SDL_CreateTextureFromSurface( 0, face );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment