comparison test/automated/surface/surface.c @ 3439:0acec8c9f5c9

Fixed some bugs in the automated test suite, revealed by working SDL_RenderReadPixels()
author Sam Lantinga <slouken@libsdl.org>
date Tue, 17 Nov 2009 05:17:11 +0000
parents 22ac66da0765
children da53c4046c65
comparison
equal deleted inserted replaced
3438:ca5663493497 3439:0acec8c9f5c9
93 93
94 /* Clear surface. */ 94 /* Clear surface. */
95 ret = SDL_FillRect( testsur, NULL, 95 ret = SDL_FillRect( testsur, NULL,
96 SDL_MapRGB( testsur->format, 0, 0, 0 ) ); 96 SDL_MapRGB( testsur->format, 0, 0, 0 ) );
97 if (SDL_ATassert( "SDL_FillRect", ret == 0)) 97 if (SDL_ATassert( "SDL_FillRect", ret == 0))
98 return;
99
100 /* Create the surface. */
101 testsur = SDL_CreateRGBSurface( 0, 80, 60, 32,
102 RMASK, GMASK, BMASK, AMASK );
103 if (SDL_ATassert( "SDL_CreateRGBSurface", testsur != NULL))
104 return; 98 return;
105 99
106 /* Draw a rectangle. */ 100 /* Draw a rectangle. */
107 rect.x = 40; 101 rect.x = 40;
108 rect.y = 0; 102 rect.y = 0;
261 return; 255 return;
262 256
263 /* Create face surface. */ 257 /* Create face surface. */
264 face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data, 258 face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
265 img_face.width, img_face.height, 32, img_face.width*4, 259 img_face.width, img_face.height, 32, img_face.width*4,
266 RMASK, GMASK, BMASK, AMASK ); 260 #if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
261 0xff000000, /* Red bit mask. */
262 0x00ff0000, /* Green bit mask. */
263 0x0000ff00, /* Blue bit mask. */
264 0x000000ff /* Alpha bit mask. */
265 #else
266 0x000000ff, /* Red bit mask. */
267 0x0000ff00, /* Green bit mask. */
268 0x00ff0000, /* Blue bit mask. */
269 0xff000000 /* Alpha bit mask. */
270 #endif
271 );
267 if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL)) 272 if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
268 return; 273 return;
269 274
270 /* Constant values. */ 275 /* Constant values. */
271 rect.w = face->w; 276 rect.w = face->w;
422 return; 427 return;
423 428
424 /* Create the blit surface. */ 429 /* Create the blit surface. */
425 face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data, 430 face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
426 img_face.width, img_face.height, 32, img_face.width*4, 431 img_face.width, img_face.height, 32, img_face.width*4,
427 RMASK, GMASK, BMASK, AMASK ); 432 #if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
433 0xff000000, /* Red bit mask. */
434 0x00ff0000, /* Green bit mask. */
435 0x0000ff00, /* Blue bit mask. */
436 0x000000ff /* Alpha bit mask. */
437 #else
438 0x000000ff, /* Red bit mask. */
439 0x0000ff00, /* Green bit mask. */
440 0x00ff0000, /* Blue bit mask. */
441 0xff000000 /* Alpha bit mask. */
442 #endif
443 );
428 if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL)) 444 if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
429 return; 445 return;
430 446
431 /* Set alpha mod. */ 447 /* Set alpha mod. */
432 ret = SDL_SetSurfaceAlphaMod( face, 100 ); 448 ret = SDL_SetSurfaceAlphaMod( face, 100 );