From e6ede1104cea39f2034ec5a1644e2d2082cc57bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=BDove?= Date: Sun, 28 Oct 2012 19:58:14 +0100 Subject: [PATCH] Fixed Alpha chanel detection when decoding images. --- SDWebImage/SDWebImageDecoder.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SDWebImage/SDWebImageDecoder.m b/SDWebImage/SDWebImageDecoder.m index 31b0cb29..06b6e2d9 100644 --- a/SDWebImage/SDWebImageDecoder.m +++ b/SDWebImage/SDWebImageDecoder.m @@ -100,7 +100,9 @@ static SDWebImageDecoder *sharedInstance; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(imageRef); - BOOL imageHasAlphaInfo = (alphaInfo != kCGImageAlphaNone); + BOOL imageHasAlphaInfo = (alphaInfo != kCGImageAlphaNone && + alphaInfo != kCGImageAlphaNoneSkipFirst && + alphaInfo != kCGImageAlphaNoneSkipLast); int bytesPerPixel = imageHasAlphaInfo ? 4 : 3; CGBitmapInfo bitmapInfo = imageHasAlphaInfo ? kCGImageAlphaPremultipliedLast : kCGImageAlphaNone;