Keeping original image alpha info when decoding
This fixes issue #26 and #55, after the change introduced in commit c32f9c03f816dac58a8cac25d6189310272ca9c1
This commit is contained in:
parent
3c4c61f54c
commit
1bf9668d97
|
@ -98,6 +98,7 @@ static SDWebImageDecoder *sharedInstance;
|
||||||
{
|
{
|
||||||
CGImageRef imageRef = image.CGImage;
|
CGImageRef imageRef = image.CGImage;
|
||||||
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
|
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||||
|
CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(imageRef);
|
||||||
CGContextRef context = CGBitmapContextCreate(NULL,
|
CGContextRef context = CGBitmapContextCreate(NULL,
|
||||||
CGImageGetWidth(imageRef),
|
CGImageGetWidth(imageRef),
|
||||||
CGImageGetHeight(imageRef),
|
CGImageGetHeight(imageRef),
|
||||||
|
@ -107,10 +108,7 @@ static SDWebImageDecoder *sharedInstance;
|
||||||
// System only supports RGB, set explicitly
|
// System only supports RGB, set explicitly
|
||||||
colorSpace,
|
colorSpace,
|
||||||
// Makes system don't need to do extra conversion when displayed.
|
// Makes system don't need to do extra conversion when displayed.
|
||||||
// NOTE: here we remove the alpha channel for performance. Most of the time, images loaded
|
alphaInfo | kCGBitmapByteOrder32Little);
|
||||||
// from the network are jpeg with no alpha channel. As a TODO, finding a way to detect
|
|
||||||
// if alpha channel is necessary would be nice.
|
|
||||||
kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Little);
|
|
||||||
CGColorSpaceRelease(colorSpace);
|
CGColorSpaceRelease(colorSpace);
|
||||||
if (!context) return nil;
|
if (!context) return nil;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue