From: Jay Freeman (saurik) Date: Mon, 15 Sep 2008 00:02:48 +0000 (+0000) Subject: Fixed 2.1 icon clipping bug. X-Git-Tag: v0.9.3900~73 X-Git-Url: https://git.saurik.com/winterboard.git/commitdiff_plain/4e0efa01aba42e742281210343ab1afec3b7f9c0 Fixed 2.1 icon clipping bug. --- diff --git a/Library.mm b/Library.mm index 990336a..aeb4868 100644 --- a/Library.mm +++ b/Library.mm @@ -129,6 +129,8 @@ void WBInject(const char *classname, const char *oldname, IMP newimp, const char /* }}} */ @protocol WinterBoard +- (void) wb_cacheImageForIcon:(SBIcon *)icon; +- (UIImage *) wb_getCachedImagedForIcon:(SBIcon *)icon; - (CGSize) wb_renderedSizeOfNode:(id)node constrainedToWidth:(float)width; - (void *) _node; - (void) wb_updateDesktopImage:(UIImage *)image; @@ -229,6 +231,23 @@ static NSString *$pathForIcon$(SBApplication *self) { return nil; } +static NSMutableDictionary *Cache_; + +static void SBIconModel$cacheImageForIcon$(SBIconModel *self, SEL sel, SBIcon *icon) { + [self wb_cacheImageForIcon:icon]; + NSString *key([icon displayIdentifier]); + if (UIImage *value = [icon icon]) + [Cache_ setObject:value forKey:key]; +} + +static UIImage *SBIconModel$getCachedImagedForIcon$(SBIconModel *self, SEL sel, SBIcon *icon) { + NSString *key([icon displayIdentifier]); + if (UIImage *image = [Cache_ objectForKey:key]) + return image; + else + return [self wb_getCachedImagedForIcon:icon]; +} + static UIImage *SBApplicationIcon$icon(SBApplicationIcon *self, SEL sel) { if (![Info_ boolForKey:@"ComposeStoreIcons"]) if (NSString *path = $pathForIcon$([self application])) @@ -1035,6 +1054,9 @@ extern "C" void WBInitialize() { WBRename(true, "WebCoreFrameBridge", @selector(renderedSizeOfNode:constrainedToWidth:), (IMP) &WebCoreFrameBridge$renderedSizeOfNode$constrainedToWidth$); + WBRename(true, "SBIconModel", @selector(cacheImageForIcon:), (IMP) &SBIconModel$cacheImageForIcon$); + WBRename(true, "SBIconModel", @selector(getCachedImagedForIcon:), (IMP) &SBIconModel$getCachedImagedForIcon$); + WBRename(true, "SBApplication", @selector(pathForIcon), (IMP) &SBApplication$pathForIcon); WBRename(true, "SBApplicationIcon", @selector(icon), (IMP) &SBApplicationIcon$icon); WBRename(true, "SBBookmarkIcon", @selector(icon), (IMP) &SBBookmarkIcon$icon); @@ -1061,6 +1083,7 @@ extern "C" void WBInitialize() { UIImages_ = [[NSMutableDictionary alloc] initWithCapacity:16]; PathImages_ = [[NSMutableDictionary alloc] initWithCapacity:16]; Files_ = [[NSMutableDictionary alloc] initWithCapacity:16]; + Cache_ = [[NSMutableDictionary alloc] initWithCapacity:64]; themes_ = [[NSMutableArray alloc] initWithCapacity:8]; diff --git a/Test.sh b/Test.sh index c42495e..7287427 100755 --- a/Test.sh +++ b/Test.sh @@ -1,6 +1,6 @@ #!/bin/bash rm -f WinterBoard.dylib set -e -rsync --exclude .svn -SPaz 'saurik@carrier.saurik.com:menes/winterboard/WinterBoard{,.dylib}' . +rsync --exclude .svn -SPaz 'saurik@carrier.saurik.com:menes/winterboard/{WinterBoard{,.dylib},UIImages}' . rsync --exclude .svn -SPaz 'saurik@carrier.saurik.com:menes/winterboard/*.theme' /Library/Themes/ #killall SpringBoard diff --git a/UIImages.mm b/UIImages.mm index 85ded74..461e937 100644 --- a/UIImages.mm +++ b/UIImages.mm @@ -22,13 +22,13 @@ int main(int argc, char *argv[]) { void (*__UISharedImageInitialize)(bool) = (void (*)(bool)) nl[1].n_value; __UISharedImageInitialize(false); - [UIKeyboard preheatArtwork]; NSArray *keys = [*images allKeys]; for (int i(0), e([keys count]); i != e; ++i) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSString *key = [keys objectAtIndex:i]; CGImageRef ref = (CGImageRef) [*images objectForKey:key]; + CFShow(ref); UIImage *image = [UIImage imageWithCGImage:ref]; NSData *data = UIImagePNGRepresentation(image); [data writeToFile:[NSString stringWithFormat:@"%@", key] atomically:YES]; diff --git a/control b/control index abc93ad..2d51a86 100644 --- a/control +++ b/control @@ -6,7 +6,7 @@ Architecture: iphoneos-arm Version: 0.9.2564-1 Description: more powerful, open-source SummerBoard Name: WinterBoard -Depends: mobilesubstrate (>= 0.9.2560-1) +Depends: mobilesubstrate (>= 0.9.2568-1) Provides: theme-manager Conflicts: com.modmyifone.winterboardicon Replaces: com.modmyifone.winterboardicon