diff --git a/SDWebImage/SDImageCache.m b/SDWebImage/SDImageCache.m index 59c34714..36bb751a 100644 --- a/SDWebImage/SDImageCache.m +++ b/SDWebImage/SDImageCache.m @@ -147,7 +147,7 @@ BOOL ImageDataHasPNGPreffix(NSData *data) { return; } - [self.memCache setObject:image forKey:key cost:image.size.height * image.size.width * image.scale]; + [self.memCache setObject:image forKey:key cost:image.size.height * image.size.width * image.scale * image.scale]; if (toDisk) { dispatch_async(self.ioQueue, ^{ @@ -234,7 +234,7 @@ BOOL ImageDataHasPNGPreffix(NSData *data) { // Second check the disk cache... UIImage *diskImage = [self diskImageForKey:key]; if (diskImage) { - CGFloat cost = diskImage.size.height * diskImage.size.width * diskImage.scale; + CGFloat cost = diskImage.size.height * diskImage.size.width * diskImage.scale * diskImage.scale; [self.memCache setObject:diskImage forKey:key cost:cost]; } @@ -302,7 +302,7 @@ BOOL ImageDataHasPNGPreffix(NSData *data) { @autoreleasepool { UIImage *diskImage = [self diskImageForKey:key]; if (diskImage) { - CGFloat cost = diskImage.size.height * diskImage.size.width * diskImage.scale; + CGFloat cost = diskImage.size.height * diskImage.size.width * diskImage.scale * diskImage.scale; [self.memCache setObject:diskImage forKey:key cost:cost]; }