]> git.saurik.com Git - winterboard.git/commitdiff
Fixed 2.1 icon clipping bug.
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 15 Sep 2008 00:02:48 +0000 (00:02 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 15 Sep 2008 00:02:48 +0000 (00:02 +0000)
Library.mm
Test.sh
UIImages.mm
control

index 990336abf3853b878ec0cd0d64e27c118c4658c2..aeb4868128d986b37b29c59965a77ed4ffb3a44e 100644 (file)
@@ -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<WinterBoard> *self) {
     return nil;
 }
 
+static NSMutableDictionary *Cache_;
+
+static void SBIconModel$cacheImageForIcon$(SBIconModel<WinterBoard> *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<WinterBoard> *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<WinterBoard> *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 c42495ec062d572e8c08911006a24720e42bd93f..72874272e37c256139114167666a7292d401e446 100755 (executable)
--- 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
index 85ded744d057c1934a2df085fecf76041d67b0d8..461e937183a76c8f12331d0d418edf26553560ab 100644 (file)
@@ -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 abc93adae7544ac9b050ae7d58c2b7fb1bf81d1e..2d51a861c3cfde9d021c870cd7fd8560c1ae19b0 100644 (file)
--- 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