Mercurial > sdl-ios-xcode
comparison test/automated/common/common.c @ 3477:2c07bb579922
We want to be strict on software renderer tests and opaque tests, but give a decent margin for blending inaccuracy for the blended tests.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 21 Nov 2009 07:59:19 +0000 |
parents | ab99313951cd |
children | c32c53fca10d |
comparison
equal
deleted
inserted
replaced
3476:ab99313951cd | 3477:2c07bb579922 |
---|---|
14 | 14 |
15 | 15 |
16 /** | 16 /** |
17 * @brief Compares a surface and a surface image for equality. | 17 * @brief Compares a surface and a surface image for equality. |
18 */ | 18 */ |
19 int surface_compare( SDL_Surface *sur, const SurfaceImage_t *img ) | 19 int surface_compare( SDL_Surface *sur, const SurfaceImage_t *img, int allowable_error ) |
20 { | 20 { |
21 int ret; | 21 int ret; |
22 int i,j; | 22 int i,j; |
23 int bpp; | 23 int bpp; |
24 Uint8 *p, *pd; | 24 Uint8 *p, *pd; |
60 dist += (R-pd[0])*(R-pd[0]); | 60 dist += (R-pd[0])*(R-pd[0]); |
61 dist += (G-pd[1])*(G-pd[1]); | 61 dist += (G-pd[1])*(G-pd[1]); |
62 dist += (B-pd[2])*(B-pd[2]); | 62 dist += (B-pd[2])*(B-pd[2]); |
63 dist += (A-pd[3])*(A-pd[3]); | 63 dist += (A-pd[3])*(A-pd[3]); |
64 } | 64 } |
65 /* Allow up to sqrt(32) difference in blending accuracy */ | 65 /* Allow some difference in blending accuracy */ |
66 if (dist > 64) { | 66 if (dist > allowable_error) { |
67 /*printf("pixel %d,%d varies by %d\n", i, j, dist);*/ | 67 /*printf("pixel %d,%d varies by %d\n", i, j, dist);*/ |
68 ++ret; | 68 ++ret; |
69 } | 69 } |
70 } | 70 } |
71 break; | 71 break; |