Merge branch 'master' of https://github.com/rs/SDWebImage into bugfix_webp_force_decode
# Conflicts: # SDWebImage/SDWebImageWebPCoder.m
This commit is contained in:
commit
7bfc950b98
|
@ -26,6 +26,7 @@
|
||||||
#endif
|
#endif
|
||||||
#import <Accelerate/Accelerate.h>
|
#import <Accelerate/Accelerate.h>
|
||||||
|
|
||||||
|
|
||||||
@implementation SDWebImageWebPCoder {
|
@implementation SDWebImageWebPCoder {
|
||||||
WebPIDecoder *_idec;
|
WebPIDecoder *_idec;
|
||||||
}
|
}
|
||||||
|
@ -329,13 +330,17 @@
|
||||||
// WebP contains ICC Profile should use the desired colorspace, instead of default device colorspace
|
// WebP contains ICC Profile should use the desired colorspace, instead of default device colorspace
|
||||||
// See: https://developers.google.com/speed/webp/docs/riff_container#color_profile
|
// See: https://developers.google.com/speed/webp/docs/riff_container#color_profile
|
||||||
|
|
||||||
WebPChunkIterator chunk_iter;
|
|
||||||
CGColorSpaceRef colorSpaceRef = NULL;
|
CGColorSpaceRef colorSpaceRef = NULL;
|
||||||
|
uint32_t flags = WebPDemuxGetI(demuxer, WEBP_FF_FORMAT_FLAGS);
|
||||||
|
|
||||||
int result = WebPDemuxGetChunk(demuxer, "ICCP", 1, &chunk_iter);
|
if (flags & ICCP_FLAG) {
|
||||||
if (result) {
|
WebPChunkIterator chunk_iter;
|
||||||
NSData *profileData = [NSData dataWithBytes:chunk_iter.chunk.bytes length:chunk_iter.chunk.size];
|
int result = WebPDemuxGetChunk(demuxer, "ICCP", 1, &chunk_iter);
|
||||||
colorSpaceRef = CGColorSpaceCreateWithICCProfile((__bridge CFDataRef)profileData);
|
if (result) {
|
||||||
|
NSData *profileData = [NSData dataWithBytesNoCopy:(void *)chunk_iter.chunk.bytes length:chunk_iter.chunk.size freeWhenDone:NO];
|
||||||
|
colorSpaceRef = CGColorSpaceCreateWithICCProfile((__bridge CFDataRef)profileData);
|
||||||
|
WebPDemuxReleaseChunkIterator(&chunk_iter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!colorSpaceRef) {
|
if (!colorSpaceRef) {
|
||||||
|
|
Loading…
Reference in New Issue