Skip to content

Commit

Permalink
Merge pull request SDWebImage#1280 from atsusy/fix-uiimage-gif
Browse files Browse the repository at this point in the history
```UIGraphicsBeginImageContextWithOptions``` and ```UIGraphicsEndImageContext``` should be inside the loop for each image
  • Loading branch information
mythodeia committed Sep 29, 2015
2 parents 996fea9 + 46c5918 commit 3af1a30
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions SDWebImage/UIImage+GIF.m
Expand Up @@ -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];
}

Expand Down

0 comments on commit 3af1a30

Please sign in to comment.