-
-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
14 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,18 @@ | |
import Foundation | ||
|
||
enum ImageDecompression { | ||
static func isDecompressionNeeded(for response: ImageResponse) -> Bool { | ||
guard response.container.type != .png else { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
kean
Author
Owner
|
||
// Attempting to decompress a `.png` image using | ||
// `prepareForReuse` results in the following error: | ||
// | ||
// [Decompressor] Error -17102 decompressing image -- possibly corrupt | ||
// | ||
// It's also, in general, inefficient and unnecessary. | ||
return false | ||
} | ||
return isDecompressionNeeded(for: response.image) ?? false | ||
} | ||
|
||
static func decompress(image: PlatformImage, isUsingPrepareForDisplay: Bool = false) -> PlatformImage { | ||
image.decompressed(isUsingPrepareForDisplay: isUsingPrepareForDisplay) ?? image | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In my case this moves image decoding from multiple background threads to the main thread causing frame drops :(
Time Profiler before:
Time Profiler after: