Authored by Matej Bukovinski
Committed by Olivier Poitrey

Using the source image's the color space for image decoding (fix #237)

Should fix most system warnings regarding invalid context configurations
... ... @@ -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;
... ...