diff options
Diffstat (limited to 'test/buffer-diff.c')
-rw-r--r-- | test/buffer-diff.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/buffer-diff.c b/test/buffer-diff.c index f9b4a951..8fc3f891 100644 --- a/test/buffer-diff.c +++ b/test/buffer-diff.c @@ -70,13 +70,12 @@ buffer_diff_core (const unsigned char *_buf_a, int stride_a, stride_a /= sizeof (uint32_t); stride_b /= sizeof (uint32_t); stride_diff /= sizeof (uint32_t); - for (y = 0; y < height; y++) - { + for (y = 0; y < height; y++) { const uint32_t *row_a = buf_a + y * stride_a; const uint32_t *row_b = buf_b + y * stride_b; uint32_t *row = buf_diff + y * stride_diff; - for (x = 0; x < width; x++) - { + + for (x = 0; x < width; x++) { /* check if the pixels are the same */ if ((row_a[x] & mask) != (row_b[x] & mask)) { int channel; @@ -99,6 +98,11 @@ buffer_diff_core (const unsigned char *_buf_a, int stride_a, } result.pixels_changed++; + if ((diff_pixel & 0x00ffffff) == 0) { + /* alpha only difference, convert to luminance */ + uint8_t alpha = diff_pixel >> 24; + diff_pixel = alpha * 0x010101; + } row[x] = diff_pixel; } else { row[x] = 0; |