diff 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
line wrap: on
line diff
--- a/test/automated/common/common.c	Sat Nov 21 07:46:12 2009 +0000
+++ b/test/automated/common/common.c	Sat Nov 21 07:59:19 2009 +0000
@@ -16,7 +16,7 @@
 /**
  * @brief Compares a surface and a surface image for equality.
  */
-int surface_compare( SDL_Surface *sur, const SurfaceImage_t *img )
+int surface_compare( SDL_Surface *sur, const SurfaceImage_t *img, int allowable_error )
 {
    int ret;
    int i,j;
@@ -62,8 +62,8 @@
                      dist += (B-pd[2])*(B-pd[2]);
                      dist += (A-pd[3])*(A-pd[3]);
                   }
-                  /* Allow up to sqrt(32) difference in blending accuracy */
-                  if (dist > 64) {
+                  /* Allow some difference in blending accuracy */
+                  if (dist > allowable_error) {
                      /*printf("pixel %d,%d varies by %d\n", i, j, dist);*/
                      ++ret;
                   }