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) {
|
if (image.sd_isAnimated) {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
// do not decode vector images
|
||||||
|
if (image.sd_isVector) {
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,25 +32,31 @@
|
||||||
return (self.images != nil);
|
return (self.images != nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
|
||||||
- (BOOL)sd_isVector {
|
- (BOOL)sd_isVector {
|
||||||
if (@available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)) {
|
if (@available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)) {
|
||||||
if (self.isSymbolImage) {
|
// 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]) {
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#pragma clang diagnostic push
|
if (@available(iOS 11.0, tvOS 11.0, watchOS 4.0, *)) {
|
||||||
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
|
// PDF
|
||||||
SEL SVGSelector = NSSelectorFromString(@"_CGSVGDocument");
|
SEL PDFSelector = NSSelectorFromString(@"_CGPDFPage");
|
||||||
if ([self respondsToSelector:SVGSelector] && [self performSelector:SVGSelector] != nil) {
|
if ([self respondsToSelector:PDFSelector] && [self performSelector:PDFSelector]) {
|
||||||
return YES;
|
return YES;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SEL PDFSelector = NSSelectorFromString(@"_CGPDFPage");
|
|
||||||
if ([self respondsToSelector:PDFSelector] && [self performSelector:PDFSelector] != nil) {
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue