Fixed issue with opaque thumbnails being given an alpha channel

Summary:Images cropped using the ImageEditor were always given an alpha channel, even if opaque.

This causes them to be saved as PNGs instead of JPEGs (increasing memory and bridge traffic) and also causes unnecessary blending when they are drawn.

Reviewed By: fkgozali

Differential Revision: D2982682

fb-gh-sync-id: b65f361efd78e35f259836111b38d914bae49847
shipit-source-id: b65f361efd78e35f259836111b38d914bae49847
This commit is contained in:
Nick Lockwood 2016-02-26 11:41:18 -08:00 committed by Facebook Github Bot 3
parent f99579adaa
commit 738337815d
1 changed files with 2 additions and 1 deletions

View File

@ -316,7 +316,8 @@ UIImage *__nullable RCTTransformImage(UIImage *image,
return nil;
}
UIGraphicsBeginImageContextWithOptions(destSize, NO, destScale);
BOOL opaque = !RCTImageHasAlpha(image.CGImage);
UIGraphicsBeginImageContextWithOptions(destSize, opaque, destScale);
CGContextRef currentContext = UIGraphicsGetCurrentContext();
CGContextConcatCTM(currentContext, transform);
[image drawAtPoint:CGPointZero];