From 7b02207537d35bfa1714bf8beafc921f717d100a Mon Sep 17 00:00:00 2001 From: 单军华 Date: Wed, 11 Jul 2018 10:47:42 +0800 Subject: [PATCH] 首次上传 --- screendisplay/Pods/SDWebImage/SDWebImage/SDWebImageCompat.m | 67 +++++++++++++++++++++++++++++++++ 1 files changed, 67 insertions(+), 0 deletions(-) diff --git a/screendisplay/Pods/SDWebImage/SDWebImage/SDWebImageCompat.m b/screendisplay/Pods/SDWebImage/SDWebImage/SDWebImageCompat.m new file mode 100644 index 0000000..bb53495 --- /dev/null +++ b/screendisplay/Pods/SDWebImage/SDWebImage/SDWebImageCompat.m @@ -0,0 +1,67 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey <rs@dailymotion.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" +#import "UIImage+MultiFormat.h" + +#if !__has_feature(objc_arc) + #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag +#endif + +#if !OS_OBJECT_USE_OBJC + #error SDWebImage need ARC for dispatch object +#endif + +inline UIImage *SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullable image) { + if (!image) { + return nil; + } + +#if SD_MAC + return image; +#elif SD_UIKIT || SD_WATCH + if ((image.images).count > 0) { + NSMutableArray<UIImage *> *scaledImages = [NSMutableArray array]; + + for (UIImage *tempImage in image.images) { + [scaledImages addObject:SDScaledImageForKey(key, tempImage)]; + } + + UIImage *animatedImage = [UIImage animatedImageWithImages:scaledImages duration:image.duration]; + if (animatedImage) { + animatedImage.sd_imageLoopCount = image.sd_imageLoopCount; + } + return animatedImage; + } else { +#if SD_WATCH + if ([[WKInterfaceDevice currentDevice] respondsToSelector:@selector(screenScale)]) { +#elif SD_UIKIT + if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { +#endif + CGFloat scale = 1; + if (key.length >= 8) { + NSRange range = [key rangeOfString:@"@2x."]; + if (range.location != NSNotFound) { + scale = 2.0; + } + + range = [key rangeOfString:@"@3x."]; + if (range.location != NSNotFound) { + scale = 3.0; + } + } + + UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation]; + image = scaledImage; + } + return image; + } +#endif +} + +NSString *const SDWebImageErrorDomain = @"SDWebImageErrorDomain"; -- Gitblit v1.8.0