remove size as part of ImageLoader cache

This commit is contained in:
2026-07-09 23:36:44 +02:00
parent be5e513cbc
commit 26e9cf6268
+1 -5
View File
@@ -1230,9 +1230,7 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
Chapter \(chapterString) of \(lastChapterString)
Page \(pageString) of \(lastPageString)
"""
if let size = imageLoader.size[getImagePath(progress: progress).path] {
text += "\nImage size: \(Int(size.width))x\(Int(size.height))"
}
text += "\nImage size: \(metadata.volumes[progress.v].chapters[progress.c].images[progress.i].size!.width)x\(metadata.volumes[progress.v].chapters[progress.c].images[progress.i].size!.height)"
info.text = text
}
@@ -1530,7 +1528,6 @@ class ImageLoader {
private let cache = NSCache<NSString, UIImage>()
private let horCache = NSCache<NSString, UIImage>()
private var loadingTasks: [String: [(UIImage?) -> Void]] = [:]
var size: [String: CGSize] = [:]
init() {
// 128 MiB
@@ -1575,7 +1572,6 @@ class ImageLoader {
queue.async { [weak self] in
guard let self = self else { return }
guard var image = UIImage(contentsOfFile: path.path) else { return }
self.size[path.path] = image.size
// If you turn pages fast, completion will not be nil and as such only the needed scaled image should be prepared
if completion == nil || rotation == .vertical {