Merge pull request #2152 from dreampiggy/little_refactor_and_deprecate

Move the imageLoopCount and isAnimated into UIImage+WebCache file, removed the outdated methods
This commit is contained in:
DreamPiggy 2018-01-23 11:48:05 +08:00 committed by GitHub
commit f4b61b909c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 322 additions and 231 deletions

View File

@ -97,6 +97,11 @@
321E60C71F38E91700405457 /* UIImage+ForceDecode.m in Sources */ = {isa = PBXBuildFile; fileRef = 321E60BD1F38E91700405457 /* UIImage+ForceDecode.m */; };
321E60C81F38E91700405457 /* UIImage+ForceDecode.m in Sources */ = {isa = PBXBuildFile; fileRef = 321E60BD1F38E91700405457 /* UIImage+ForceDecode.m */; };
321E60C91F38E91700405457 /* UIImage+ForceDecode.m in Sources */ = {isa = PBXBuildFile; fileRef = 321E60BD1F38E91700405457 /* UIImage+ForceDecode.m */; };
3237F9E820161AE000A88143 /* NSImage+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4397D2F51D0DE2DF00BB2784 /* NSImage+Additions.m */; };
3237F9E920161AE000A88143 /* NSImage+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4397D2F51D0DE2DF00BB2784 /* NSImage+Additions.m */; };
3237F9EA20161AE000A88143 /* NSImage+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4397D2F51D0DE2DF00BB2784 /* NSImage+Additions.m */; };
3237F9EB20161AE000A88143 /* NSImage+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4397D2F51D0DE2DF00BB2784 /* NSImage+Additions.m */; };
3237F9EC20161AE000A88143 /* NSImage+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4397D2F51D0DE2DF00BB2784 /* NSImage+Additions.m */; };
323F8B3E1F38EF770092B609 /* alpha_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 323F8B131F38EF770092B609 /* alpha_enc.c */; };
323F8B3F1F38EF770092B609 /* alpha_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 323F8B131F38EF770092B609 /* alpha_enc.c */; };
323F8B401F38EF770092B609 /* alpha_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 323F8B131F38EF770092B609 /* alpha_enc.c */; };
@ -319,6 +324,18 @@
3290FA0D1FA478AF0047D20C /* SDWebImageFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 3290FA031FA478AF0047D20C /* SDWebImageFrame.m */; };
3290FA0E1FA478AF0047D20C /* SDWebImageFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 3290FA031FA478AF0047D20C /* SDWebImageFrame.m */; };
3290FA0F1FA478AF0047D20C /* SDWebImageFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 3290FA031FA478AF0047D20C /* SDWebImageFrame.m */; };
329A18591FFF5DFD008C9A2F /* UIImage+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 329A18571FFF5DFD008C9A2F /* UIImage+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
329A185A1FFF5DFD008C9A2F /* UIImage+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 329A18571FFF5DFD008C9A2F /* UIImage+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
329A185B1FFF5DFD008C9A2F /* UIImage+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 329A18571FFF5DFD008C9A2F /* UIImage+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
329A185C1FFF5DFD008C9A2F /* UIImage+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 329A18571FFF5DFD008C9A2F /* UIImage+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
329A185D1FFF5DFD008C9A2F /* UIImage+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 329A18571FFF5DFD008C9A2F /* UIImage+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
329A185E1FFF5DFD008C9A2F /* UIImage+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 329A18571FFF5DFD008C9A2F /* UIImage+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
329A185F1FFF5DFD008C9A2F /* UIImage+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 329A18581FFF5DFD008C9A2F /* UIImage+WebCache.m */; };
329A18601FFF5DFD008C9A2F /* UIImage+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 329A18581FFF5DFD008C9A2F /* UIImage+WebCache.m */; };
329A18611FFF5DFD008C9A2F /* UIImage+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 329A18581FFF5DFD008C9A2F /* UIImage+WebCache.m */; };
329A18621FFF5DFD008C9A2F /* UIImage+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 329A18581FFF5DFD008C9A2F /* UIImage+WebCache.m */; };
329A18631FFF5DFD008C9A2F /* UIImage+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 329A18581FFF5DFD008C9A2F /* UIImage+WebCache.m */; };
329A18641FFF5DFD008C9A2F /* UIImage+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 329A18581FFF5DFD008C9A2F /* UIImage+WebCache.m */; };
32CF1C071FA496B000004BD1 /* SDWebImageCoderHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 32CF1C051FA496B000004BD1 /* SDWebImageCoderHelper.h */; settings = {ATTRIBUTES = (Public, ); }; };
32CF1C081FA496B000004BD1 /* SDWebImageCoderHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 32CF1C051FA496B000004BD1 /* SDWebImageCoderHelper.h */; settings = {ATTRIBUTES = (Public, ); }; };
32CF1C091FA496B000004BD1 /* SDWebImageCoderHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 32CF1C051FA496B000004BD1 /* SDWebImageCoderHelper.h */; settings = {ATTRIBUTES = (Public, ); }; };
@ -476,8 +493,8 @@
4397D2EA1D0DDD8C00BB2784 /* UIImage+GIF.h in Headers */ = {isa = PBXBuildFile; fileRef = A18A6CC5172DC28500419892 /* UIImage+GIF.h */; settings = {ATTRIBUTES = (Public, ); }; };
4397D2EB1D0DDD8C00BB2784 /* NSData+ImageContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D5B9140188EE8DD006D06BD /* NSData+ImageContentType.h */; settings = {ATTRIBUTES = (Public, ); }; };
4397D2ED1D0DDD8C00BB2784 /* mux_types.h in Headers */ = {isa = PBXBuildFile; fileRef = DA577CC91998E60B007367ED /* mux_types.h */; };
4397D2F61D0DE2DF00BB2784 /* NSImage+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 4397D2F41D0DE2DF00BB2784 /* NSImage+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
4397D2F71D0DE2DF00BB2784 /* NSImage+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 4397D2F51D0DE2DF00BB2784 /* NSImage+WebCache.m */; };
4397D2F61D0DE2DF00BB2784 /* NSImage+Additions.h in Headers */ = {isa = PBXBuildFile; fileRef = 4397D2F41D0DE2DF00BB2784 /* NSImage+Additions.h */; settings = {ATTRIBUTES = (Public, ); }; };
4397D2F71D0DE2DF00BB2784 /* NSImage+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4397D2F51D0DE2DF00BB2784 /* NSImage+Additions.m */; };
4397D2F81D0DF44200BB2784 /* MKAnnotationView+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 535699B415113E7300A4C397 /* MKAnnotationView+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
4397D2F91D0DF44A00BB2784 /* MKAnnotationView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 535699B515113E7300A4C397 /* MKAnnotationView+WebCache.m */; };
43A62A1B1D0E0A800089D7DD /* decode.h in Headers */ = {isa = PBXBuildFile; fileRef = DA577CC41998E60B007367ED /* decode.h */; };
@ -1320,6 +1337,8 @@
323F8B3D1F38EF770092B609 /* muxread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = muxread.c; sourceTree = "<group>"; };
3290FA021FA478AF0047D20C /* SDWebImageFrame.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDWebImageFrame.h; sourceTree = "<group>"; };
3290FA031FA478AF0047D20C /* SDWebImageFrame.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDWebImageFrame.m; sourceTree = "<group>"; };
329A18571FFF5DFD008C9A2F /* UIImage+WebCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIImage+WebCache.h"; path = "SDWebImage/UIImage+WebCache.h"; sourceTree = "<group>"; };
329A18581FFF5DFD008C9A2F /* UIImage+WebCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIImage+WebCache.m"; path = "SDWebImage/UIImage+WebCache.m"; sourceTree = "<group>"; };
32CF1C051FA496B000004BD1 /* SDWebImageCoderHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDWebImageCoderHelper.h; sourceTree = "<group>"; };
32CF1C061FA496B000004BD1 /* SDWebImageCoderHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDWebImageCoderHelper.m; sourceTree = "<group>"; };
4314D1991D0E0E3B004B36C9 /* libSDWebImage watchOS static.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libSDWebImage watchOS static.a"; sourceTree = BUILT_PRODUCTS_DIR; };
@ -1327,8 +1346,8 @@
4369C2751D9807EC007E863A /* UIView+WebCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIView+WebCache.h"; path = "SDWebImage/UIView+WebCache.h"; sourceTree = "<group>"; };
4369C2761D9807EC007E863A /* UIView+WebCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIView+WebCache.m"; path = "SDWebImage/UIView+WebCache.m"; sourceTree = "<group>"; };
4397D2F21D0DDD8C00BB2784 /* SDWebImage.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDWebImage.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4397D2F41D0DE2DF00BB2784 /* NSImage+WebCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSImage+WebCache.h"; path = "SDWebImage/NSImage+WebCache.h"; sourceTree = "<group>"; };
4397D2F51D0DE2DF00BB2784 /* NSImage+WebCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSImage+WebCache.m"; path = "SDWebImage/NSImage+WebCache.m"; sourceTree = "<group>"; };
4397D2F41D0DE2DF00BB2784 /* NSImage+Additions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSImage+Additions.h"; sourceTree = "<group>"; };
4397D2F51D0DE2DF00BB2784 /* NSImage+Additions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSImage+Additions.m"; sourceTree = "<group>"; };
43A918621D8308FE00B3925F /* SDImageCacheConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDImageCacheConfig.h; sourceTree = "<group>"; };
43A918631D8308FE00B3925F /* SDImageCacheConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDImageCacheConfig.m; sourceTree = "<group>"; };
43C892981D9D6DD70022038D /* anim_decode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = anim_decode.c; sourceTree = "<group>"; };
@ -1624,8 +1643,8 @@
4369C2851D9811BB007E863A /* WebCache Categories */ = {
isa = PBXGroup;
children = (
4397D2F41D0DE2DF00BB2784 /* NSImage+WebCache.h */,
4397D2F51D0DE2DF00BB2784 /* NSImage+WebCache.m */,
329A18571FFF5DFD008C9A2F /* UIImage+WebCache.h */,
329A18581FFF5DFD008C9A2F /* UIImage+WebCache.m */,
535699B415113E7300A4C397 /* MKAnnotationView+WebCache.h */,
535699B515113E7300A4C397 /* MKAnnotationView+WebCache.m */,
53922D93148C56230056699D /* UIButton+WebCache.h */,
@ -1762,6 +1781,8 @@
53EDFB921762547C00698166 /* UIImage+WebP.m */,
321E60BC1F38E91700405457 /* UIImage+ForceDecode.h */,
321E60BD1F38E91700405457 /* UIImage+ForceDecode.m */,
4397D2F41D0DE2DF00BB2784 /* NSImage+Additions.h */,
4397D2F51D0DE2DF00BB2784 /* NSImage+Additions.m */,
AB615301192DA24600A2D8E9 /* UIView+WebCacheOperation.h */,
AB615302192DA24600A2D8E9 /* UIView+WebCacheOperation.m */,
);
@ -1987,6 +2008,7 @@
80377C4A1F2F666300F89830 /* bit_writer_utils.h in Headers */,
4397D2F81D0DF44200BB2784 /* MKAnnotationView+WebCache.h in Headers */,
323F8BE71F38EF770092B609 /* vp8li_enc.h in Headers */,
329A185C1FFF5DFD008C9A2F /* UIImage+WebCache.h in Headers */,
4369C27A1D9807EC007E863A /* UIView+WebCache.h in Headers */,
80377DCC1F2F66A700F89830 /* lossless_common.h in Headers */,
321E60971F38E8ED00405457 /* SDWebImageImageIOCoder.h in Headers */,
@ -2078,6 +2100,7 @@
80377D501F2F66A700F89830 /* mips_macro.h in Headers */,
80377C291F2F666300F89830 /* thread_utils.h in Headers */,
4314D16D1D0E0E3B004B36C9 /* SDImageCache.h in Headers */,
329A185A1FFF5DFD008C9A2F /* UIImage+WebCache.h in Headers */,
4314D16F1D0E0E3B004B36C9 /* NSData+ImageContentType.h in Headers */,
80377C121F2F666300F89830 /* bit_reader_inl_utils.h in Headers */,
4314D1701D0E0E3B004B36C9 /* mux.h in Headers */,
@ -2142,6 +2165,7 @@
43A62A1B1D0E0A800089D7DD /* decode.h in Headers */,
321E608A1F38E8C800405457 /* SDWebImageCoder.h in Headers */,
80377C601F2F666400F89830 /* bit_reader_inl_utils.h in Headers */,
329A185D1FFF5DFD008C9A2F /* UIImage+WebCache.h in Headers */,
431BB6DC1D06D2C1006A3455 /* UIButton+WebCache.h in Headers */,
431BB6E11D06D2C1006A3455 /* SDWebImage.h in Headers */,
80377E311F2F66A800F89830 /* yuv.h in Headers */,
@ -2238,6 +2262,7 @@
4397D2D11D0DDD8C00BB2784 /* decode.h in Headers */,
80377E481F2F66A800F89830 /* dsp.h in Headers */,
323F8BE91F38EF770092B609 /* vp8li_enc.h in Headers */,
329A185E1FFF5DFD008C9A2F /* UIImage+WebCache.h in Headers */,
80377E761F2F66A800F89830 /* yuv.h in Headers */,
80377C7A1F2F666400F89830 /* bit_reader_inl_utils.h in Headers */,
80377E631F2F66A800F89830 /* lossless.h in Headers */,
@ -2260,7 +2285,7 @@
80377E661F2F66A800F89830 /* neon.h in Headers */,
4397D2DB1D0DDD8C00BB2784 /* UIImage+MultiFormat.h in Headers */,
4397D2DC1D0DDD8C00BB2784 /* SDWebImageOperation.h in Headers */,
4397D2F61D0DE2DF00BB2784 /* NSImage+WebCache.h in Headers */,
4397D2F61D0DE2DF00BB2784 /* NSImage+Additions.h in Headers */,
4397D2E11D0DDD8C00BB2784 /* SDWebImageDownloader.h in Headers */,
323F8BFB1F38EF770092B609 /* animi.h in Headers */,
4397D2E31D0DDD8C00BB2784 /* MKAnnotationView+WebCache.h in Headers */,
@ -2296,6 +2321,7 @@
80377C301F2F666300F89830 /* bit_writer_utils.h in Headers */,
431739541CDFC8B70008FEB9 /* types.h in Headers */,
323F8BE61F38EF770092B609 /* vp8li_enc.h in Headers */,
329A185B1FFF5DFD008C9A2F /* UIImage+WebCache.h in Headers */,
4369C2791D9807EC007E863A /* UIView+WebCache.h in Headers */,
80377D871F2F66A700F89830 /* lossless_common.h in Headers */,
321E60961F38E8ED00405457 /* SDWebImageImageIOCoder.h in Headers */,
@ -2391,6 +2417,7 @@
321E60941F38E8ED00405457 /* SDWebImageImageIOCoder.h in Headers */,
431738BD1CDFC2660008FEB9 /* decode.h in Headers */,
80377D0B1F2F66A100F89830 /* mips_macro.h in Headers */,
329A18591FFF5DFD008C9A2F /* UIImage+WebCache.h in Headers */,
5376131A155AD0D5005750A4 /* SDWebImageDownloader.h in Headers */,
4369C2771D9807EC007E863A /* UIView+WebCache.h in Headers */,
80377CEF1F2F66A100F89830 /* dsp.h in Headers */,
@ -2700,6 +2727,7 @@
80377C4E1F2F666300F89830 /* filters_utils.c in Sources */,
321E60B91F38E90100405457 /* SDWebImageWebPCoder.m in Sources */,
80377DEB1F2F66A700F89830 /* yuv.c in Sources */,
3237F9E920161AE000A88143 /* NSImage+Additions.m in Sources */,
00733A551BC4880000A5A117 /* SDWebImageDownloader.m in Sources */,
80377EB71F2F66D400F89830 /* alpha_dec.c in Sources */,
80377DC61F2F66A700F89830 /* enc.c in Sources */,
@ -2794,6 +2822,7 @@
00733A5E1BC4880000A5A117 /* UIImage+MultiFormat.m in Sources */,
80377DD01F2F66A700F89830 /* lossless_enc_neon.c in Sources */,
80377DE21F2F66A700F89830 /* rescaler.c in Sources */,
329A18621FFF5DFD008C9A2F /* UIImage+WebCache.m in Sources */,
80377DAD1F2F66A700F89830 /* argb_mips_dsp_r2.c in Sources */,
00733A601BC4880000A5A117 /* UIImageView+HighlightedWebCache.m in Sources */,
323F8BAB1F38EF770092B609 /* picture_psnr_enc.c in Sources */,
@ -2817,6 +2846,7 @@
80377EA01F2F66D400F89830 /* vp8_dec.c in Sources */,
80377EA31F2F66D400F89830 /* vp8l_dec.c in Sources */,
80377E9D1F2F66D400F89830 /* io_dec.c in Sources */,
329A18601FFF5DFD008C9A2F /* UIImage+WebCache.m in Sources */,
80377D541F2F66A700F89830 /* rescaler_mips32.c in Sources */,
80377D331F2F66A700F89830 /* dec.c in Sources */,
323F8BAF1F38EF770092B609 /* picture_rescale_enc.c in Sources */,
@ -2898,6 +2928,7 @@
80377D1F1F2F66A700F89830 /* alpha_processing_neon.c in Sources */,
4314D1401D0E0E3B004B36C9 /* UIImageView+WebCache.m in Sources */,
43A9186C1D8308FE00B3925F /* SDImageCacheConfig.m in Sources */,
3237F9EC20161AE000A88143 /* NSImage+Additions.m in Sources */,
4314D1411D0E0E3B004B36C9 /* SDWebImageDownloaderOperation.m in Sources */,
80377D561F2F66A700F89830 /* rescaler_neon.c in Sources */,
80377D551F2F66A700F89830 /* rescaler_msa.c in Sources */,
@ -2960,6 +2991,7 @@
80377ED01F2F66D500F89830 /* vp8_dec.c in Sources */,
80377ED31F2F66D500F89830 /* vp8l_dec.c in Sources */,
80377ECD1F2F66D500F89830 /* io_dec.c in Sources */,
329A18631FFF5DFD008C9A2F /* UIImage+WebCache.m in Sources */,
80377E231F2F66A800F89830 /* rescaler_mips32.c in Sources */,
80377E021F2F66A800F89830 /* dec.c in Sources */,
323F8BB21F38EF770092B609 /* picture_rescale_enc.c in Sources */,
@ -3041,6 +3073,7 @@
323F8C0C1F38EF770092B609 /* muxedit.c in Sources */,
80377DEE1F2F66A800F89830 /* alpha_processing_neon.c in Sources */,
43C892A41D9D6DDD0022038D /* demux.c in Sources */,
3237F9EA20161AE000A88143 /* NSImage+Additions.m in Sources */,
431BB6B61D06D2C1006A3455 /* UIImage+WebP.m in Sources */,
80377E251F2F66A800F89830 /* rescaler_neon.c in Sources */,
80377E241F2F66A800F89830 /* rescaler_msa.c in Sources */,
@ -3100,7 +3133,7 @@
321E60911F38E8C800405457 /* SDWebImageCoder.m in Sources */,
80377C8A1F2F666400F89830 /* quant_levels_utils.c in Sources */,
4397D27F1D0DDD8C00BB2784 /* UIImage+WebP.m in Sources */,
4397D2F71D0DE2DF00BB2784 /* NSImage+WebCache.m in Sources */,
4397D2F71D0DE2DF00BB2784 /* NSImage+Additions.m in Sources */,
80377E751F2F66A800F89830 /* yuv.c in Sources */,
43C892A01D9D6DDA0022038D /* anim_decode.c in Sources */,
80377E4A1F2F66A800F89830 /* enc_mips_dsp_r2.c in Sources */,
@ -3124,6 +3157,7 @@
80377EE01F2F66D500F89830 /* vp8_dec.c in Sources */,
32CF1C121FA496B000004BD1 /* SDWebImageCoderHelper.m in Sources */,
80377E521F2F66A800F89830 /* filters_msa.c in Sources */,
329A18641FFF5DFD008C9A2F /* UIImage+WebCache.m in Sources */,
80377C821F2F666400F89830 /* filters_utils.c in Sources */,
4397D28C1D0DDD8C00BB2784 /* UIImageView+WebCache.m in Sources */,
80377E581F2F66A800F89830 /* lossless_enc_mips32.c in Sources */,
@ -3278,6 +3312,7 @@
80377DA61F2F66A700F89830 /* yuv.c in Sources */,
321E60B81F38E90100405457 /* SDWebImageWebPCoder.m in Sources */,
43CE757A1CFE9427006C64D0 /* FLAnimatedImage.m in Sources */,
3237F9E820161AE000A88143 /* NSImage+Additions.m in Sources */,
80377D811F2F66A700F89830 /* enc.c in Sources */,
80377EA71F2F66D400F89830 /* alpha_dec.c in Sources */,
80377D8F1F2F66A700F89830 /* lossless_mips_dsp_r2.c in Sources */,
@ -3372,6 +3407,7 @@
43CE75801CFE9427006C64D0 /* FLAnimatedImageView.m in Sources */,
4369C2801D9807EC007E863A /* UIView+WebCache.m in Sources */,
80377D8B1F2F66A700F89830 /* lossless_enc_neon.c in Sources */,
329A18611FFF5DFD008C9A2F /* UIImage+WebCache.m in Sources */,
80377D9D1F2F66A700F89830 /* rescaler.c in Sources */,
80377D681F2F66A700F89830 /* argb_mips_dsp_r2.c in Sources */,
323F8BAA1F38EF770092B609 /* picture_psnr_enc.c in Sources */,
@ -3425,6 +3461,7 @@
321E60B61F38E90100405457 /* SDWebImageWebPCoder.m in Sources */,
43CE75791CFE9427006C64D0 /* FLAnimatedImage.m in Sources */,
80377CF71F2F66A100F89830 /* enc.c in Sources */,
3237F9EB20161AE000A88143 /* NSImage+Additions.m in Sources */,
80377E871F2F66D000F89830 /* alpha_dec.c in Sources */,
80377D051F2F66A100F89830 /* lossless_mips_dsp_r2.c in Sources */,
80377C0A1F2F665300F89830 /* random_utils.c in Sources */,
@ -3519,6 +3556,7 @@
43CE757F1CFE9427006C64D0 /* FLAnimatedImageView.m in Sources */,
4369C27E1D9807EC007E863A /* UIView+WebCache.m in Sources */,
80377D011F2F66A100F89830 /* lossless_enc_neon.c in Sources */,
329A185F1FFF5DFD008C9A2F /* UIImage+WebCache.m in Sources */,
80377D131F2F66A100F89830 /* rescaler.c in Sources */,
80377CDE1F2F66A100F89830 /* argb_mips_dsp_r2.c in Sources */,
323F8BA81F38EF770092B609 /* picture_psnr_enc.c in Sources */,

View File

@ -37,6 +37,6 @@ typedef NS_ENUM(NSInteger, SDImageFormat) {
@param format Format as SDImageFormat
@return The UTType as CFStringRef
*/
+ (nonnull CFStringRef)sd_UTTypeFromSDImageFormat:(SDImageFormat)format;
+ (nonnull CFStringRef)sd_UTTypeFromSDImageFormat:(SDImageFormat)format CF_RETURNS_NOT_RETAINED;
@end

View File

@ -0,0 +1,25 @@
/*
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <rs@dailymotion.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#import "SDWebImageCompat.h"
// This category is provided to easily write cross-platform code. For common usage, see `UIImage+WebCache`.
#if SD_MAC
@interface NSImage (Additions)
@property (nonatomic, readonly, nullable) CGImageRef CGImage;
@property (nonatomic, readonly, nullable) NSArray<NSImage *> *images;
@property (nonatomic, readonly) CGFloat scale;
- (nonnull instancetype)initWithCGImage:(nonnull CGImageRef)cgImage scale:(CGFloat)scale;
@end
#endif

View File

@ -0,0 +1,53 @@
/*
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <rs@dailymotion.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#import "NSImage+Additions.h"
#if SD_MAC
@implementation NSImage (Additions)
- (CGImageRef)CGImage {
NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height);
CGImageRef cgImage = [self CGImageForProposedRect:&imageRect context:NULL hints:nil];
return cgImage;
}
- (NSArray<NSImage *> *)images {
return nil;
}
- (CGFloat)scale {
CGFloat scale = 1;
NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height);
NSImageRep *rep = [self bestRepresentationForRect:imageRect context:NULL hints:nil];
NSInteger pixelsWide = rep.pixelsWide;
CGFloat width = rep.size.width;
if (width > 0) {
scale = pixelsWide / width;
}
return scale;
}
- (instancetype)initWithCGImage:(CGImageRef)cgImage scale:(CGFloat)scale {
NSSize size;
if (cgImage && scale > 0) {
NSInteger pixelsWide = CGImageGetWidth(cgImage);
NSInteger pixelsHigh = CGImageGetHeight(cgImage);
CGFloat width = pixelsWide / scale;
CGFloat height = pixelsHigh / scale;
size = NSMakeSize(width, height);
} else {
size = NSZeroSize;
}
return [self initWithCGImage:cgImage size:size];
}
@end
#endif

View File

@ -1,23 +0,0 @@
/*
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <rs@dailymotion.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#import "SDWebImageCompat.h"
#if SD_MAC
#import <Cocoa/Cocoa.h>
@interface NSImage (WebCache)
- (CGImageRef)CGImage;
- (NSArray<NSImage *> *)images;
- (BOOL)isGIF;
@end
#endif

View File

@ -1,41 +0,0 @@
/*
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <rs@dailymotion.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#import "NSImage+WebCache.h"
#if SD_MAC
@implementation NSImage (WebCache)
- (CGImageRef)CGImage {
NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height);
CGImageRef cgImage = [self CGImageForProposedRect:&imageRect context:NULL hints:nil];
return cgImage;
}
- (NSArray<NSImage *> *)images {
return nil;
}
- (BOOL)isGIF {
BOOL isGIF = NO;
for (NSImageRep *rep in self.representations) {
if ([rep isKindOfClass:[NSBitmapImageRep class]]) {
NSBitmapImageRep *bitmapRep = (NSBitmapImageRep *)rep;
NSUInteger frameCount = [[bitmapRep valueForProperty:NSImageFrameCount] unsignedIntegerValue];
isGIF = frameCount > 1 ? YES : NO;
break;
}
}
return isGIF;
}
@end
#endif

View File

@ -8,7 +8,7 @@
#import "SDImageCache.h"
#import <CommonCrypto/CommonDigest.h>
#import "NSImage+WebCache.h"
#import "NSImage+Additions.h"
#import "SDWebImageCodersManager.h"
static void * SDImageCacheContext = &SDImageCacheContext;

View File

@ -8,8 +8,8 @@
#import "SDWebImageCoderHelper.h"
#import "SDWebImageFrame.h"
#import "UIImage+MultiFormat.h"
#import "NSImage+WebCache.h"
#import "NSImage+Additions.h"
#import "NSData+ImageContentType.h"
#import <ImageIO/ImageIO.h>
@implementation SDWebImageCoderHelper

View File

@ -13,10 +13,9 @@
#error SDWebImage does not support Objective-C Garbage Collection
#endif
// Apple's defines from TargetConditionals.h are a bit weird.
// Seems like TARGET_OS_MAC is always defined (on all platforms).
// To determine if we are running on OSX, we can only rely on TARGET_OS_IPHONE=0 and all the other platforms
#if !TARGET_OS_IPHONE && !TARGET_OS_IOS && !TARGET_OS_TV && !TARGET_OS_WATCH
// To determine if we are running on macOS, use TARGET_OS_OSX in Xcode 8
#if TARGET_OS_OSX
#define SD_MAC 1
#else
#define SD_MAC 0
@ -81,11 +80,11 @@
#define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type
#endif
FOUNDATION_EXPORT UIImage *SDScaledImageForKey(NSString *key, UIImage *image);
FOUNDATION_EXPORT UIImage * _Nullable SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullable image);
typedef void(^SDWebImageNoParamsBlock)(void);
FOUNDATION_EXPORT NSString *const SDWebImageErrorDomain;
FOUNDATION_EXPORT NSString *const _Nonnull SDWebImageErrorDomain;
#ifndef dispatch_queue_async_safe
#define dispatch_queue_async_safe(queue, block)\

View File

@ -7,7 +7,8 @@
*/
#import "SDWebImageCompat.h"
#import "UIImage+MultiFormat.h"
#import "UIImage+WebCache.h"
#import "NSImage+Additions.h"
#if !__has_feature(objc_arc)
#error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag
@ -22,9 +23,7 @@ inline UIImage *SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullabl
return nil;
}
#if SD_MAC
return image;
#elif SD_UIKIT || SD_WATCH
#if SD_UIKIT || SD_WATCH
if ((image.images).count > 0) {
NSMutableArray<UIImage *> *scaledImages = [NSMutableArray array];
@ -38,10 +37,13 @@ inline UIImage *SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullabl
}
return animatedImage;
} else {
#endif
#if SD_WATCH
if ([[WKInterfaceDevice currentDevice] respondsToSelector:@selector(screenScale)]) {
#elif SD_UIKIT
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
#elif SD_MAC
if ([[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)]) {
#endif
CGFloat scale = 1;
if (key.length >= 8) {
@ -55,11 +57,17 @@ inline UIImage *SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullabl
scale = 3.0;
}
}
UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation];
image = scaledImage;
if (scale > 1) {
#if SD_UIKIT || SD_WATCH
UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation];
#else
UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale];
#endif
image = scaledImage;
}
}
return image;
#if SD_UIKIT || SD_WATCH
}
#endif
}

View File

@ -53,14 +53,11 @@ FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadFinishNotification
*/
@property (strong, nonatomic, readonly, nullable) NSURLSessionTask *dataTask;
@property (assign, nonatomic) BOOL shouldDecompressImages;
/**
* Was used to determine whether the URL connection should consult the credential storage for authenticating the connection.
* @deprecated Not used for a couple of versions
* Decompressing images that are downloaded and cached can improve performance but can consume lot of memory.
* Defaults to YES. Set this to NO if you are experiencing a crash due to excessive memory consumption.
*/
@property (nonatomic, assign) BOOL shouldUseCredentialStorage __deprecated_msg("Property deprecated. Does nothing. Kept only for backwards compatibility");
@property (assign, nonatomic) BOOL shouldDecompressImages;
/**
* The credential used for authentication challenges in `-connection:didReceiveAuthenticationChallenge:`.

View File

@ -8,7 +8,7 @@
#import "SDWebImageDownloaderOperation.h"
#import "SDWebImageManager.h"
#import "NSImage+WebCache.h"
#import "NSImage+Additions.h"
#import "SDWebImageCodersManager.h"
NSString *const SDWebImageDownloadStartNotification = @"SDWebImageDownloadStartNotification";

View File

@ -11,7 +11,7 @@
@interface SDWebImageFrame : NSObject
// This class is used for creating animated images via `animatedImageWithFrames` in `SDWebImageCoderHelper`. Attension if you need animated images loop count, use `sd_imageLoopCount` property in `UIImage+MultiFormat`
// This class is used for creating animated images via `animatedImageWithFrames` in `SDWebImageCoderHelper`. Attension if you need animated images loop count, use `sd_imageLoopCount` property in `UIImage+WebCache.h`
/**
The image of current frame. You should not set an animated image.

View File

@ -7,10 +7,10 @@
*/
#import "SDWebImageGIFCoder.h"
#import "NSImage+WebCache.h"
#import "NSImage+Additions.h"
#import "UIImage+WebCache.h"
#import <ImageIO/ImageIO.h>
#import "NSData+ImageContentType.h"
#import "UIImage+MultiFormat.h"
#import "SDWebImageCoderHelper.h"
@implementation SDWebImageGIFCoder

View File

@ -8,7 +8,7 @@
#import "SDWebImageImageIOCoder.h"
#import "SDWebImageCoderHelper.h"
#import "NSImage+WebCache.h"
#import "NSImage+Additions.h"
#import <ImageIO/ImageIO.h>
#import "NSData+ImageContentType.h"

View File

@ -7,7 +7,7 @@
*/
#import "SDWebImageManager.h"
#import "NSImage+WebCache.h"
#import "NSImage+Additions.h"
#import <objc/message.h>
@interface SDWebImageCombinedOperation : NSObject <SDWebImageOperation>

View File

@ -10,8 +10,8 @@
#import "SDWebImageWebPCoder.h"
#import "SDWebImageCoderHelper.h"
#import "NSImage+WebCache.h"
#import "UIImage+MultiFormat.h"
#import "NSImage+Additions.h"
#import "UIImage+WebCache.h"
#if __has_include(<webp/decode.h>) && __has_include(<webp/encode.h>) && __has_include(<webp/demux.h>) && __has_include(<webp/mux.h>)
#import <webp/decode.h>
#import <webp/encode.h>

View File

@ -10,8 +10,20 @@
@interface UIImage (ForceDecode)
+ (nullable UIImage *)decodedImageWithImage:(nullable UIImage *)image;
/**
Decompress (force decode before rendering) the provided image
+ (nullable UIImage *)decodedAndScaledDownImageWithImage:(nullable UIImage *)image;
@param image The image to be decompressed
@return The decompressed image
*/
+ (nullable UIImage *)sd_decodedImageWithImage:(nullable UIImage *)image;
/**
Decompress and scale down the provided image
@param image The image to be decompressed
@return The decompressed and scaled down image
*/
+ (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image;
@end

View File

@ -11,7 +11,7 @@
@implementation UIImage (ForceDecode)
+ (UIImage *)decodedImageWithImage:(UIImage *)image {
+ (UIImage *)sd_decodedImageWithImage:(UIImage *)image {
if (!image) {
return nil;
}
@ -19,7 +19,7 @@
return [[SDWebImageCodersManager sharedInstance] decompressedImageWithImage:image data:&tempData options:@{SDWebImageCoderScaleDownLargeImagesKey: @(NO)}];
}
+ (UIImage *)decodedAndScaledDownImageWithImage:(UIImage *)image {
+ (UIImage *)sd_decodedAndScaledDownImageWithImage:(UIImage *)image {
if (!image) {
return nil;
}

View File

@ -15,11 +15,6 @@
* Creates an animated UIImage from an NSData.
* For static GIF, will create an UIImage with `images` array set to nil. For animated GIF, will create an UIImage with valid `images` array.
*/
+ (UIImage *)sd_animatedGIFWithData:(NSData *)data;
/**
* Checks if an UIImage instance is a GIF. Will use the `images` array.
*/
- (BOOL)isGIF;
+ (nullable UIImage *)sd_animatedGIFWithData:(nullable NSData *)data;
@end

View File

@ -9,7 +9,6 @@
#import "UIImage+GIF.h"
#import "SDWebImageGIFCoder.h"
#import "NSImage+WebCache.h"
@implementation UIImage (GIF)
@ -20,8 +19,4 @@
return [[SDWebImageGIFCoder sharedCoder] decodedImageWithData:data];
}
- (BOOL)isGIF {
return (self.images != nil);
}
@end

View File

@ -12,19 +12,26 @@
@interface UIImage (MultiFormat)
/**
* UIKit:
* For static image format, this value is always 0.
* For animated image format, 0 means infinite looping.
* Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods.
* AppKit:
* NSImage currently only support animated via GIF imageRep unlike UIImage.
* The getter of this property will get the loop count from GIF imageRep
* The setter of this property will set the loop count from GIF imageRep
*/
@property (nonatomic, assign) NSUInteger sd_imageLoopCount;
Create and decode a image with the specify image data
@param data The image data
@return The created image
*/
+ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data;
/**
Encode the current image to the data, the image format is unspecified
@return The encoded data. If can't encode, return nil
*/
- (nullable NSData *)sd_imageData;
/**
Encode the current image to data with the specify image format
@param imageFormat The specify image format
@return The encoded data. If can't encode, return nil
*/
- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat;
@end

View File

@ -7,52 +7,10 @@
*/
#import "UIImage+MultiFormat.h"
#import "objc/runtime.h"
#import "SDWebImageCodersManager.h"
@implementation UIImage (MultiFormat)
#if SD_MAC
- (NSUInteger)sd_imageLoopCount {
NSUInteger imageLoopCount = 0;
for (NSImageRep *rep in self.representations) {
if ([rep isKindOfClass:[NSBitmapImageRep class]]) {
NSBitmapImageRep *bitmapRep = (NSBitmapImageRep *)rep;
imageLoopCount = [[bitmapRep valueForProperty:NSImageLoopCount] unsignedIntegerValue];
break;
}
}
return imageLoopCount;
}
- (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount {
for (NSImageRep *rep in self.representations) {
if ([rep isKindOfClass:[NSBitmapImageRep class]]) {
NSBitmapImageRep *bitmapRep = (NSBitmapImageRep *)rep;
[bitmapRep setProperty:NSImageLoopCount withValue:@(sd_imageLoopCount)];
break;
}
}
}
#else
- (NSUInteger)sd_imageLoopCount {
NSUInteger imageLoopCount = 0;
NSNumber *value = objc_getAssociatedObject(self, @selector(sd_imageLoopCount));
if ([value isKindOfClass:[NSNumber class]]) {
imageLoopCount = value.unsignedIntegerValue;
}
return imageLoopCount;
}
- (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount {
NSNumber *value = @(sd_imageLoopCount);
objc_setAssociatedObject(self, @selector(sd_imageLoopCount), value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
#endif
+ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data {
return [[SDWebImageCodersManager sharedInstance] decodedImageWithData:data];
}

View File

@ -0,0 +1,32 @@
/*
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <rs@dailymotion.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#import "SDWebImageCompat.h"
@interface UIImage (WebCache)
/**
* UIKit:
* For static image format, this value is always 0.
* For animated image format, 0 means infinite looping.
* Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods.
* AppKit:
* NSImage currently only support animated via GIF imageRep unlike UIImage.
* The getter of this property will get the loop count from GIF imageRep
* The setter of this property will set the loop count from GIF imageRep
*/
@property (nonatomic, assign) NSUInteger sd_imageLoopCount;
/**
* UIKit:
* Check the `images` array property
* AppKit:
* NSImage currently only support animated via GIF imageRep unlike UIImage. It will check all the imageRef
*/
@property (nonatomic, assign, readonly) BOOL sd_isAnimated;
@end

View File

@ -0,0 +1,80 @@
/*
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <rs@dailymotion.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#import "UIImage+WebCache.h"
#if SD_UIKIT
#import "objc/runtime.h"
@implementation UIImage (WebCache)
- (NSUInteger)sd_imageLoopCount {
NSUInteger imageLoopCount = 0;
NSNumber *value = objc_getAssociatedObject(self, @selector(sd_imageLoopCount));
if ([value isKindOfClass:[NSNumber class]]) {
imageLoopCount = value.unsignedIntegerValue;
}
return imageLoopCount;
}
- (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount {
NSNumber *value = @(sd_imageLoopCount);
objc_setAssociatedObject(self, @selector(sd_imageLoopCount), value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (BOOL)sd_isAnimated {
return (self.images != nil);
}
@end
#endif
#if SD_MAC
@implementation NSImage (WebCache)
- (NSUInteger)sd_imageLoopCount {
NSUInteger imageLoopCount = 0;
for (NSImageRep *rep in self.representations) {
if ([rep isKindOfClass:[NSBitmapImageRep class]]) {
NSBitmapImageRep *bitmapRep = (NSBitmapImageRep *)rep;
imageLoopCount = [[bitmapRep valueForProperty:NSImageLoopCount] unsignedIntegerValue];
break;
}
}
return imageLoopCount;
}
- (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount {
for (NSImageRep *rep in self.representations) {
if ([rep isKindOfClass:[NSBitmapImageRep class]]) {
NSBitmapImageRep *bitmapRep = (NSBitmapImageRep *)rep;
[bitmapRep setProperty:NSImageLoopCount withValue:@(sd_imageLoopCount)];
break;
}
}
}
- (BOOL)sd_isAnimated {
BOOL isGIF = NO;
for (NSImageRep *rep in self.representations) {
if ([rep isKindOfClass:[NSBitmapImageRep class]]) {
NSBitmapImageRep *bitmapRep = (NSBitmapImageRep *)rep;
NSUInteger frameCount = [[bitmapRep valueForProperty:NSImageFrameCount] unsignedIntegerValue];
isGIF = frameCount > 1 ? YES : NO;
break;
}
}
return isGIF;
}
@end
#endif

View File

@ -12,17 +12,6 @@
@interface UIImage (WebP)
/**
* Get the current WebP image loop count, the default value is 0.
* For static WebP image, the value is 0.
* For animated WebP image, 0 means repeat the animation indefinitely.
* Note that because of the limitations of categories this property can get out of sync
* if you create another instance with CGImage or other methods.
* @return WebP image loop count
* @deprecated use `sd_imageLoopCount` instead.
*/
- (NSInteger)sd_webpLoopCount __deprecated_msg("Method deprecated. Use `sd_imageLoopCount` in `UIImage+MultiFormat.h`");
+ (nullable UIImage *)sd_imageWithWebPData:(nullable NSData *)data;
@end

View File

@ -10,14 +10,9 @@
#import "UIImage+WebP.h"
#import "SDWebImageWebPCoder.h"
#import "UIImage+MultiFormat.h"
@implementation UIImage (WebP)
- (NSInteger)sd_webpLoopCount {
return self.sd_imageLoopCount;
}
+ (nullable UIImage *)sd_imageWithWebPData:(nullable NSData *)data {
if (!data) {
return nil;

View File

@ -154,31 +154,6 @@
progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
completed:(nullable SDExternalCompletionBlock)completedBlock;
/**
* Set the imageView `image` with an `url` and custom options. The placeholder image is from previous cached image and will use the provided one instead if the query failed.
* This method was designed to ensure that placeholder and query cache process happened in the same runloop to avoid flashing on cell during two `setImage:` call. But it's really misunderstanding and deprecated.
* This can be done by using `sd_setImageWithURL:` with `SDWebImageQueryDiskSync`. But take care that if the memory cache missed, query disk cache synchronously may reduce the frame rate
*
* The download is asynchronous and cached.
*
* @param url The url for the image.
* @param placeholder The image to be set initially, until the image request finishes.
* @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.
* @param progressBlock A block called while image is downloading
* @note the progress block is executed on a background queue
* @param completedBlock A block called when operation has been completed. This block has no return value
* and takes the requested UIImage as first parameter. In case of error the image parameter
* is nil and the second parameter may contain an NSError. The third parameter is a Boolean
* indicating if the image was retrieved from the local cache or from the network.
* The fourth parameter is the original image url.
* @deprecated consider using `SDWebImageQueryDiskSync` options with `sd_setImageWithURL:` instead
*/
- (void)sd_setImageWithPreviousCachedImageWithURL:(nullable NSURL *)url
placeholderImage:(nullable UIImage *)placeholder
options:(SDWebImageOptions)options
progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
completed:(nullable SDExternalCompletionBlock)completedBlock __deprecated_msg("This method is misunderstanding and deprecated, consider using `SDWebImageQueryDiskSync` options with `sd_setImageWithURL:` instead");
#if SD_UIKIT
#pragma mark - Animation of multiple images
@ -190,6 +165,9 @@
*/
- (void)sd_setAnimationImagesWithURLs:(nonnull NSArray<NSURL *> *)arrayOfURLs;
/**
* Cancel the current animation images load
*/
- (void)sd_cancelCurrentAnimationImagesLoad;
#endif

View File

@ -54,17 +54,6 @@
completed:completedBlock];
}
- (void)sd_setImageWithPreviousCachedImageWithURL:(nullable NSURL *)url
placeholderImage:(nullable UIImage *)placeholder
options:(SDWebImageOptions)options
progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
completed:(nullable SDExternalCompletionBlock)completedBlock {
NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:url];
UIImage *lastPreviousCachedImage = [[SDImageCache sharedImageCache] imageFromCacheForKey:key];
[self sd_setImageWithURL:url placeholderImage:lastPreviousCachedImage ?: placeholder options:options progress:progressBlock completed:completedBlock];
}
#if SD_UIKIT
#pragma mark - Animation of multiple images

View File

@ -34,7 +34,7 @@ typedef void(^SDSetImageBlock)(UIImage * _Nullable image, NSData * _Nullable ima
*
* @note Note that because of the limitations of categories this property can get out of sync if you use setImage: directly.
*/
- (nullable NSURL *)sd_imageURL;
@property (nonatomic, strong, readonly, nullable) NSURL *sd_imageURL;
/**
* The current image loading progress associated to the view. The unit count is the received size and excepted size of download.

View File

@ -32,6 +32,10 @@ static char TAG_ACTIVITY_SHOW;
return objc_getAssociatedObject(self, &imageURLKey);
}
- (void)setSd_imageURL:(NSURL * _Nullable)sd_imageURL {
objc_setAssociatedObject(self, &imageURLKey, sd_imageURL, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (NSProgress *)sd_imageProgress {
NSProgress *progress = objc_getAssociatedObject(self, @selector(sd_imageProgress));
if (!progress) {
@ -65,7 +69,7 @@ static char TAG_ACTIVITY_SHOW;
context:(nullable NSDictionary *)context {
NSString *validOperationKey = operationKey ?: NSStringFromClass([self class]);
[self sd_cancelImageLoadOperationWithKey:validOperationKey];
objc_setAssociatedObject(self, &imageURLKey, url, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
self.sd_imageURL = url;
if (!(options & SDWebImageDelayPlaceholder)) {
if ([context valueForKey:SDWebImageInternalSetImageGroupKey]) {

View File

@ -21,13 +21,13 @@
@implementation SDWebImageDecoderTests
- (void)test01ThatDecodedImageWithNilImageReturnsNil {
expect([UIImage decodedImageWithImage:nil]).to.beNil();
expect([UIImage sd_decodedImageWithImage:nil]).to.beNil();
}
- (void)test02ThatDecodedImageWithImageWorksWithARegularJPGImage {
NSString * testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestImage" ofType:@"jpg"];
UIImage *image = [UIImage imageWithContentsOfFile:testImagePath];
UIImage *decodedImage = [UIImage decodedImageWithImage:image];
UIImage *decodedImage = [UIImage sd_decodedImageWithImage:image];
expect(decodedImage).toNot.beNil();
expect(decodedImage).toNot.equal(image);
expect(decodedImage.size.width).to.equal(image.size.width);
@ -38,7 +38,7 @@
NSString * testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestImage" ofType:@"gif"];
UIImage *image = [UIImage imageWithContentsOfFile:testImagePath];
UIImage *animatedImage = [UIImage animatedImageWithImages:@[image] duration:0];
UIImage *decodedImage = [UIImage decodedImageWithImage:animatedImage];
UIImage *decodedImage = [UIImage sd_decodedImageWithImage:animatedImage];
expect(decodedImage).toNot.beNil();
expect(decodedImage).to.equal(animatedImage);
}
@ -46,7 +46,7 @@
- (void)test04ThatDecodedImageWithImageDoesNotDecodeImagesWithAlpha {
NSString * testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestImage" ofType:@"png"];
UIImage *image = [UIImage imageWithContentsOfFile:testImagePath];
UIImage *decodedImage = [UIImage decodedImageWithImage:image];
UIImage *decodedImage = [UIImage sd_decodedImageWithImage:image];
expect(decodedImage).toNot.beNil();
expect(decodedImage).to.equal(image);
}
@ -54,7 +54,7 @@
- (void)test05ThatDecodedImageWithImageWorksEvenWithMonochromeImage {
NSString * testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"MonochromeTestImage" ofType:@"jpg"];
UIImage *image = [UIImage imageWithContentsOfFile:testImagePath];
UIImage *decodedImage = [UIImage decodedImageWithImage:image];
UIImage *decodedImage = [UIImage sd_decodedImageWithImage:image];
expect(decodedImage).toNot.beNil();
expect(decodedImage).toNot.equal(image);
expect(decodedImage.size.width).to.equal(image.size.width);
@ -64,7 +64,7 @@
- (void)test06ThatDecodeAndScaleDownImageWorks {
NSString * testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestImageLarge" ofType:@"jpg"];
UIImage *image = [UIImage imageWithContentsOfFile:testImagePath];
UIImage *decodedImage = [UIImage decodedAndScaledDownImageWithImage:image];
UIImage *decodedImage = [UIImage sd_decodedAndScaledDownImageWithImage:image];
expect(decodedImage).toNot.beNil();
expect(decodedImage).toNot.equal(image);
expect(decodedImage.size.width).toNot.equal(image.size.width);
@ -75,7 +75,7 @@
- (void)test07ThatDecodeAndScaleDownImageDoesNotScaleSmallerImage {
NSString * testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestImage" ofType:@"jpg"];
UIImage *image = [UIImage imageWithContentsOfFile:testImagePath];
UIImage *decodedImage = [UIImage decodedAndScaledDownImageWithImage:image];
UIImage *decodedImage = [UIImage sd_decodedAndScaledDownImageWithImage:image];
expect(decodedImage).toNot.beNil();
expect(decodedImage).toNot.equal(image);
expect(decodedImage.size.width).to.equal(image.size.width);

View File

@ -31,6 +31,7 @@ FOUNDATION_EXPORT const unsigned char WebImageVersionString[];
#import <SDWebImage/UIButton+WebCache.h>
#import <SDWebImage/SDWebImagePrefetcher.h>
#import <SDWebImage/UIView+WebCacheOperation.h>
#import <SDWebImage/UIImage+WebCache.h>
#import <SDWebImage/UIImage+MultiFormat.h>
#import <SDWebImage/SDWebImageOperation.h>
#import <SDWebImage/SDWebImageDownloader.h>
@ -52,7 +53,7 @@ FOUNDATION_EXPORT const unsigned char WebImageVersionString[];
#import <SDWebImage/NSData+ImageContentType.h>
#if SD_MAC
#import <SDWebImage/NSImage+WebCache.h>
#import <SDWebImage/NSImage+Additions.h>
#endif
#if SD_UIKIT