Adium

Changeset 21195

Show
Ignore:
Timestamp:
09/30/2007 08:15:45 PM (1 year ago)
Author:
boredzo
Message:
  • Added method to NSImage: -sizeInPixels. Does what it says on the box.
  • Changed -drawRoundedInRect:atSize:position:fraction:radius: to use -sizeInPixels rather than -size to determine the scale factor. Fixes #8012, and I believe this fixes the issue at the heart of it (high-res buddy icons drawn at postage-stamp size).
Files:

Legend:

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

    r21148 r21195  
    5151- (NSImage *)imageByScalingForMenuItem; 
    5252- (NSImage *)imageByScalingToSize:(NSSize)size fraction:(float)delta flipImage:(BOOL)flipImage proportionally:(BOOL)proportionally allowAnimation:(BOOL)allowAnimation; 
     53- (NSSize)sizeInPixels; 
    5354//+ (NSImage *)imageFromGWorld:(GWorldPtr)gWorldPtr; 
    5455- (NSRect)drawRoundedInRect:(NSRect)rect radius:(float)radius; 
  • trunk/Frameworks/AIUtilities Framework/Source/AIImageAdditions.m

    r21148 r21195  
    407407} 
    408408 
     409- (NSSize)sizeInPixels 
     410{ 
     411        NSImageRep *rep = [self bestRepresentationForDevice:nil]; 
     412        return (NSSize){ [rep pixelsWide], [rep pixelsHigh] }; 
     413} 
     414 
    409415//General purpose draw image rounded in a NSRect. 
    410416- (NSRect)drawRoundedInRect:(NSRect)rect radius:(float)radius 
     
    425431         
    426432        //We use our own size for drawing purposes no matter the passed size to avoid distorting the image via stretching 
    427         NSSize  ownSize = [self size]; 
     433        //We use the size in pixels in order to ignore the resolution of the image. Otherwise, the image may come out larger or smaller than the target size. 
     434        NSSize  ownSize = [self sizeInPixels]; 
    428435         
    429436        //If we're passed a 0,0 size, use the image's size for the area taken up by the image