diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-09-19 11:58:53 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-09-19 11:58:53 -0700 |
commit | 83c6675368ce14ee34b52147792b1073a074ed24 (patch) | |
tree | 986b6af442e8c503bedab9912e8913dbd129d2e1 | |
parent | bd27e137bf3b96b468b43d26242cca3b21365bd7 (diff) |
optimize reftests
-rwxr-xr-x | tests/runner.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/runner.py b/tests/runner.py index 6cd3a215..792b8939 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -7829,11 +7829,13 @@ elif 'browser' in str(sys.argv): var actual = actualCtx.getImageData(0, 0, actualImage.width, actualImage.height).data; var total = 0; - for (var x = 0; x < img.width; x++) { - for (var y = 0; y < img.height; y++) { - total += Math.abs(expected[y*img.width*4 + x*4 + 0] - actual[y*img.width*4 + x*4 + 0]); - total += Math.abs(expected[y*img.width*4 + x*4 + 1] - actual[y*img.width*4 + x*4 + 1]); - total += Math.abs(expected[y*img.width*4 + x*4 + 2] - actual[y*img.width*4 + x*4 + 2]); + var width = img.width; + var height = img.height; + for (var x = 0; x < width; x++) { + for (var y = 0; y < height; y++) { + total += Math.abs(expected[y*width*4 + x*4 + 0] - actual[y*width*4 + x*4 + 0]); + total += Math.abs(expected[y*width*4 + x*4 + 1] - actual[y*width*4 + x*4 + 1]); + total += Math.abs(expected[y*width*4 + x*4 + 2] - actual[y*width*4 + x*4 + 2]); } } var wrong = Math.floor(total / (img.width*img.height*3)); // floor, to allow some margin of error for antialiasing |