DreamPiggy
a0879fc049
Feature: refactor decoding code and provide decoding plugin
...
- open the decoding/encoding procedures to the users
- switch from hardcoded decoding/encoding to pluginable decoders/encoders (builtin + user created)
- `SDWebImageCodersManager` is a singleton holding an array of `SDImageCoder` (protocol). Even though a singleton is not necesarily a good pattern, in this case it eliminates dealing with passing this array around
- uses a priority queue behind scenes, which means the latest added coders have priority.
- the priority is crucial when encoding/decoding something, we go through the list and ask each coder if they can handle the current data (see `canDecodeFromData:`, `canEncodeToFormat:`, `canIncrementallyDecodeFromData:`)
- each coder must conform to this protocol `SDImageCoder` describing all the required behavior for a coder
- we provide 3 built-in coders: `SDWebImageImageIOCoder` (for JPEG, PNG, TIFF), `SDWebImageGIFCoder` (for GIF), `SDWebImageWebPCoder` (for WebP and animated WebP)
- the user of SDWebImage can create custom coders by conforming to `SDImageCoder` and adding the coders to `SDWebImageCodersManager`. See `addCoder:` or `removeCoder:` or `coders` getter to get the array
- in order to preserve backwards compatibility, the UIImage categories were preserved, calling the new coders APIs described above
2017-10-16 19:52:18 +03:00
DreamPiggy
df099ced20
Performance enhancement related to single WebP image and animated WebP decoding
...
1. Change the code to not decode WebP images created in SD because it has been decoded
2. Add @autoreleasepool for animated WebP decoding do-while loop to reduce memory peak
2017-09-29 11:04:28 +08:00
Daniel
a4751a652f
Small change
...
Small change
2017-07-28 21:16:22 +03:00
Andrey Gibadullin
e6536d2b94
[bugfix] Add @autoreleasepool to SDImageCache.storeImage to prevent huge memory consumption when store a lot of images in series
2017-04-01 11:29:11 +02:00
nemissm
add652e156
SDImageCacheConfig forward declaration changed to import
2017-02-15 22:54:49 +10:00
Bogdan Poplauschi
7940577b12
Fix #1619 iOS10 Crash issue
2016-10-01 12:13:31 +03:00
Bogdan Poplauschi
c57cf7e6c9
The shared objects (not really singletons) should allow subclassing, therefore the return type should be instancetype and not a fixed type.
2016-10-01 09:28:21 +03:00
Bogdan Poplauschi
fc3a4d8170
Merge pull request #1676 from jimmaye/background-crash-io10
...
#1619 : Adds NSError as input to resourceValuesForKeys:error: method
2016-09-30 21:26:02 +03:00
Bogdan Poplauschi
0612504f1b
Instead of assert, just nslog
2016-09-24 00:07:43 +03:00
Bogdan Poplauschi
2fa77435c1
Proper place for the pragma mark and used a function to check for the proper queue
2016-09-23 23:54:23 +03:00
Bogdan Poplauschi
537b039012
Got rid of `removeImageForKey:` and `removeImageForKey:fromDisk:` that looked sync but were async. Left only the 2 async ones
2016-09-23 23:53:18 +03:00
Bogdan Poplauschi
3e78e29480
Pragma marks for code readability
2016-09-23 23:43:06 +03:00
Bogdan Poplauschi
f202b50330
Updated `queryCacheOperationForKey:image:` comments and method still works if the doneBlock is nil
2016-09-23 23:42:21 +03:00
Bogdan Poplauschi
d9424345ab
The `storeImage:` methods from `SDImageCache` were async already, but declared as sync. Properly marked them as async + added completion. Got rid of the recalculate param. If the `NSData` is provided, use it. Otherwise, recalculate from the `UIImage`
2016-09-23 21:37:38 +03:00
Bogdan Poplauschi
2eafdd6df0
Updated `storeImageDataToDisk:forKey:` asserting when called from other queue than ioQueue. Updated the header comments
2016-09-23 21:33:28 +03:00
Bogdan Poplauschi
ebf40c7ca0
Another clarification: `imageFromDiskCacheForKey:` used to also check the memory cache which I think is misleading. Now `imageFromDiskCacheForKey` only checks the disk cache and the new method `imageFromCacheForKey` checks both caches
2016-09-23 21:14:53 +03:00
Bogdan Poplauschi
6202f05e7a
Renamed `SDImageCache` `queryDiskCacheForKey:done:` to `queryCacheOperationForKey:done:`
2016-09-23 21:02:44 +03:00
Bogdan Poplauschi
e9fcf0ce03
Removed sync method `diskImageExistsWithKey:` from `SDImageCache`
2016-09-23 20:58:10 +03:00
Bogdan Poplauschi
04e963b90d
Get rid of the confusion cause by `cleanDisk` and `clearDisk`. Renamed `cleanDisk` to `deleteOldFiles`. No longer expose the sync `clearDisk` and `deleteOldFiles`, just the async ones
2016-09-23 20:52:30 +03:00
Bogdan Poplauschi
f1d749218e
Created a new class SDImageCacheConfig holding the configuration of the ImageCache. Easier to read code
2016-09-23 20:35:25 +03:00
Bogdan Poplauschi
82d1f2e49a
Preparing to remove the need for the `recalculateFromImage` param for store in cache. Only if the data provided is nil and we have an image, we will recaculate. Moved the NSData calculation in the UIImage MultiFormat categ, plus instead of another variant to check for PNG, relly on `sd_imageFormatForImageData`
2016-09-23 20:26:46 +03:00
Jimmie Jensen
fb65b04983
#1619 : Removed commenting out the actualt error check
2016-09-22 10:27:33 +02:00
Jimmie Jensen
3ef030e028
#1619 : Adds unit test that touches affeted code
2016-09-22 10:17:28 +02:00
Jimmie Jensen
806bce3134
#1619 : Adds NSError as input to resourceValuesForKeys:error: method to be able to determine if we should skip due to an error while looking up resources
2016-09-22 09:47:47 +02:00
Bogdan Poplauschi
4c6eb5e72e
OSX compatibility and target. (NSImage+WebCache) for UIImage compatibility
...
Clarified and simplified the usage of TARGET_OS_* macros. Added SD_MAC, SD_UIKIT, SD_IOS, SD_TV, SD_WATCH.
Updated Travis CI
2016-06-12 23:23:53 +03:00
Bogdan Poplauschi
3d122e550b
WatchOS support - just added a target and the conditional compiling - seems to work (pod lib lint works).
...
There is an issue, the SDWebImage watchOS target doesn't show the simulator, only Generic Device.
Also need to add some demo and test code.
2016-06-10 08:49:51 +03:00
Bogdan Poplauschi
17d8690127
Merge branch '4.x' into gif
...
# Conflicts:
# SDWebImage/MKAnnotationView+WebCache.h
# SDWebImage/MKAnnotationView+WebCache.m
# SDWebImage/SDImageCache.h
# SDWebImage/SDImageCache.m
# SDWebImage/SDWebImageManager.h
# SDWebImage/SDWebImageManager.m
# SDWebImage/UIButton+WebCache.h
# SDWebImage/UIButton+WebCache.m
# SDWebImage/UIImageView+HighlightedWebCache.h
# SDWebImage/UIImageView+HighlightedWebCache.m
# SDWebImage/UIImageView+WebCache.h
# SDWebImage/UIImageView+WebCache.m
2016-06-07 12:42:26 +03:00
Bogdan Poplauschi
2064f28d2f
Implemented Nullability according to https://developer.apple.com/swift/blog/?id=25 . Decided to make explicit nullable and nonnull and not use NS_ASSUME_NONNULL_BEGIN so everything is clearer when read. Done so in the implementation files as well
2016-06-07 08:48:45 +03:00
Bogdan Poplauschi
67f943b0fa
Implemented Lightweight Generics - both for Swift interoperability and for easier to read code
2016-06-07 08:42:52 +03:00
Bogdan Poplauschi
c4dd0eee49
Opening bracket styling
2016-06-07 08:41:07 +03:00
Bogdan Poplauschi
ada86ab939
Based on the previous change, we now can avoid the memory cache for GIFs, as the memory cache only holds UIImage instances and we need the NSData. Forced to load from disk if the image is a GIF
2016-06-01 09:45:13 +03:00
Bogdan Poplauschi
e775b444ef
Extended the SDImageCache `queryDiskCacheForKey:done:` so it also returns the NSData (we will need it later for the GIF images).
...
- had to add an NSData param to `SDWebImageQueryCompletedBlock`, so to make it simpler see this change for users, renamed the block type to `SDCacheQueryCompletedBlock`
- pass the NSData when getting the image from disk cache
2016-06-01 09:35:36 +03:00
Bogdan Poplauschi
64382b9100
Modern Objective-C syntax
2016-05-23 07:58:02 +03:00
Bogdan Poplauschi
371533549c
Merge pull request #1453 from Mutix/master
...
Added API to save image NSData to disk cache.
2016-05-08 18:53:26 +03:00
iOSPandaLee
5cc5abae03
Repair memory release in the iPad environment
...
In the iPad environment, NSCache lead to anonymous VM very high, if reaches a certain value, app will be crash. Because of SDImageCache don't clear memory when receive memory warning notification, modify define TARGET_OS_IPHONE to TARGET_OS_IOS can resolve this issue.
2016-05-05 11:51:19 +08:00
Martin Oppetit
68ae502797
Adhering to coding style
...
- also added new line at the end of SDImageCacheTests.m file
2016-02-04 10:14:53 +00:00
Martin Oppetit
9c4fcfa844
Added API to save image NSData to disk cache
...
- exposing new `- (void)storeImageDataToDisk:(NSData *)imageData
forKey:(NSString *)key` function on SDImageCache
- added unit tests for this new API
- added file extension to kImageTestKey to ensure cache path is valid
for creating NSData
2016-02-01 15:19:59 +00:00
Bogdan Poplauschi
fca618fb61
Fixed #1422 - Added a fallback for #976 so that if there are images saved with the old format (no extension), they can still be loaded. Not the greatest way to fix it, but the simplest one.
2016-01-21 15:14:16 +02:00
Bogdan Poplauschi
a16d007622
Updated #976 according to comments via review
2015-09-30 18:56:33 +03:00
Bogdan Poplauschi
577fefa26e
Merge pull request #976 from ghazel/file-extension
...
append the original path extension to the hash filename. closes #967
2015-09-30 18:51:06 +03:00
mythodeia
df751e737b
added option to disable memory cache
...
use this:
```shouldDisableMemoryCache``` to toggle memory cache
2015-07-15 11:35:03 +03:00
mythodeia
a9ea132874
disable iCloud backup
2015-07-15 11:04:44 +03:00
Bogdan Poplauschi
ba335fc7d5
Merge pull request #1153 from LukeDurrant/CustomDiskCachePath
...
Custom disk cache path
2015-07-13 22:18:55 +03:00
Bogdan Poplauschi
33c13e79ca
Coding style updates
2015-07-13 22:18:33 +03:00
Konstantinos K.
8021ddd313
Merge pull request #1121 from archfear/transparancy_fix
...
Fix for transparency being lost in transformed images.
2015-06-24 19:10:02 +03:00
Luke Durrant
d7bc2c0036
Improved by using makeDiskCachePath
2015-05-20 17:30:23 +10:00
Luke Durrant
737140d4cb
Added support for custom disk cache folder with fall back for caches directory
2015-05-20 17:28:06 +10:00
Olivier Poitrey
91b4251115
Merge pull request #1085 from flovilmart/AppExtensionSafe
...
Determines at runtime is UIApplication is available as per #1082
2015-05-17 21:06:19 -07:00
Olivier Poitrey
393d4f1601
Merge pull request #1143 from rromanchuk/feature/auto-purge-on-memory-event
...
Purge nscache on system memory notifications
2015-05-13 12:14:50 -07:00
Ryan Romanchuk
78be42ee3b
Use subclassed NSCache
2015-05-13 11:03:13 -07:00