Merge pull request #3716 from dreampiggy/bugfix/sd_svg_macos
Fix the detection of SVGImageRep on macOS AppKit
This commit is contained in:
commit
5f599018b1
|
@ -143,6 +143,7 @@
|
|||
|
||||
- (BOOL)sd_isVector {
|
||||
NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height);
|
||||
// This may returns a NSProxy, so don't use `class` to check
|
||||
NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil];
|
||||
if ([imageRep isKindOfClass:[NSPDFImageRep class]]) {
|
||||
return YES;
|
||||
|
@ -150,7 +151,8 @@
|
|||
if ([imageRep isKindOfClass:[NSEPSImageRep class]]) {
|
||||
return YES;
|
||||
}
|
||||
if ([NSStringFromClass(imageRep.class) hasSuffix:@"NSSVGImageRep"]) {
|
||||
Class NSSVGImageRepClass = NSClassFromString([NSString stringWithFormat:@"_%@", SD_NSSTRING(NSSVGImageRep)]);
|
||||
if ([imageRep isKindOfClass:NSSVGImageRepClass]) {
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
|
|
Loading…
Reference in New Issue