File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
packages/image/platforms/ios/src Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -25,20 +25,18 @@ - (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {
2525 if (!image) {
2626 return nil ;
2727 }
28- CGFloat widthRatio = 1 .0f ;
29- CGFloat heightRatio = 1 .0f ;
28+ CGFloat ratio = 1 .0f ;
3029
3130 CGFloat width = (CGFloat)image.size .width ;
3231 CGFloat height = (CGFloat)image.size .height ;
3332 if (self.decodeWidth && self.decodeHeight ) {
34- widthRatio = self.decodeWidth / width;
35- heightRatio = self.decodeHeight / height;
33+ ratio = MIN (self.decodeWidth / width, self.decodeHeight / height);
3634 } else if (self.decodeWidth > 0 ) {
37- widthRatio = self.decodeWidth / width;
35+ ratio = self.decodeWidth / width;
3836 } else {
39- heightRatio = self.decodeHeight / height;
37+ ratio = self.decodeHeight / height;
4038 }
41- return [image sd_resizedImageWithSize: CGSizeMake (width * widthRatio , height * heightRatio ) scaleMode: 2 ];
39+ return [image sd_resizedImageWithSize: CGSizeMake (width * ratio , height * ratio ) scaleMode: 2 ];
4240}
4341
4442@end
You can’t perform that action at this time.
0 commit comments