Add a protect when tile rectangle is too small to calculate when using `SDWebImageScaleDownLargeImages`
This commit is contained in:
parent
b483ec2959
commit
a746a3a136
|
@ -595,6 +595,7 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over
|
|||
return NO;
|
||||
}
|
||||
CGFloat destTotalPixels;
|
||||
CGFloat tileTotalPixels;
|
||||
if (bytes == 0) {
|
||||
bytes = kDestImageLimitBytes;
|
||||
}
|
||||
|
@ -609,6 +610,12 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over
|
|||
} else {
|
||||
shouldScaleDown = NO;
|
||||
}
|
||||
// Add a protect when tile rectangle is too small to calculate
|
||||
// The tile rectangle width equals to image's width, height should be at least 1 pixel
|
||||
tileTotalPixels = destTotalPixels / 3;
|
||||
if (tileTotalPixels < sourceResolution.width * 1) {
|
||||
shouldScaleDown = NO;
|
||||
}
|
||||
|
||||
return shouldScaleDown;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue