Commit Graph

1380 Commits

Author SHA1 Message Date
Bogdan Poplauschi b2e5317666 Bumped version to 4.2.1, updated CHANGELOG 2017-10-31 20:39:19 +02:00
DreamPiggy 19f45a3cf4 Feature refactor built-in coders and support animated webp on macOS (#2082)
* Refactor code. Move the C global function to a new SDWebImageCoderHelper class.

1. Create two method for animated image parse. Provide the way to allow animates on macOS
2. Create a new class called SDWebImageFrame to allow abstract usage for animated image
3. Fix EXIF orientation method will crash on iOS 7 because it’s a iOS 8 above API

* Change sd_imageLoopCount to retrieve GIF loop count for NSImage on macOS

* Adopt the refactor code, change our build-in coder with that coder helper method to reduce complexity

* Update the demo project on macOS to show animated WebP
2017-10-31 20:34:05 +02:00
Bogdan Poplauschi 3064ef6889 Merge pull request #2081 from dreampiggy/fix_heic_detector
Add all 4 standard HEIC brand file signature, ftypheic & ftypheix is for single image, ftyphevc & ftyphevx is for sequence image
2017-10-27 17:46:09 +03:00
DreamPiggy a71b7b63c4 Add all 4 standard HEIC brand file signature, ftypheic & ftypheix is for single image, ftyphevc & ftyphevx is for sequence image 2017-10-27 17:13:42 +08:00
Bogdan Poplauschi 28d21d28b9 Updated CHANGELOG 2017-10-27 09:46:56 +03:00
Bogdan Poplauschi 3d8ce3a84a Updated `SDWebImageImageIOCoder` comments + minor coding style 2017-10-27 09:44:35 +03:00
Bogdan Poplauschi 62f80e0e3a Merge pull request #2080 from dreampiggy/feature_heif_image_format
Add image format detect of HEIC (One type of HEIF which use HEVC codec). This is supported natively in iOS 11 & macOS 10.13
2017-10-27 09:29:32 +03:00
DreamPiggy decb5dcdeb Add some more comments about coder method 2017-10-27 00:22:58 +08:00
DreamPiggy ae67c97320 Provide a way to detect HEIC encoding compatibility. So that we can avoid encoding to this format. 2017-10-26 23:51:26 +08:00
DreamPiggy 4f7116afe9 Add image format detect of HEIC (One type of HEIF which use HEVC codec). This is supported natively in iOS 11 & macOS 10.13 2017-10-26 22:33:24 +08:00
Bogdan Poplauschi 292078c0be Merge pull request #2079 from rs/fix_progressive_coder_is_always_IO
Fixed create progressive coder issue
2017-10-25 21:02:50 +03:00
Bogdan Poplauschi 5773bfec07 Fixed create progressive coder issue
Because we don't break when we find the 1st coder that can decode progressively, we will always rewrite the `progressiveCoder ` with an `SDWebImageIOCoder` instance
2017-10-25 19:48:36 +03:00
DreamPiggy 85cb2fd6ad Creating FLAnimatedImage in global queue to improve displaying gif performance (#2047)
* Creating FLAnimatedImage in global queue to improve displaying gif performance
* Added `context` dictionary param to `sd_internalSetImageWithURL` that allows sending context options. For now, one can pass `SDWebImageInternalSetImageInGlobalQueueKey` with true value so the `setImage` op is executed on a global queue.
2017-10-25 09:05:46 +03:00
Bogdan Poplauschi 6bab618acc Merge pull request #2074 from dreampiggy/fix_scale_down_and_set_data
For ImageIO coder, if the image is scaled down, then we need to modify the original image data pointer
2017-10-24 09:22:27 +03:00
DreamPiggy d62e965833 For ImageIO coder, if the image is scaled down, then we need to modify the original image data pointer 2017-10-24 02:48:50 +08:00
Bogdan Poplauschi cd37ef672b Preparing for 4.2.0 release: bumped versions and updated the CHANGELOG 2017-10-23 20:35:34 +03:00
Bogdan Poplauschi 66289772b5 Merge pull request #2071 from dreampiggy/macOS_isGIF_implementation
Implements -[NSImage isGIF] method to return whether current NSImage is GIF representation.
2017-10-21 19:02:30 +03:00
DreamPiggy 30fd6cc6ab Implements -[NSImage isGIF] method to return whether current NSImage is GIF representation. 2017-10-21 23:31:31 +08:00
Bogdan Poplauschi 04855c945e Merge pull request #2061 from dvkch/master
Cached image filename are sometimes generated with invalid path extensions
2017-10-21 17:15:11 +03:00
Bogdan Poplauschi 83e2c35f8e Merge pull request #2068 from bpoplauschi/improve_unit_tests
Fixed our tests and improved the code coverage
2017-10-21 16:42:46 +03:00
Bogdan Poplauschi b12ef07e5e Merge pull request #2048 from dreampiggy/fix_cancelBlock_multi_thread_issue
Fix #1941 by placing a lock to avoid multi-thread issue for SDWebImageCombinedOperation cancelBlock
2017-10-21 16:32:39 +03:00
Bogdan Poplauschi f55635de1a Accidentally deleted a comma from an array declaration 2017-10-20 22:32:48 +03:00
Bogdan Poplauschi ed411dcba9 Finally fixed the tests from `SDImageCacheTests` so we can re-enable `test40InsertionOfImageData`
- the problems: some tests were just poorly written, using async calls but not properly setting async expectations. Those were generating undefined behaviour (not clear if/when those callbacks would be executed).
- also, we wanted to call `clearAllCaches` before every test, but since some methods there are async, this doesn't work with the way `setUp` was designed. So basically sometimes before a test we could clear the cache but sometimes not, or even the clear could come while running the test which was worst
- decided to fix this by making sure after every test that we manually clear what we have added.
2017-10-20 21:14:25 +03:00
Bogdan Poplauschi 86151183f6 Switched all the tests from using https://s3.amazonaws.com/fast-image-cache/demo-images/* images which are big and sometimes fail to arrive in 5 seconds (before the test can timeout) to smaller images, basically using http://via.placeholder.com/ like http://via.placeholder.com/50x50.jpg or http://via.placeholder.com/200x200.png
This should speed up the tests a bit and also avoid some of the random failures due to timeout
2017-10-20 20:29:18 +03:00
Bogdan Poplauschi 90c90a06bc Refactored the `SDWebImageDecoderTests` a bit. Per DRY, created `verifyCoder:withLocalImageURL:isAnimatedImage:` method that will take a imageURL and a coder and will check decoding and encoding back and forth, sizes and so. Reusing this method for the static WebP image, for the animated WebP image and for the GIF. 2017-10-20 18:40:09 +03:00
Bogdan Poplauschi f57c21d52a Improved the code coverage of our unit tests (given that we disabled test40InsertionOfImageData).
Also updated the Tests Podfile so we don't get a warning (xcodeproj was renamed to project)
2017-10-20 16:15:38 +03:00
Bogdan Poplauschi 30275b4415 Merge pull request #2067 from dreampiggy/feature_gif_encoding_macOS
Add the animated GIF encoding support for SDWebImageGIFCoder on macOS(use NSImage's API)
2017-10-19 20:51:06 +03:00
Bogdan Poplauschi 5804934a69 Merge pull request #2066 from dreampiggy/fix_progressive_webp_height_issue
Provide a way to fix libwebp’s bug during WebP progressive decoding f…
2017-10-19 20:50:21 +03:00
Bogdan Poplauschi 05828742e8 Just disabled this test test40InsertionOfImageData - keeps failing for unknown reasons (strangely sometimes the data doesn't get written to disk) 2017-10-19 19:15:21 +03:00
DreamPiggy 23a174d859 Provide a way to fix libwebp’s bug during WebP progressive decoding for x86 architecture (macOS and iPhone simulator). It kept the previous decoded partial bitmap and will cause current image looks strange. 2017-10-19 02:01:46 +08:00
DreamPiggy 2860b78a38 Add the animated GIF encoding support for SDWebImageGIFCoder on macOS(use NSImage’s API) 2017-10-19 01:58:35 +08:00
Bogdan Poplauschi e1a76d76bd Merge pull request #2057 from dreampiggy/feature_disk_cache_reading_options
Allow user to provide reading options such as mapped file to improve performance in SDImageCache disk cache
2017-10-18 19:20:54 +03:00
Bogdan Poplauschi 748c7d46b6 Explicitly set `diskCacheReadingOptions` to its default value 0 2017-10-18 19:21:15 +03:00
Bogdan Poplauschi 4ea5423064 Fix the build due to #2064 changes - had to make sure pod lib lint works on macOS as well 2017-10-18 19:10:18 +03:00
Bogdan Poplauschi f3524d33e5 Attempt to fix the build - the Tests target link to SDWebImage.framework (iOS), so cleaning the schemes that have built that. The problem now with Xcode 9 is that those targets already contain the libwebp and FLAnimatedImage files, Xcode will not rebuild the framework from the proper sources and then we will have duplicate symbols with the libwebp and FLAnimatedImage files that are also compiled by CocoaPods separately. 2017-10-18 15:22:01 +03:00
Bogdan Poplauschi 81c7108706 Merge pull request #2064 from dreampiggy/feature_gif_category_support_animate_again
Give back our GIF category animation support since we now use plugin coders
2017-10-18 12:03:21 +03:00
Bogdan Poplauschi a32ab28acb Comment updates 2017-10-18 12:01:26 +03:00
DreamPiggy 17386829c1 Give back our GIF category animation support since we now use plugin coders. This will not affect FLAnimatedImageView which just create the first frame.
1. Change default coders to [IOCoder, WebPCoder]
2. Add back our previous GIF decoding code, with loop count support
3. Add GIF encoding code for animation
4. Modify IOCoder for GIF format because FLAnimatedImageView need just use the first frame
2017-10-18 02:25:05 +08:00
Bogdan Poplauschi d12484a762 Updated diagrams per latest master change 2017-10-17 18:40:01 +03:00
Bogdan Poplauschi bd8d01aa30 Let's try building with Xcode 9 2017-10-17 17:52:55 +03:00
Bogdan Poplauschi 5c33c10617 Merge pull request #1991 from dreampiggy/feature_refactor_decoding_with_plugin
Feature: refactor decoding code and provide decoding plugin
2017-10-17 17:38:50 +03:00
Stanislas Chevallier 69fe979266 Fixed cached image filename generated with invalid path extensions 2017-10-17 09:29:35 +02:00
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 e1603e1800 Allow user to provide reading options such as mapped file to improve performance in SDImageCache disk cache 2017-10-14 13:54:21 +08:00
Bogdan Poplauschi c1df782869 Bumped version to 4.1.2 and added to changelog 2017-10-09 09:31:38 +03:00
Bogdan Poplauschi 322070e2c4 Merge pull request #2051 from dreampiggy/fix_progressive_totalsize_protect
Change finished check from equal to equal or greater than to protect …
2017-10-09 09:16:10 +03:00
Bogdan Poplauschi 25837a32e4 Merge pull request #2050 from dreampiggy/performance_webp
Static WebP decoding a little enhancement. Do not need create WebP it…
2017-10-09 09:10:35 +03:00
DreamPiggy 9fef316dfa Change finished check from equal to equal or greater than to protect accident condition 2017-10-09 12:48:29 +08:00
DreamPiggy 756e59a995 Static WebP decoding a little enhancement. Do not need create WebP iterator for static images. 2017-10-09 11:47:02 +08:00
Bogdan Poplauschi e59d34fdb7 Merge pull request #2049 from dreampiggy/fix_operation_not_call_done
Fix SDWebImageDownloaderOperation not call done when use SDWebImageDownloaderIgnoreCachedResponse
2017-10-08 19:49:33 +03:00