Unify the colorspace on macOS/watchOS choosen for draw to use sRGB firstly
Remove the unused OS version check
This commit is contained in:
parent
368825eff6
commit
874b674cb6
|
@ -189,24 +189,10 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over
|
|||
}
|
||||
|
||||
+ (CGColorSpaceRef)colorSpaceGetDeviceRGB {
|
||||
#if SD_MAC
|
||||
CGColorSpaceRef screenColorSpace = NSScreen.mainScreen.colorSpace.CGColorSpace;
|
||||
if (screenColorSpace) {
|
||||
return screenColorSpace;
|
||||
}
|
||||
#endif
|
||||
static CGColorSpaceRef colorSpace;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
#if SD_UIKIT
|
||||
if (@available(iOS 9.0, tvOS 9.0, *)) {
|
||||
colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
|
||||
} else {
|
||||
colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||
}
|
||||
#else
|
||||
colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||
#endif
|
||||
});
|
||||
return colorSpace;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#import "SDImageGraphics.h"
|
||||
#import "NSImage+Compatibility.h"
|
||||
#import "SDImageCoderHelper.h"
|
||||
#import "objc/runtime.h"
|
||||
|
||||
#if SD_MAC
|
||||
|
@ -22,7 +23,7 @@ static CGContextRef SDCGContextCreateBitmapContext(CGSize size, BOOL opaque, CGF
|
|||
size_t height = ceil(size.height * scale);
|
||||
if (width < 1 || height < 1) return NULL;
|
||||
|
||||
CGColorSpaceRef space = NSScreen.mainScreen.colorSpace.CGColorSpace;
|
||||
CGColorSpaceRef space = [SDImageCoderHelper colorSpaceGetDeviceRGB];
|
||||
// kCGImageAlphaNone is not supported in CGBitmapContextCreate.
|
||||
// Check #3330 for more detail about why this bitmap is choosen.
|
||||
CGBitmapInfo bitmapInfo;
|
||||
|
|
Loading…
Reference in New Issue