From 37f71de26c8fc6c817b40ca371044e571cf07d1b Mon Sep 17 00:00:00 2001 From: Matej Bukovinski Date: Thu, 13 Dec 2012 22:38:08 +0100 Subject: [PATCH] Using the source image's the color space for image decoding (fix #237) Should fix most system warnings regarding invalid context configurations --- SDWebImage/SDWebImageDecoder.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SDWebImage/SDWebImageDecoder.m b/SDWebImage/SDWebImageDecoder.m index b73ec6e..8d8d2bf 100644 --- a/SDWebImage/SDWebImageDecoder.m +++ b/SDWebImage/SDWebImageDecoder.m @@ -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;