summaryrefslogtreecommitdiff
path: root/test/buffer-diff.c
diff options
context:
space:
mode:
authorVladimir Vukicevic <vladimir@pobox.com>2008-02-25 21:06:35 -0500
committerVladimir Vukicevic <vladimir@sleet.local>2008-02-25 21:06:35 -0500
commit3fcd0be52215e1d8a59560d6b0919fb3f53b7a28 (patch)
treef414cd7c8e89b98e1374e35ccff16b40052c9d2f /test/buffer-diff.c
parent1dfb1bd45fbe08392e233af67f464b2776de9f19 (diff)
Use pdiff only if the pixel difference is less than a limit
Diffstat (limited to 'test/buffer-diff.c')
-rw-r--r--test/buffer-diff.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/test/buffer-diff.c b/test/buffer-diff.c
index 24fdad3a6..d1b586376 100644
--- a/test/buffer-diff.c
+++ b/test/buffer-diff.c
@@ -42,6 +42,10 @@
#include "buffer-diff.h"
#include "xmalloc.h"
+/* Don't allow any differences greater than this value, even if pdiff
+ * claims that the images are identical */
+#define PERCEPTUAL_DIFF_THRESHOLD 25
+
static void
xunlink (const char *pathname)
{
@@ -152,13 +156,19 @@ compare_surfaces (cairo_surface_t *surface_a,
/* Then, if there are any different pixels, we give the pdiff code
* a crack at the images. If it decides that there are no visually
* discernible differences in any pixels, then we accept this
- * result as good enough. */
- discernible_pixels_changed = pdiff_compare (surface_a, surface_b,
- gamma, luminance, field_of_view);
- if (discernible_pixels_changed == 0) {
- result->pixels_changed = 0;
- cairo_test_log ("But perceptual diff finds no visually discernible difference.\n"
- "Accepting result.\n");
+ * result as good enough.
+ *
+ * Only let pdiff have a crack at the comparison if the max difference
+ * is lower than a threshold, otherwise some problems could be masked.
+ */
+ if (result->max_diff < PERCEPTUAL_DIFF_THRESHOLD) {
+ discernible_pixels_changed = pdiff_compare (surface_a, surface_b,
+ gamma, luminance, field_of_view);
+ if (discernible_pixels_changed == 0) {
+ result->pixels_changed = 0;
+ cairo_test_log ("But perceptual diff finds no visually discernible difference.\n"
+ "Accepting result.\n");
+ }
}
}