Skip to content

Commit 7354095

Browse files
committed
Fix differ issue
1 parent 1a42e0e commit 7354095

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

paparazzi/src/main/java/app/cash/paparazzi/internal/OffByTwo.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ internal object OffByTwo : Differ {
6161
((expectedRgb and -0x1000000).ushr(24) + (actualRgb and -0x1000000).ushr(24)) / 2 shl 24
6262
val newRGB = avgAlpha or (newR shl 16) or (newG shl 8) or newB
6363

64-
if (abs(deltaR) <= 2 && abs(deltaG) <= 2 && abs(deltaB) <= 2 //* && abs(deltaA) <= 2 *//
65-
) {
64+
if (abs(deltaR) <= 2 && abs(deltaG) <= 2 && abs(deltaB) <= 2 && abs(deltaA) <= 2) {
6665
similarPixels++
6766
deltaImage.setRGB(expectedWidth + x, y, 0xFF0000FF.toInt())
6867
continue

paparazzi/src/main/java/app/cash/paparazzi/internal/PixelPerfect.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ internal object PixelPerfect : Differ {
8282

8383
// If the delta diff is all black pixels, the computed difference is 0, but there are still
8484
// different pixels. We can fallback to the amount of different pixels to less precise difference to ensure difference is reported.
85-
// if (differentPixels > 0 && percentDifference == 0f) {
86-
// percentDifference = differentPixels * 100 / (actualWidth * actualHeight.toDouble()).toFloat()
87-
// }
85+
if (differentPixels > 0 && percentDifference == 0f) {
86+
percentDifference = differentPixels * 100 / (actualWidth * actualHeight.toDouble()).toFloat()
87+
}
8888

8989
return if (percentDifference == 0f) {
9090
DiffResult.Identical(delta = deltaImage)

0 commit comments

Comments
 (0)