Преглед изворни кода

Merge pull request #1881 from pal-aspringfield/master

[Issue #1880] - Image cost should account for number of image frames
Wei Wang пре 4 година
родитељ
комит
9c4b1ab690
1 измењених фајлова са 5 додато и 1 уклоњено
  1. 5 1
      Sources/Image/Image.swift

+ 5 - 1
Sources/Image/Image.swift

@@ -103,7 +103,11 @@ extension KingfisherWrapper where Base: KFCrossPlatformImage {
         guard let cgImage = cgImage else {
             return pixel * 4
         }
-        return pixel * cgImage.bitsPerPixel / 8
+        let bytesPerPixel = cgImage.bitsPerPixel / 8
+        guard let imageCount = images?.count else {
+            return pixel * bytesPerPixel
+        }
+        return pixel * bytesPerPixel * imageCount
     }
 }