Skip to content

Commit 9be9dc4

Browse files
committed
fix-image-equal: Fix logical problem with image normalization
1 parent 5629ccd commit 9be9dc4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

TestsProject/TestsProjectTests/UIImage+G8Equal.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ - (BOOL)g8_isEqualToImage:(UIImage *)image
1818
return YES;
1919
}
2020

21-
CGFloat similarity = [self g8_similarityWithImage:image];
21+
CGFloat similarity = [[self g8_normalizedImage] g8_similarityWithImage:[image g8_normalizedImage]];
2222
return similarity > kG8MinimalSimilarity;
2323
}
2424

@@ -35,7 +35,7 @@ - (uint32_t *)pixels
3535

3636
CGContextRef context = CGBitmapContextCreate(pixels, width, height, 8, width * sizeof(uint32_t), colorSpace,
3737
kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedLast);
38-
CGContextDrawImage(context, CGRectMake(0, 0, width, height), [[self g8_normalizedImage] CGImage]);
38+
CGContextDrawImage(context, CGRectMake(0, 0, width, height), self.CGImage);
3939

4040
CGContextRelease(context);
4141
CGColorSpaceRelease(colorSpace);

0 commit comments

Comments
 (0)