Skip to content

Commit 5b26315

Browse files
watacoz3n1ru4l
authored andcommitted
fix(ios): use roundf instead of casting to prevent truncated images (react-native-camera#1832)
1 parent 7603706 commit 5b26315

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ios/RN/RNImageUtils.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ + (UIImage *) scaleImage:(UIImage*)image toWidth:(NSInteger)width
7272
{
7373
width /= [UIScreen mainScreen].scale; // prevents image from being incorrectly resized on retina displays
7474
float scaleRatio = (float) width / (float) image.size.width;
75-
CGSize size = CGSizeMake(width, (int) (image.size.height * scaleRatio));
75+
CGSize size = CGSizeMake(width, roundf(image.size.height * scaleRatio));
7676

7777
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);
7878
[image drawInRect:CGRectMake(0, 0, size.width, size.height)];

0 commit comments

Comments
 (0)