# HG changeset patch # User Sam Lantinga # Date 1258440674 0 # Node ID 5271ce790fedef22178af3003bba809eeb79e04a # Parent e9502d56ae94e4bb32761e13635194fe3a48318f Debug info to help track down render test failures diff -r e9502d56ae94 -r 5271ce790fed test/automated/common/common.c --- a/test/automated/common/common.c Tue Nov 17 06:50:29 2009 +0000 +++ b/test/automated/common/common.c Tue Nov 17 06:51:14 2009 +0000 @@ -73,5 +73,37 @@ SDL_UnlockSurface( sur ); + if (ret) { + SDL_SaveBMP(sur, "fail.bmp"); + + SDL_LockSurface( sur ); + + bpp = sur->format->BytesPerPixel; + + /* Compare image - should be same format. */ + if (bpp == 4) { + for (j=0; jh; j++) { + for (i=0; iw; i++) { + p = (Uint8 *)sur->pixels + j * sur->pitch + i * bpp; + pd = (Uint8 *)img->pixel_data + (j*img->width + i) * img->bytes_per_pixel; + Uint8 R, G, B, A; + + R = pd[0]; + G = pd[1]; + B = pd[2]; + if (img->bytes_per_pixel == 4) { + A = pd[3]; + } else { + A = 0; + } + *(Uint32*)p = (A << 24) | (R << 16) | (G << 8) | B; + } + } + } + + SDL_UnlockSurface( sur ); + + SDL_SaveBMP(sur, "good.bmp"); + } return ret; } diff -r e9502d56ae94 -r 5271ce790fed test/automated/common/common.h --- a/test/automated/common/common.h Tue Nov 17 06:50:29 2009 +0000 +++ b/test/automated/common/common.h Tue Nov 17 06:51:14 2009 +0000 @@ -11,7 +11,7 @@ # define COMMON_H -# define FORMAT SDL_PIXELFORMAT_ARGB8888 +# define FORMAT SDL_PIXELFORMAT_ARGB8888 # define AMASK 0xff000000 /**< Alpha bit mask. */ # define RMASK 0x00ff0000 /**< Red bit mask. */ # define GMASK 0x0000ff00 /**< Green bit mask. */ diff -r e9502d56ae94 -r 5271ce790fed test/automated/render/render.c --- a/test/automated/render/render.c Tue Nov 17 06:50:29 2009 +0000 +++ b/test/automated/render/render.c Tue Nov 17 06:51:14 2009 +0000 @@ -67,6 +67,7 @@ return 1; /* Read pixels. */ + SDL_RenderPresent(); ret = SDL_RenderReadPixels( NULL, FORMAT, pix, 80*4 ); if (SDL_ATassert( "SDL_RenderReadPixels", ret==0) ) return 1; @@ -1012,7 +1013,7 @@ goto err; /* Create window. */ wid = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, - 80, 60, 0 ); + 80, 60, SDL_WINDOW_SHOWN ); if (SDL_ATassert( "SDL_CreateWindow", wid!=0 )) goto err; /* Check title. */