Adium

Changeset 21560

Show
Ignore:
Timestamp:
11/07/2007 01:39:13 AM (1 year ago)
Author:
boredzo
Message:

This is an alternate fix suggested by David: use -initWithContentsOfFile: to create the NSImages for the buddy icons, and set their dataRetained property to YES. Then, we don't need to copy the image every time we scale it. I tested this fix and it works. Refs #8181.

  • Performance upside: We don't copy the image every time we scale it. This should make changing the CL's buddy-icon size snappier (as snappy as it was before #8181 was originally fixed).
  • Performance downside: Loading the cached images isn't lazy anymore. In reality, however, this costs us nothing: The user icons pretty much get drawn right away anyway, so they don't need to be lazily loaded.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Frameworks/AIUtilities Framework/Source/AIImageAdditions.m

    r21559 r21560  
    233233                } 
    234234 
    235                 NSImage *imageToDraw = [self copy]; 
    236  
    237235                newRect = NSMakeRect(0,0,size.width,size.height); 
    238236                newImage = [[NSImage alloc] initWithSize:size]; 
     
    242240                NSImageRep      *bestRep; 
    243241                if (allowAnimation && 
    244                         (bestRep = [imageToDraw bestRepresentationForDevice:nil]) && 
     242                        (bestRep = [self bestRepresentationForDevice:nil]) && 
    245243                        [bestRep isKindOfClass:[NSBitmapImageRep class]] &&  
    246244                        (delta == 1.0) && 
     
    253251                        //Highest quality interpolation 
    254252                        [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh]; 
    255                         [imageToDraw drawInRect:newRect 
     253                        [self drawInRect:newRect 
    256254                                       fromRect:NSMakeRect(0,0,originalSize.width,originalSize.height) 
    257255                                      operation:NSCompositeCopy 
     
    260258                        [newImage unlockFocus]; 
    261259                } 
    262  
    263                 [imageToDraw release]; 
    264260 
    265261                return [newImage autorelease]; 
  • trunk/Source/ESUserIconHandlingPlugin.m

    r21218 r21560  
    103103                                NSImage                         *cachedImage; 
    104104 
    105                                 cachedImage = [[NSImage alloc] initByReferencingFile:cachedImagePath]; 
     105                                cachedImage = [[NSImage alloc] initWithContentsOfFile:cachedImagePath]; 
     106                                [cachedImage setDataRetained:YES]; 
    106107 
    107108                                if (cachedImage) {