diff --git a/SDWebImage/UIImage+Transform.m b/SDWebImage/UIImage+Transform.m index acf86fb1..cd1c65c7 100644 --- a/SDWebImage/UIImage+Transform.m +++ b/SDWebImage/UIImage+Transform.m @@ -228,7 +228,7 @@ static inline UIColor * SDGetColorFromPixel(Pixel_8888 pixel, CGBitmapInfo bitma CGContextSaveGState(context); [path addClip]; - CGContextDrawImage(context, rect, self.CGImage); + [self drawInRect:rect]; CGContextRestoreGState(context); } diff --git a/Tests/Tests/Images/TestImage.png b/Tests/Tests/Images/TestImage.png index 9d9dd877..a528ffcb 100644 Binary files a/Tests/Tests/Images/TestImage.png and b/Tests/Tests/Images/TestImage.png differ diff --git a/Tests/Tests/SDImageTransformerTests.m b/Tests/Tests/SDImageTransformerTests.m index 57a19589..da49a250 100644 --- a/Tests/Tests/SDImageTransformerTests.m +++ b/Tests/Tests/SDImageTransformerTests.m @@ -61,6 +61,9 @@ // Check the left center pixel, should be border :) UIColor *checkBorderColor = [roundedCornerImage sd_colorAtPoint:CGPointMake(1, 150)]; expect([checkBorderColor.sd_hexString isEqualToString:borderColor.sd_hexString]).beTruthy(); + // Check rounded corner operation not inversion the image + UIColor *topCenterColor = [roundedCornerImage sd_colorAtPoint:CGPointMake(150, 20)]; + expect([topCenterColor.sd_hexString isEqualToString:[UIColor blackColor].sd_hexString]).beTruthy(); } - (void)test04UIImageTransformRotate {