From e10298ee3369f38ace9f5daef6bf70b2bbd05127 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 17 Oct 2011 10:19:57 +0000 Subject: [PATCH] Use my new $getImage$ abstraction. --- Library.mm | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) 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; } -- 2.50.0