Commit 92f13069 authored by Sam Lantinga's avatar Sam Lantinga

Allow some variation in the pixel values to account for blending accuracy differences.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404197
parent 556c82f8
...@@ -47,22 +47,24 @@ int surface_compare( SDL_Surface *sur, const SurfaceImage_t *img ) ...@@ -47,22 +47,24 @@ int surface_compare( SDL_Surface *sur, const SurfaceImage_t *img )
case 4: case 4:
{ {
int fail; int dist = 0;
Uint8 R, G, B, A; Uint8 R, G, B, A;
SDL_GetRGBA(*(Uint32*)p, sur->format, &R, &G, &B, &A); SDL_GetRGBA(*(Uint32*)p, sur->format, &R, &G, &B, &A);
if (img->bytes_per_pixel == 3) { if (img->bytes_per_pixel == 3) {
fail = !( (R == pd[0]) && dist += (R-pd[0])*(R-pd[0]);
(G == pd[1]) && dist += (G-pd[1])*(G-pd[1]);
(B == pd[2]) ); dist += (B-pd[2])*(B-pd[2]);
} else { } else {
fail = !( (R == pd[0]) && dist += (R-pd[0])*(R-pd[0]);
(G == pd[1]) && dist += (G-pd[1])*(G-pd[1]);
(B == pd[2]) && dist += (B-pd[2])*(B-pd[2]);
(A == pd[3]) ); dist += (A-pd[3])*(A-pd[3]);
} }
if (fail) { /* Allow up to sqrt(32) difference in blending accuracy */
if (dist > 32) {
/*printf("pixel %d,%d varies by %d\n", i, j, dist);*/
++ret; ++ret;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment