[CIFilter outputImage] can return nil, [CIContext createCGImage:fromRect:] requires a non-nil CIImage as input.

This commit is contained in:
Garrett Moon
2015-09-28 17:00:16 -07:00
parent dcf1fa695b
commit 4ba0affc3f

View File

@@ -356,11 +356,15 @@
forKey:kCIInputRadiusKey];
CIImage *outputImage = [self.gaussianFilter outputImage];
CGImageRef outputImageRef = [self.processingContext createCGImage:outputImage fromRect:CGRectMake(0, 0, inputImage.size.width, inputImage.size.height)];
//"decoding" the image here copies it to CPU memory?
outputUIImage = [UIImage pin_decodedImageWithCGImageRef:outputImageRef];
CGImageRelease(outputImageRef);
if (outputImage) {
CGImageRef outputImageRef = [self.processingContext createCGImage:outputImage fromRect:CGRectMake(0, 0, inputImage.size.width, inputImage.size.height)];
if (outputImageRef) {
//"decoding" the image here copies it to CPU memory?
outputUIImage = [UIImage pin_decodedImageWithCGImageRef:outputImageRef];
CGImageRelease(outputImageRef);
}
}
}
if (outputUIImage == nil) {