Fix the sd_rotatedImageWithAngle on macOS, which should not apply the counterclockwise reverse

This commit is contained in:
DreamPiggy 2019-12-16 11:44:52 +08:00
parent 3929f2cd2a
commit 92e3bfcc3e
1 changed files with 5 additions and 1 deletions

View File

@ -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)];
}];