From 7d9337406760603ddee47d5515e1e4835618b6b2 Mon Sep 17 00:00:00 2001 From: mishagray Date: Sun, 20 Jul 2014 18:10:02 -0400 Subject: [PATCH] Modified the cost calculuations to appropriately compute the 'scale' of an image --- SDWebImage/SDImageCache.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SDWebImage/SDImageCache.m b/SDWebImage/SDImageCache.m index 6ed20d57..dffea21e 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]; }