feat(ios): Optimize invertColors / fix memory leak (#2955)

Releases the CGImage that was created in order to populate the UIImage's CGImage property. This probably relates to #2904 and possibly #2950.
This commit is contained in:
stanleykerr 2020-09-18 07:41:27 -07:00 committed by GitHub
parent 90ec544cd2
commit 43f2a0f774
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -126,10 +126,13 @@
// A UIImage initialized directly from CIImage has its CGImage property set to NULL. So it has
// to be converted to a CGImage first.
CIContext *context = [CIContext context];
static CIContext *context = nil; if (!context) context = [CIContext contextWithOptions:nil];
CGImageRef outputCGImage = [context createCGImage:outputCIImage fromRect:[outputCIImage extent]];
UIImage *outputUIImage = [UIImage imageWithCGImage:outputCGImage];
CGImageRelease(outputCGImage);
return outputUIImage;
}