Authored by Bogdan Poplauschi

Merge pull request #941 from mishagray/cost_compute_fix

Cost compute fix
... ... @@ -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];
}
... ...