From: Jay Freeman (saurik) Date: Mon, 17 Oct 2011 10:19:57 +0000 (+0000) Subject: Use my new $getImage$ abstraction. X-Git-Tag: v0.9.3901~18 X-Git-Url: https://git.saurik.com/winterboard.git/commitdiff_plain/e10298ee3369f38ace9f5daef6bf70b2bbd05127 Use my new $getImage$ abstraction. --- diff --git a/Library.mm b/Library.mm index 91c9731..c251280 100644 --- a/Library.mm +++ b/Library.mm @@ -1445,11 +1445,8 @@ MSHook(UIImage *, _UIImageWithName, NSString *name) { UIImage *image([UIImages_ objectForKey:key]); if (image != nil) return reinterpret_cast(image) == [NSNull null] ? __UIImageWithName(name) : image; - if (NSString *path = $pathForFile$inBundle$(name, _UIKitBundle(), true)) { - image = [[UIImage alloc] initWithContentsOfFile:path cache:true]; - if (image != nil) - [image autorelease]; - } + if (NSString *path = $pathForFile$inBundle$(name, _UIKitBundle(), true)) + image = $getImage$(path); [UIImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast(image)) forKey:key]; return image == nil ? __UIImageWithName(name) : image; } @@ -1463,11 +1460,8 @@ MSHook(UIImage *, _UIImageWithNameInDomain, NSString *name, NSString *domain) { return reinterpret_cast(image) == [NSNull null] ? __UIImageWithNameInDomain(name, domain) : image; if (Debug_) NSLog(@"WB:Debug: UIImageWithNameInDomain(\"%@\", \"%@\")", name, domain); - if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Domains/%@/%@", domain, name]], true)) { - image = [[UIImage alloc] initWithContentsOfFile:path]; - if (image != nil) - [image autorelease]; - } + if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Domains/%@/%@", domain, name]], true)) + image = $getImage$(path); [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast(image)) forKey:key]; return image == nil ? __UIImageWithNameInDomain(name, domain) : image; }