comparison test/automated/common/common.c @ 3441:5271ce790fed

Debug info to help track down render test failures
author Sam Lantinga <slouken@libsdl.org>
date Tue, 17 Nov 2009 06:51:14 +0000
parents 0acec8c9f5c9
children 6b182cbe38ac
comparison
equal deleted inserted replaced
3440:e9502d56ae94 3441:5271ce790fed
71 } 71 }
72 } 72 }
73 73
74 SDL_UnlockSurface( sur ); 74 SDL_UnlockSurface( sur );
75 75
76 if (ret) {
77 SDL_SaveBMP(sur, "fail.bmp");
78
79 SDL_LockSurface( sur );
80
81 bpp = sur->format->BytesPerPixel;
82
83 /* Compare image - should be same format. */
84 if (bpp == 4) {
85 for (j=0; j<sur->h; j++) {
86 for (i=0; i<sur->w; i++) {
87 p = (Uint8 *)sur->pixels + j * sur->pitch + i * bpp;
88 pd = (Uint8 *)img->pixel_data + (j*img->width + i) * img->bytes_per_pixel;
89 Uint8 R, G, B, A;
90
91 R = pd[0];
92 G = pd[1];
93 B = pd[2];
94 if (img->bytes_per_pixel == 4) {
95 A = pd[3];
96 } else {
97 A = 0;
98 }
99 *(Uint32*)p = (A << 24) | (R << 16) | (G << 8) | B;
100 }
101 }
102 }
103
104 SDL_UnlockSurface( sur );
105
106 SDL_SaveBMP(sur, "good.bmp");
107 }
76 return ret; 108 return ret;
77 } 109 }