Merge pull request #203 from Stigec/master
Fixed Alpha detection when decoding images.
This commit is contained in:
commit
520124114f
|
@ -100,7 +100,9 @@ static SDWebImageDecoder *sharedInstance;
|
||||||
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
|
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||||
CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(imageRef);
|
CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(imageRef);
|
||||||
|
|
||||||
BOOL imageHasAlphaInfo = (alphaInfo != kCGImageAlphaNone);
|
BOOL imageHasAlphaInfo = (alphaInfo != kCGImageAlphaNone &&
|
||||||
|
alphaInfo != kCGImageAlphaNoneSkipFirst &&
|
||||||
|
alphaInfo != kCGImageAlphaNoneSkipLast);
|
||||||
|
|
||||||
int bytesPerPixel = imageHasAlphaInfo ? 4 : 3;
|
int bytesPerPixel = imageHasAlphaInfo ? 4 : 3;
|
||||||
CGBitmapInfo bitmapInfo = imageHasAlphaInfo ? kCGImageAlphaPremultipliedLast : kCGImageAlphaNone;
|
CGBitmapInfo bitmapInfo = imageHasAlphaInfo ? kCGImageAlphaPremultipliedLast : kCGImageAlphaNone;
|
||||||
|
|
Loading…
Reference in New Issue