diff --git a/SDWebImage/UIImage+GIF.m b/SDWebImage/UIImage+GIF.m index 6bee9a82..f29de5a3 100755 --- a/SDWebImage/UIImage+GIF.m +++ b/SDWebImage/UIImage+GIF.m @@ -21,7 +21,7 @@ #if SD_MAC return [[UIImage alloc] initWithData:data]; -#endif +#else CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); @@ -53,6 +53,7 @@ CFRelease(source); return staticImage; +#endif } - (BOOL)isGIF { diff --git a/SDWebImage/UIImage+WebP.m b/SDWebImage/UIImage+WebP.m index 7d7d19a0..2a25169d 100644 --- a/SDWebImage/UIImage+WebP.m +++ b/SDWebImage/UIImage+WebP.m @@ -60,8 +60,8 @@ static void FreeImageData(void *info, const void *data, size_t size) { #if SD_UIKIT || SD_WATCH int loopCount = WebPDemuxGetI(demuxer, WEBP_FF_LOOP_COUNT); -#endif int frameCount = WebPDemuxGetI(demuxer, WEBP_FF_FRAME_COUNT); +#endif int canvasWidth = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_WIDTH); int canvasHeight = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_HEIGHT); CGBitmapInfo bitmapInfo; @@ -78,8 +78,10 @@ static void FreeImageData(void *info, const void *data, size_t size) { } NSMutableArray *images = [NSMutableArray array]; +#if SD_UIKIT || SD_WATCH NSTimeInterval totalDuration = 0; int durations[frameCount]; +#endif do { UIImage *image; @@ -97,7 +99,7 @@ static void FreeImageData(void *info, const void *data, size_t size) { #if SD_MAC break; -#endif +#else int duration = iter.duration; if (duration <= 10) { @@ -108,7 +110,7 @@ static void FreeImageData(void *info, const void *data, size_t size) { totalDuration += duration; size_t count = images.count; durations[count - 1] = duration; - +#endif } while (WebPDemuxNextFrame(&iter)); WebPDemuxReleaseIterator(&iter);