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:
Matej Bukovinski 2012-12-13 22:38:08 +01:00 committed by Olivier Poitrey
parent a94b3eca7c
commit 37f71de26c
1 changed files with 1 additions and 2 deletions

View File

@ -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;