Merge pull request #941 from mishagray/cost_compute_fix

Cost compute fix
This commit is contained in:
Bogdan Poplauschi 2014-11-02 23:55:23 +02:00
commit 914ed45a44
1 changed files with 3 additions and 3 deletions

View File

@ -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];
}