mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Change the values emitted for incorrect pixels to make small errors visible
This commit is contained in:
parent
d944567b9a
commit
cb31b3cf6c
1 changed files with 10 additions and 4 deletions
|
@ -14,7 +14,6 @@ extern mod std;
|
|||
use std::io;
|
||||
use std::io::{File, Reader};
|
||||
use std::io::process::ExitStatus;
|
||||
use std::num::abs;
|
||||
use std::os;
|
||||
use std::run::{Process, ProcessOptions};
|
||||
use std::str;
|
||||
|
@ -139,9 +138,16 @@ fn check_reftest(reftest: Reftest) {
|
|||
let right = png::load_png(&from_str::<Path>(right_filename).unwrap()).unwrap();
|
||||
|
||||
let pixels: ~[u8] = left.pixels.iter().zip(right.pixels.iter()).map(|(&a, &b)| {
|
||||
let a_signed = a as i8;
|
||||
let b_signed = b as i8;
|
||||
255-abs(a_signed - b_signed) as u8
|
||||
if (a as i8 - b as i8 == 0) {
|
||||
// White for correct
|
||||
0xFF
|
||||
} else {
|
||||
// "1100" in the RGBA channel with an error for an incorrect value
|
||||
// This results in some number of C0 and FFs, which is much more
|
||||
// readable (and distinguishable) than the previous difference-wise
|
||||
// scaling but does not require reconstructing the actual RGBA pixel.
|
||||
0xC0
|
||||
}
|
||||
}).collect();
|
||||
|
||||
if pixels.iter().any(|&a| a < 255) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue