|
|
@@ -761,11 +761,6 @@ public struct CroppingImageProcessor: ImageProcessor {
|
|
|
/// does not render the images to resize. Instead, it downsample the input data directly to an
|
|
|
/// image. It is a more efficient than `ResizingImageProcessor`.
|
|
|
///
|
|
|
-/// - Note:
|
|
|
-/// Downsampling only happens when this processor used as the first processor in a processing
|
|
|
-/// pipeline, when the input `ImageProcessItem` is an `.data` value. If appending to any other
|
|
|
-/// processors, it falls back to use the normal rendering resizing behavior.
|
|
|
-///
|
|
|
/// Only CG-based images are supported. Animated images (like GIF) is not supported.
|
|
|
public struct DownsamplingImageProcessor: ImageProcessor {
|
|
|
|
|
|
@@ -797,8 +792,10 @@ public struct DownsamplingImageProcessor: ImageProcessor {
|
|
|
public func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> Image? {
|
|
|
switch item {
|
|
|
case .image(let image):
|
|
|
- return image.kf.scaled(to: options.scaleFactor)
|
|
|
- .kf.resize(to: size, for: .none)
|
|
|
+ guard let data = image.kf.data(format: .unknown) else {
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return KingfisherWrapper.downsampledImage(data: data, to: size, scale: options.scaleFactor)
|
|
|
case .data(let data):
|
|
|
return KingfisherWrapper.downsampledImage(data: data, to: size, scale: options.scaleFactor)
|
|
|
}
|