Merge pull request #286 from facebook/image-aspect-fit

Respect opacity of ASImageNode
This commit is contained in:
Nadine Salter
2015-02-04 18:34:36 -08:00

View File

@@ -184,12 +184,6 @@
CGSize imageSizeInPixels = CGSizeMake(imageSize.width * image.scale, imageSize.height * image.scale);
CGSize boundsSizeInPixels = CGSizeMake(floorf(bounds.size.width * contentsScale), floorf(bounds.size.height * contentsScale));
CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(image.CGImage);
BOOL imageHasAlpha = alphaInfo == kCGImageAlphaFirst
|| alphaInfo == kCGImageAlphaLast
|| alphaInfo == kCGImageAlphaPremultipliedFirst
|| alphaInfo == kCGImageAlphaPremultipliedLast;
BOOL contentModeSupported = contentMode == UIViewContentModeScaleAspectFill
|| contentMode == UIViewContentModeScaleAspectFit
|| contentMode == UIViewContentModeCenter;
@@ -226,7 +220,7 @@
// Use contentsScale of 1.0 and do the contentsScale handling in boundsSizeInPixels so ASCroppedImageBackingSizeAndDrawRectInBounds
// will do its rounding on pixel instead of point boundaries
UIGraphicsBeginImageContextWithOptions(backingSize, !imageHasAlpha, 1.0);
UIGraphicsBeginImageContextWithOptions(backingSize, parameters.opaque, 1.0);
CGContextRef context = UIGraphicsGetCurrentContext();