Commit Graph

1949 Commits

Author SHA1 Message Date
DreamPiggy 2fa1e1785a Fix the previous wrong changes of iOS 17 indexed PNG color workaround
Added test cases `test30ThatImageIOPNGPluginBuggyWorkaround`
2023-11-16 16:37:19 +08:00
DreamPiggy 9efacfed97 Fix the sd_colorAtPoint return wrong value on pre-multiplied CGImage
Should always un-multiplied the color to match CGColor/UIColor documentation
2023-11-16 16:37:19 +08:00
DreamPiggy 213be11357
Merge pull request #3634 from dreampiggy/bugfix/workaround_hacky_imageio_png_indexed_color
Introduce the hacky workaround for iOS 17 ImageIO indexed color png decode (Apple's bug)
2023-11-15 16:11:20 +08:00
DreamPiggy a95075b54d Fix the iOS 17 UIKit behavior issue that UIImageView entering the background will reset CALayer's contents, which cause animated image render issue
Should use traitCollectionDidChange to refresh the CALayer's contents status to match current frame index
2023-11-14 16:12:50 +08:00
DreamPiggy d5dccaeeef Introduce the hacky workaround for iOS 17 ImageIO indexed color png code bug
This use the runtime detection instead of available check, more stable

When we detect the ImageIO is buggy, we will change the correct alpha info with non-premultiplied
2023-11-10 18:41:09 +08:00
DreamPiggy 0a0f7e10f6 Update the behavior that SDAnimatedImage should pass the path and scale to coder as well
This metadata information is important for some edge cases decoding
2023-10-21 18:14:38 +08:00
DreamPiggy 42f35ca3f6 SDAnimatedImage now supports static image like JPEG data
This previously will only return nil for static image, so this may be a behavior changes
For example, SDAnimatedImageView loading url will cache the `SDAnimatedImage` instead of `UIImage`
2023-10-21 17:58:24 +08:00
DreamPiggy 970472e91c Update the TargetConditional check for visionOS for Xcode 15.1
VisionOS should be in the UIKit variant
2023-10-10 15:35:49 +08:00
DreamPiggy cae43d7c88 Try to remove the unused NSNotification object filter, do filter by ourself 2023-10-10 14:46:23 +08:00
DreamPiggy 9078f316f7 Update the convenient API for UIImage (not SDAnimatedImage) to grab the current image format when no encode format provided
This match two classes behavior
2023-10-08 15:34:25 +08:00
DreamPiggy 4acf569171 Update the convenient API for case when user encode the format the same as image format, provide better quick return 2023-10-08 15:25:10 +08:00
DreamPiggy 0b8e0f68d3 Fix the SDDisplayLink on watchOS does not behave like other platform
The first callback should be trigger in next runloop when calling `start`, not callback in sync
2023-09-21 22:57:22 +08:00
DreamPiggy 9faa68dc15 Added xcprivacy to framework target and SPM
CocoaPods does not has this feature currently
2023-09-12 15:40:57 +08:00
DreamPiggy 57ebdeafcf Fix one warning because local variable shadows the variable outside of block 2023-09-12 14:39:12 +08:00
DreamPiggy 9ff08a1e66 A quick ugly fix for JFIF image orientation bug
We need the `kSDCGImageSourceSkipMetadata`, or the EXIF orientation translated by JFIF stills contains the non-Up side, and apply twice (by Apple's ImageIO and us)
2023-09-08 15:56:23 +08:00
DreamPiggy a797da71ce Added support for visionOS using platform macro detection
The scale using traitCollection.displayScale
This only change source code
2023-09-02 20:11:27 +08:00
DreamPiggy b3e1637a23 Added `SDWebImageAvoidAutoCancelImage` to avoid cancel loading image requests for the same operation key 2023-09-01 16:10:34 +08:00
DreamPiggy 1550747f2a Add extra check for image data during URLSession data callback
Make sure the assert work
2023-08-23 17:56:38 +08:00
DreamPiggy c614dffdfd Update the comments and associated key 2023-07-31 18:01:59 +08:00
DreamPiggy 5ef6c83953
Merge pull request #3576 from dreampiggy/feature_set_image_state_api
Add better support for stateful view (UIButton) for image URL/progres s state management
2023-07-31 17:59:57 +08:00
DreamPiggy a986a77734 Add better support for stateful view (UIButton) for image URL/progress state management
Key idea:
1. Image Loading pipeline is based on `operation key`, when start/cancel it always need operation key
2. Stateful view has multiple operation key for different image property, we can use KeyPath as the hint to generate operation key
3. To make exists API compatible, we do not change much, however, in 6.0 we may do refactory and store all the loadState/operation/result into the single object, instead of 3
2023-07-31 10:35:47 +08:00
DreamPiggy 7e78633845
Merge pull request #3575 from dreampiggy/bugfix/CGImageCreateScale
Fix the CGImageCreateScaled to support 16/32 bit depth CGImage (RGB161616) and always preserve pixel format info
2023-07-29 21:59:26 +08:00
DreamPiggy 68c5808581 Added the complicated unit test `test22CGImageCreateScaledWithSize`
Test RGB888/RGB16/ARGB8888/RGB16/RGBF works on CGImageCreateScaled, because it's Foundation of coder plugin for thumbnail processing
2023-07-28 23:45:23 +08:00
DreamPiggy d25ee5b094 Fix the CGImageCreateScaled to support 16/32 bits CGImage (RGB161616), and always preserve pixel format info 2023-07-28 21:33:36 +08:00
DreamPiggy 0b225eaaeb
Merge pull request #3572 from Mervin1024/redundant_url_requests
Fix redundant requests for the same url during decoding time
2023-07-28 18:55:27 +08:00
马遥 2d73e96fdf use @syncrhonized (self) in the whole checkDone method, no longer allows something that add new handlers during checkDone 2023-07-28 14:56:28 +08:00
马遥 1ee0dbacea fix typo 2023-07-28 11:16:38 +08:00
DreamPiggy 480f3b5158 Update test case `test27ThatEncodeWithFramesWorks` 2023-07-26 23:04:02 +08:00
DreamPiggy 1f4292ec82 Expose the data and format when SDAnimatedImageRep created with APNG/GIF/WebP/HEICS
This can avoid extra decoding (slow) for some cases if you need compressed image data
2023-07-26 23:01:57 +08:00
马遥 39af2be6ee fix redundant url requests 2023-07-26 15:23:59 +08:00
yang 01336bd3cd Fix bug #3564 decodedAndScaledDownImageWithImage may not render the image completely when met the specified image size. 2023-07-15 00:30:51 +08:00
DreamPiggy 8efa42e6bc Code garden for test cases 2023-07-14 00:03:06 +08:00
DreamPiggy 808cedc7e5 Rename to use struct to return the alignment, preserve for future HDR support 2023-07-13 23:41:09 +08:00
DreamPiggy 45b497c5f6 Fix the macOS force decode colorspace does not match screen colorspace and cause copy
Fix the NSColor should still convert to sRGB for print...
2023-07-13 23:31:19 +08:00
DreamPiggy 67da434e79 Fix the colorspace of hardware supported on macOS
Should use device RGB, like Color LCD
2023-07-13 22:58:32 +08:00
DreamPiggy cc89e14fdd Fix the handle of ForceDecodePolicyAlways, still need to check animated image and vector image to not break them 2023-07-13 22:58:32 +08:00
DreamPiggy 3e382b234d Fix the handle to context option and add test case 2023-07-13 22:58:32 +08:00
DreamPiggy b4af7cc5ef Removed the unused cache line size helper method 2023-07-13 22:58:32 +08:00
DreamPiggy e1c01fe28b Introduce `SDImageForceDecodePolicy`, which can controls whether to force-decode using automatic check, always or never
Deprecate the `SDWebImageAvoidDecodeImage`

This can help for some user who don't use ImageIO and need to ensure the memory footprint
2023-07-13 22:58:32 +08:00
DreamPiggy f6ca661537 Update the correct byte alignment and check with 8 * 4 bytes
The sd_isDecoded default value only check once
2023-07-13 22:58:32 +08:00
DreamPiggy 06589dbcc4 Update the default force decode value, partial revert ff6b3b9bb5
Now it's will mark as false for not byte-aligned CGImage
2023-07-13 22:58:32 +08:00
DreamPiggy b4559994ea Provide the API for custom coders (like WebPCoder) to use runtime check to handle the decode output bitmap info
Include: colorspace, byte alignment, bitmap info

Remove the exists hardcode on BGRA8888
2023-07-13 22:58:32 +08:00
DreamPiggy 47fd1c9a10 Fix the bug that SDImageCoderDecodeScaleDownLimitBytes still use the AnimatedImageRep and beyond the byte limit
Also, expose the limit bytes calculation utils method
2023-07-13 22:32:27 +08:00
DreamPiggy 82793d27bf Update some comments to allows SwiftDocC generate better page 2023-06-04 13:31:22 +08:00
DreamPiggy 5c14e73f70 Added description about the non-cache key awareness for .scaleDownLimitBytes
May be changed in the future if user reply
2023-06-04 13:30:42 +08:00
DreamPiggy b27c579f47
Merge pull request #3537 from dreampiggy/feature/coder_scale_down_limit_bytes_auto
Introduce the automatically calculation of thumbnail (include animated/static image) using `SDImageCoderDecodeScaleDownLimitBytes`
2023-06-04 12:45:36 +08:00
DreamPiggy c27e18506d
Merge pull request #3524 from dreampiggy/feature/sdanimatedimage_frame_pool
Performance: Introduce frame pool for SDAnimatedImage playback. Solve when multiple image view references the same URL image cause un-wanted decode which waste RAM/CPU
2023-06-04 12:38:52 +08:00
DreamPiggy 91ff7189c9 Introduce the automatically calculation of thumbnail (include animated/static image) using `SDImageCoderDecodeScaleDownLimitBytes`
The exist SDWebImageScaleDownLargeImages translate to new option instead
2023-05-15 17:34:06 +08:00
DreamPiggy f3ea1eee67 Update the check logic to detect `Multiple Frame Animated Image` 2023-05-15 14:51:42 +08:00
DreamPiggy 2331bcc690 Update the implementation `SDScaledImageForScaleFactor` to support SDAnimatedImage 2023-05-15 14:50:59 +08:00