rs/SDWebImage — pull request #366 by bm-i (2013-04-23 07:50:49+00:00)
Title: Fix and make SDScaledImageForPath extensible

These commits try to fix and make SDScaledImageForPath extensible.

Currently SDScaledImageForPath is used for detecting if the image should be scaled, based on a given key, but it is a C function so it cannot be extended. This solution turns it into an Objective-C method, so it can be overridden in a subclass.

Another problem is its name: it is called SDScaledImageForPath, but it is passed the key. The name should be changed to SDScaledImageForKey. It only exists as a C function as it is used in two different classes and cases:
* SDImageCache: always passes NSData
* SDWebImageDownloaderOperation: either passes UIImage or NSData
Because different objects are passed, the parameter needs to be generic (NSObject), type checks are ensuring safety and casts to actual types are necessary. Each access to SDScaledImageForKey should be converted into one method in each class, responsible for scaling the given image and key. The default behaviour stays the heuristic based on the '@2x' in the key.

Another issue is in SDWebImageManager. It is currently not possible to use a custom cache, as its creation is not extensible. The creation of cache should be moved to a method that can be overridden in subclass, and defaults to [SDImageCache sharedImageCache] as it is right now.