Fill image context with background color if image node is opaque

This commit is contained in:
Adlai Holler
2015-09-17 21:59:52 -07:00
parent f8e43ea07a
commit c872485459

View File

@@ -227,6 +227,12 @@
// 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, parameters.opaque, 1.0);
// if view is opaque, fill the context with background color
if (parameters.opaque && parameters.backgroundColor) {
[parameters.backgroundColor setFill];
[[UIBezierPath bezierPathWithRect:{ .size = backingSize }] fill];
}
[image drawInRect:imageDrawRect];