Skip to content

Commit 4855a68

Browse files
committed
small optimization
1 parent 904df7c commit 4855a68

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export default function pixelmatch(img1, img2, output, width, height, options =
7272
// the color difference is above the threshold
7373
if (Math.abs(delta) > maxDelta) {
7474
// check it's a real rendering difference or just anti-aliasing
75-
const isAA = antialiased(img1, x, y, width, height, a32, b32) || antialiased(img2, x, y, width, height, a32, b32);
75+
const isAA = antialiased(img1, x, y, width, height, a32, b32) || antialiased(img2, x, y, width, height, b32, a32);
7676
if (!includeAA && isAA) {
7777
// one of the pixels is anti-aliasing; draw as yellow and do not count as difference
7878
// note that we do not include such pixels in a mask
@@ -90,9 +90,9 @@ export default function pixelmatch(img1, img2, output, width, height, options =
9090
diff++;
9191
}
9292

93-
} else if (output) {
93+
} else if (output && !diffMask) {
9494
// pixels are similar; draw background as grayscale image blended with white
95-
if (!diffMask) drawGrayPixel(img1, pos, alpha, output);
95+
drawGrayPixel(img1, pos, alpha, output);
9696
}
9797
}
9898
}

0 commit comments

Comments
 (0)