/* }}} */
@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;
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]))
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);
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];
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];