Optimize when scale = 1

This commit is contained in:
Noah 2018-10-30 01:26:44 +08:00
parent 6c6d848cee
commit 042c27ec8c
1 changed files with 6 additions and 4 deletions

View File

@ -56,10 +56,12 @@ inline UIImage *SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullabl
scale = 3.0;
}
}
UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation];
scaledImage.sd_imageFormat = image.sd_imageFormat;
image = scaledImage;
if (scale != 1) {
UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation];
scaledImage.sd_imageFormat = image.sd_imageFormat;
image = scaledImage;
}
}
return image;
}