From 92e3bfcc3e9ee89e0b0250cc48603c64406fbedf Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Mon, 16 Dec 2019 11:44:52 +0800 Subject: [PATCH] Fix the sd_rotatedImageWithAngle on macOS, which should not apply the counterclockwise reverse --- SDWebImage/Core/UIImage+Transform.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SDWebImage/Core/UIImage+Transform.m b/SDWebImage/Core/UIImage+Transform.m index ffcd9327..54d3cef9 100644 --- a/SDWebImage/Core/UIImage+Transform.m +++ b/SDWebImage/Core/UIImage+Transform.m @@ -269,9 +269,13 @@ static inline UIColor * SDGetColorFromPixel(Pixel_8888 pixel, CGBitmapInfo bitma CGContextSetShouldAntialias(context, true); CGContextSetAllowsAntialiasing(context, true); CGContextSetInterpolationQuality(context, kCGInterpolationHigh); - // Use UIKit coordinate counterclockwise (⟲) CGContextTranslateCTM(context, +(newRect.size.width * 0.5), +(newRect.size.height * 0.5)); +#if SD_UIKIT + // Use UIKit coordinate system counterclockwise (⟲) CGContextRotateCTM(context, -angle); +#else + CGContextRotateCTM(context, angle); +#endif [self drawInRect:CGRectMake(-(width * 0.5), -(height * 0.5), width, height)]; }];