From 46c59183aa51331a808e51f89c7b269bbd0e49d0 Mon Sep 17 00:00:00 2001 From: Atsushi Kataoka Date: Wed, 2 Sep 2015 11:12:59 +0900 Subject: [PATCH] Fix sd_animatedImageByScalingAndCroppingToSize: --- SDWebImage/UIImage+GIF.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SDWebImage/UIImage+GIF.m b/SDWebImage/UIImage+GIF.m index a7036372a..e1ded2aa8 100755 --- a/SDWebImage/UIImage+GIF.m +++ b/SDWebImage/UIImage+GIF.m @@ -141,17 +141,17 @@ - (UIImage *)sd_animatedImageByScalingAndCroppingToSize:(CGSize)size { NSMutableArray *scaledImages = [NSMutableArray array]; - UIGraphicsBeginImageContextWithOptions(size, NO, 0.0); - for (UIImage *image in self.images) { + UIGraphicsBeginImageContextWithOptions(size, NO, 0.0); + [image drawInRect:CGRectMake(thumbnailPoint.x, thumbnailPoint.y, scaledSize.width, scaledSize.height)]; UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); [scaledImages addObject:newImage]; - } - - UIGraphicsEndImageContext(); + UIGraphicsEndImageContext(); + } + return [UIImage animatedImageWithImages:scaledImages duration:self.duration]; }