Fix that `CGImageDestinationCreateWithData` 0 count arg will log a warning, this does not effect the encoding function.
This commit is contained in:
parent
124509e9b6
commit
e1b4e5a2d4
|
@ -193,7 +193,8 @@ const CFStringRef kCGImagePropertyAPNGUnclampedDelayTime = (__bridge CFStringRef
|
||||||
NSArray<SDImageFrame *> *frames = [SDImageCoderHelper framesFromAnimatedImage:image];
|
NSArray<SDImageFrame *> *frames = [SDImageCoderHelper framesFromAnimatedImage:image];
|
||||||
|
|
||||||
// Create an image destination. APNG does not support EXIF image orientation
|
// Create an image destination. APNG does not support EXIF image orientation
|
||||||
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, frames.count, NULL);
|
// The `CGImageDestinationCreateWithData` will log a warning when count is 0, use 1 instead.
|
||||||
|
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, frames.count ?: 1, NULL);
|
||||||
if (!imageDestination) {
|
if (!imageDestination) {
|
||||||
// Handle failure.
|
// Handle failure.
|
||||||
return nil;
|
return nil;
|
||||||
|
|
|
@ -269,7 +269,8 @@
|
||||||
NSArray<SDImageFrame *> *frames = [SDImageCoderHelper framesFromAnimatedImage:image];
|
NSArray<SDImageFrame *> *frames = [SDImageCoderHelper framesFromAnimatedImage:image];
|
||||||
|
|
||||||
// Create an image destination. GIF does not support EXIF image orientation
|
// Create an image destination. GIF does not support EXIF image orientation
|
||||||
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, frames.count, NULL);
|
// The `CGImageDestinationCreateWithData` will log a warning when count is 0, use 1 instead.
|
||||||
|
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, frames.count ?: 1, NULL);
|
||||||
if (!imageDestination) {
|
if (!imageDestination) {
|
||||||
// Handle failure.
|
// Handle failure.
|
||||||
return nil;
|
return nil;
|
||||||
|
|
Loading…
Reference in New Issue