/* }}} */
@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]))
static void SBIconLabel$drawRect$(SBIconLabel<WinterBoard> *self, SEL sel, CGRect rect) {
CGRect bounds = [self bounds];
+ static Ivar drawMoreLegibly = object_getInstanceVariable(self, "_drawMoreLegibly", NULL);
+
BOOL docked;
- object_getInstanceVariable(self, "_inDock", reinterpret_cast<void **>(&docked));
- docked = (docked & 0x1) != 0;
+ Ivar ivar = object_getInstanceVariable(self, "_inDock", reinterpret_cast<void **>(&docked));
+ docked = (docked & (ivar_getOffset(ivar) == ivar_getOffset(drawMoreLegibly) ? 0x2 : 0x1)) != 0;
NSString *label;
object_getInstanceVariable(self, "_label", reinterpret_cast<void **>(&label));
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];