Merge pull request #203 from Stigec/master

Fixed Alpha detection when decoding images.
This commit is contained in:
Olivier Poitrey 2012-10-28 12:57:45 -07:00
commit 520124114f
1 changed files with 3 additions and 1 deletions

View File

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