comparison test/automated/common/common.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 5271ce790fed
comparison
equal deleted inserted replaced
3438:ca5663493497 3439:0acec8c9f5c9
44 ret += 1; 44 ret += 1;
45 printf("%d BPP not supported yet.\n",bpp); 45 printf("%d BPP not supported yet.\n",bpp);
46 break; 46 break;
47 47
48 case 4: 48 case 4:
49 ret += !( (p[0] == pd[0]) && 49 {
50 (p[1] == pd[1]) && 50 int fail;
51 (p[2] == pd[2]) ); 51 Uint8 R, G, B, A;
52
53 SDL_GetRGBA(*(Uint32*)p, sur->format, &R, &G, &B, &A);
54
55 if (img->bytes_per_pixel == 3) {
56 fail = !( (R == pd[0]) &&
57 (G == pd[1]) &&
58 (B == pd[2]) );
59 } else {
60 fail = !( (R == pd[0]) &&
61 (G == pd[1]) &&
62 (B == pd[2]) &&
63 (A == pd[3]) );
64 }
65 if (fail) {
66 ++ret;
67 }
68 }
52 break; 69 break;
53 } 70 }
54 } 71 }
55 } 72 }
56 73