...
|
...
|
@@ -98,20 +98,7 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over |
|
|
|
|
|
UIImage *image = [[UIImage alloc] initWithData:data];
|
|
|
|
|
|
#if SD_MAC
|
|
|
return image;
|
|
|
#else
|
|
|
if (!image) {
|
|
|
return nil;
|
|
|
}
|
|
|
|
|
|
UIImageOrientation orientation = [[self class] sd_imageOrientationFromImageData:data];
|
|
|
if (orientation != UIImageOrientationUp) {
|
|
|
image = [[UIImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:orientation];
|
|
|
}
|
|
|
|
|
|
return image;
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
- (UIImage *)incrementallyDecodedImageWithData:(NSData *)data finished:(BOOL)finished {
|
...
|
...
|
@@ -517,31 +504,6 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over |
|
|
}
|
|
|
|
|
|
#if SD_UIKIT || SD_WATCH
|
|
|
#pragma mark EXIF orientation tag converter
|
|
|
+ (UIImageOrientation)sd_imageOrientationFromImageData:(nonnull NSData *)imageData {
|
|
|
UIImageOrientation result = UIImageOrientationUp;
|
|
|
CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef)imageData, NULL);
|
|
|
if (imageSource) {
|
|
|
CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, NULL);
|
|
|
if (properties) {
|
|
|
CFTypeRef val;
|
|
|
NSInteger exifOrientation;
|
|
|
val = CFDictionaryGetValue(properties, kCGImagePropertyOrientation);
|
|
|
if (val) {
|
|
|
CFNumberGetValue(val, kCFNumberNSIntegerType, &exifOrientation);
|
|
|
result = [SDWebImageCoderHelper imageOrientationFromEXIFOrientation:exifOrientation];
|
|
|
} // else - if it's not set it remains at up
|
|
|
CFRelease((CFTypeRef) properties);
|
|
|
} else {
|
|
|
//NSLog(@"NO PROPERTIES, FAIL");
|
|
|
}
|
|
|
CFRelease(imageSource);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
#if SD_UIKIT || SD_WATCH
|
|
|
+ (BOOL)shouldScaleDownImage:(nonnull UIImage *)image {
|
|
|
BOOL shouldScaleDown = YES;
|
|
|
|
...
|
...
|
|