Skip to content

Commit

Permalink
use scale
Browse files Browse the repository at this point in the history
  • Loading branch information
Amol Prabhu committed Jul 8, 2024
1 parent 909474f commit 4bde068
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Sources/Nuke/Decoding/ImageDecoders+Default.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ extension ImageDecoders {

func makeImage() -> PlatformImage? {
if let thumbnail {
return makeThumbnail(data: data, options: thumbnail)
return makeThumbnail(data: data,
options: thumbnail,
scale: scale ?? 1.0)
}
return ImageDecoders.Default._decode(data, scale: scale)
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Nuke/Internal/Graphics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ extension Color {
}

/// Creates an image thumbnail. Uses significantly less memory than other options.
func makeThumbnail(data: Data, options: ImageRequest.ThumbnailOptions) -> PlatformImage? {
func makeThumbnail(data: Data, options: ImageRequest.ThumbnailOptions, scale: CGFloat = 1.0) -> PlatformImage? {
guard let source = CGImageSourceCreateWithData(data as CFData, [kCGImageSourceShouldCache: false] as CFDictionary) else {
return nil
}
Expand All @@ -391,7 +391,7 @@ func makeThumbnail(data: Data, options: ImageRequest.ThumbnailOptions) -> Platfo
orientation = .up
}
return PlatformImage(cgImage: image,
scale: UIScreen.main.scale,
scale: scale,
orientation: orientation)
#else
return PlatformImage(cgImage: image)
Expand Down

0 comments on commit 4bde068

Please sign in to comment.