For ImageIO coder, if the image is scaled down, then we need to modify the original image data pointer
This commit is contained in:
parent
cd37ef672b
commit
d62e965833
|
@ -213,7 +213,16 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over
|
||||||
if (!shouldScaleDown) {
|
if (!shouldScaleDown) {
|
||||||
return [self sd_decompressedImageWithImage:image];
|
return [self sd_decompressedImageWithImage:image];
|
||||||
} else {
|
} else {
|
||||||
return [self sd_decompressedAndScaledDownImageWithImage:image];
|
UIImage *scaledDownImage = [self sd_decompressedAndScaledDownImageWithImage:image];
|
||||||
|
if (scaledDownImage && !CGSizeEqualToSize(scaledDownImage.size, image.size)) {
|
||||||
|
// if the image is scaled down, need to modify the data pointer as well
|
||||||
|
SDImageFormat format = [NSData sd_imageFormatForImageData:*data];
|
||||||
|
NSData *imageData = [self encodedDataWithImage:scaledDownImage format:format];
|
||||||
|
if (imageData) {
|
||||||
|
*data = imageData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return scaledDownImage;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue