Flag to transform animated images
Using a new SDWebImageOptions flag: SDWebImageTransformAnimatedImage
This commit is contained in:
parent
2eef774eae
commit
a8c4fa48b7
|
@ -74,7 +74,14 @@ typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) {
|
||||||
* By default, placeholder images are loaded while the image is loading. This flag will delay the loading
|
* By default, placeholder images are loaded while the image is loading. This flag will delay the loading
|
||||||
* of the placeholder image until after the image has finished loading.
|
* of the placeholder image until after the image has finished loading.
|
||||||
*/
|
*/
|
||||||
SDWebImageDelayPlaceholder = 1 << 9
|
SDWebImageDelayPlaceholder = 1 << 9,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We usually don't call transformDownloadedImage delegate method on animated images,
|
||||||
|
* as most transformation code would mangle it.
|
||||||
|
* Use this flag to transform them anyway.
|
||||||
|
*/
|
||||||
|
SDWebImageTransformAnimatedImage = 1 << 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void(^SDWebImageCompletionBlock)(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL);
|
typedef void(^SDWebImageCompletionBlock)(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL);
|
||||||
|
|
|
@ -204,8 +204,7 @@
|
||||||
if (options & SDWebImageRefreshCached && image && !downloadedImage) {
|
if (options & SDWebImageRefreshCached && image && !downloadedImage) {
|
||||||
// Image refresh hit the NSURLCache cache, do not call the completion block
|
// Image refresh hit the NSURLCache cache, do not call the completion block
|
||||||
}
|
}
|
||||||
// NOTE: We don't call transformDownloadedImage delegate method on animated images as most transformation code would mangle it
|
else if (downloadedImage && (!downloadedImage.images || (options & SDWebImageTransformAnimatedImage)) && [self.delegate respondsToSelector:@selector(imageManager:transformDownloadedImage:withURL:)]) {
|
||||||
else if (downloadedImage && !downloadedImage.images && [self.delegate respondsToSelector:@selector(imageManager:transformDownloadedImage:withURL:)]) {
|
|
||||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
||||||
UIImage *transformedImage = [self.delegate imageManager:self transformDownloadedImage:downloadedImage withURL:url];
|
UIImage *transformedImage = [self.delegate imageManager:self transformDownloadedImage:downloadedImage withURL:url];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue