Fixed endianness of the face image surface
authorSam Lantinga
Wed, 18 Nov 2009 07:22:22 +0000
changeset 344450fca98abc24
parent 3443 7f477a22dff5
child 3445 de72b49bb695
Fixed endianness of the face image surface
test/automated/render/render.c
     1.1 --- a/test/automated/render/render.c	Wed Nov 18 06:15:44 2009 +0000
     1.2 +++ b/test/automated/render/render.c	Wed Nov 18 07:22:22 2009 +0000
     1.3 @@ -74,7 +74,7 @@
     1.4  
     1.5     /* Create surface. */
     1.6     testsur = SDL_CreateRGBSurfaceFrom( pix, 80, 60, 32, 80*4,
     1.7 -         RMASK, GMASK, BMASK, AMASK );
     1.8 +                                       RMASK, GMASK, BMASK, AMASK);
     1.9     if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", testsur!=NULL ))
    1.10        return 1;
    1.11  
    1.12 @@ -204,7 +204,18 @@
    1.13     /* Create face surface. */
    1.14     face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
    1.15           img_face.width, img_face.height, 32, img_face.width*4,
    1.16 -         RMASK, GMASK, BMASK, AMASK );
    1.17 +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
    1.18 +         0xff000000, /* Red bit mask. */
    1.19 +         0x00ff0000, /* Green bit mask. */
    1.20 +         0x0000ff00, /* Blue bit mask. */
    1.21 +         0x000000ff /* Alpha bit mask. */
    1.22 +#else
    1.23 +         0x000000ff, /* Red bit mask. */
    1.24 +         0x0000ff00, /* Green bit mask. */
    1.25 +         0x00ff0000, /* Blue bit mask. */
    1.26 +         0xff000000 /* Alpha bit mask. */
    1.27 +#endif
    1.28 +         );
    1.29     if (face == NULL)
    1.30        return 0;
    1.31     tface = SDL_CreateTextureFromSurface( 0, face );
    1.32 @@ -547,7 +558,18 @@
    1.33     /* Create face surface. */
    1.34     face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
    1.35           img_face.width, img_face.height, 32, img_face.width*4,
    1.36 -         RMASK, GMASK, BMASK, AMASK );
    1.37 +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
    1.38 +         0xff000000, /* Red bit mask. */
    1.39 +         0x00ff0000, /* Green bit mask. */
    1.40 +         0x0000ff00, /* Blue bit mask. */
    1.41 +         0x000000ff /* Alpha bit mask. */
    1.42 +#else
    1.43 +         0x000000ff, /* Red bit mask. */
    1.44 +         0x0000ff00, /* Green bit mask. */
    1.45 +         0x00ff0000, /* Blue bit mask. */
    1.46 +         0xff000000 /* Alpha bit mask. */
    1.47 +#endif
    1.48 +         );
    1.49     if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
    1.50        return -1;
    1.51     tface = SDL_CreateTextureFromSurface( 0, face );
    1.52 @@ -608,7 +630,18 @@
    1.53     /* Create face surface. */
    1.54     face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
    1.55           img_face.width, img_face.height, 32, img_face.width*4,
    1.56 -         RMASK, GMASK, BMASK, AMASK );
    1.57 +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
    1.58 +         0xff000000, /* Red bit mask. */
    1.59 +         0x00ff0000, /* Green bit mask. */
    1.60 +         0x0000ff00, /* Blue bit mask. */
    1.61 +         0x000000ff /* Alpha bit mask. */
    1.62 +#else
    1.63 +         0x000000ff, /* Red bit mask. */
    1.64 +         0x0000ff00, /* Green bit mask. */
    1.65 +         0x00ff0000, /* Blue bit mask. */
    1.66 +         0xff000000 /* Alpha bit mask. */
    1.67 +#endif
    1.68 +         );
    1.69     if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
    1.70        return -1;
    1.71     tface = SDL_CreateTextureFromSurface( 0, face );
    1.72 @@ -675,7 +708,18 @@
    1.73     /* Create face surface. */
    1.74     face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
    1.75           img_face.width, img_face.height, 32, img_face.width*4,
    1.76 -         RMASK, GMASK, BMASK, AMASK );
    1.77 +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
    1.78 +         0xff000000, /* Red bit mask. */
    1.79 +         0x00ff0000, /* Green bit mask. */
    1.80 +         0x0000ff00, /* Blue bit mask. */
    1.81 +         0x000000ff /* Alpha bit mask. */
    1.82 +#else
    1.83 +         0x000000ff, /* Red bit mask. */
    1.84 +         0x0000ff00, /* Green bit mask. */
    1.85 +         0x00ff0000, /* Blue bit mask. */
    1.86 +         0xff000000 /* Alpha bit mask. */
    1.87 +#endif
    1.88 +         );
    1.89     if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
    1.90        return -1;
    1.91     tface = SDL_CreateTextureFromSurface( 0, face );
    1.92 @@ -789,7 +833,18 @@
    1.93     /* Create face surface. */
    1.94     face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
    1.95           img_face.width, img_face.height, 32, img_face.width*4,
    1.96 -         RMASK, GMASK, BMASK, AMASK );
    1.97 +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
    1.98 +         0xff000000, /* Red bit mask. */
    1.99 +         0x00ff0000, /* Green bit mask. */
   1.100 +         0x0000ff00, /* Blue bit mask. */
   1.101 +         0x000000ff /* Alpha bit mask. */
   1.102 +#else
   1.103 +         0x000000ff, /* Red bit mask. */
   1.104 +         0x0000ff00, /* Green bit mask. */
   1.105 +         0x00ff0000, /* Blue bit mask. */
   1.106 +         0xff000000 /* Alpha bit mask. */
   1.107 +#endif
   1.108 +         );
   1.109     if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
   1.110        return -1;
   1.111     tface = SDL_CreateTextureFromSurface( 0, face );