Using the source image's the color space for image decoding (fix #237)
Should fix most system warnings regarding invalid context configurations
This commit is contained in:
parent
a94b3eca7c
commit
37f71de26c
|
@ -18,9 +18,8 @@
|
|||
CGSize imageSize = CGSizeMake(CGImageGetWidth(imageRef), CGImageGetHeight(imageRef));
|
||||
CGRect imageRect = (CGRect){.origin = CGPointZero, .size = imageSize};
|
||||
|
||||
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||
CGColorSpaceRef colorSpace = CGImageGetColorSpace(imageRef);
|
||||
CGContextRef context = CGBitmapContextCreate(NULL, imageSize.width, imageSize.height, CGImageGetBitsPerComponent(imageRef), CGImageGetBytesPerRow(imageRef), colorSpace, CGImageGetBitmapInfo(imageRef));
|
||||
CGColorSpaceRelease(colorSpace);
|
||||
|
||||
// If failed, return undecompressed image
|
||||
if (!context) return image;
|
||||
|
|
Loading…
Reference in New Issue