Fix the Xcode 10 support using runtime selector, the force decode feature does not process on vector image format
This commit is contained in:
parent
eeec6de698
commit
ef2373668e
|
@ -575,6 +575,10 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over
|
|||
if (image.sd_isAnimated) {
|
||||
return NO;
|
||||
}
|
||||
// do not decode vector images
|
||||
if (image.sd_isVector) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
|
|
@ -32,25 +32,31 @@
|
|||
return (self.images != nil);
|
||||
}
|
||||
|
||||
- (BOOL)sd_isVector {
|
||||
if (@available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)) {
|
||||
if (self.isSymbolImage) {
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
|
||||
- (BOOL)sd_isVector {
|
||||
if (@available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)) {
|
||||
// Xcode 11 supports symbol image, keep Xcode 10 compatible currently
|
||||
SEL SymbolSelector = NSSelectorFromString(@"isSymbolImage");
|
||||
if ([self respondsToSelector:SymbolSelector] && [self performSelector:SymbolSelector]) {
|
||||
return YES;
|
||||
}
|
||||
// SVG
|
||||
SEL SVGSelector = NSSelectorFromString(@"_CGSVGDocument");
|
||||
if ([self respondsToSelector:SVGSelector] && [self performSelector:SVGSelector] != nil) {
|
||||
if ([self respondsToSelector:SVGSelector] && [self performSelector:SVGSelector]) {
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
if (@available(iOS 11.0, tvOS 11.0, watchOS 4.0, *)) {
|
||||
// PDF
|
||||
SEL PDFSelector = NSSelectorFromString(@"_CGPDFPage");
|
||||
if ([self respondsToSelector:PDFSelector] && [self performSelector:PDFSelector] != nil) {
|
||||
if ([self respondsToSelector:PDFSelector] && [self performSelector:PDFSelector]) {
|
||||
return YES;
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
#else
|
||||
|
||||
|
|
Loading…
Reference in New Issue