summaryrefslogtreecommitdiff
path: root/test/buffer-diff.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2006-08-30 13:17:08 -0400
committerBehdad Esfahbod <behdad@behdad.org>2006-08-30 13:19:05 -0400
commita5f068e10d72c20a55d20ca9f79508361d13fb80 (patch)
treef3a846617bdbceca31b493016bee2ee4820ae37f /test/buffer-diff.c
parent3252ad5ca630fe292babc061c01b8759ef49cde4 (diff)
[test] Add 128 to any diff component such that differences are visible
Diffstat (limited to 'test/buffer-diff.c')
-rw-r--r--test/buffer-diff.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/buffer-diff.c b/test/buffer-diff.c
index 45942c498..ade0cc800 100644
--- a/test/buffer-diff.c
+++ b/test/buffer-diff.c
@@ -91,13 +91,15 @@ buffer_diff_core (unsigned char *_buf_a,
/* calculate a difference value for all 4 channels */
for (channel = 0; channel < 4; channel++) {
- unsigned char value_a = (row_a[x] >> (channel*8));
- unsigned char value_b = (row_b[x] >> (channel*8));
+ int value_a = (row_a[x] >> (channel*8)) & 0xff;
+ int value_b = (row_b[x] >> (channel*8)) & 0xff;
unsigned int diff;
diff = abs (value_a - value_b);
- diff *= 4; /* emphasize */
+ diff *= 4; /* emphasize */
+ if (diff)
+ diff += 128; /* make sure it's visible */
if (diff > 255)
- diff = 255;
+ diff = 255;
diff_pixel |= diff << (channel*8);
}