Changeset 9317


Ignore:
Timestamp:
Oct 18, 2009, 1:54:13 AM (12 years ago)
Author:
livings124
Message:

don't store a copy of the pieces view's background - regenerate it when needed instead

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/NSStringAdditions.m

    r9140 r9317  
    116116{
    117117    NSMutableArray * timeArray = [NSMutableArray arrayWithCapacity: MIN(max, 4)];
    118     NSUInteger remaining = seconds;
     118    uint64_t remaining = seconds;
    119119   
    120120    if (max > 0 && seconds >= (24 * 60 * 60))
  • trunk/macosx/PiecesView.h

    r7659 r9317  
    3131    int8_t  * fPieces;
    3232   
    33     NSImage * fBack;
    3433    NSColor * fGreenAvailabilityColor, * fBluePieceColor;
    3534   
  • trunk/macosx/PiecesView.m

    r9139 r9317  
    4343- (void) awakeFromNib
    4444{
    45     //back image
    46     fBack = [[NSImage alloc] initWithSize: [self bounds].size];
    47    
    48     [fBack lockFocus];
    49     NSGradient * gradient = [[NSGradient alloc] initWithStartingColor: [NSColor colorWithCalibratedWhite: 0.0f alpha: 0.4f]
    50                                 endingColor: [NSColor colorWithCalibratedWhite: 0.2f alpha: 0.4f]];
    51     [gradient drawInRect: [self bounds] angle: 90.0f];
    52     [gradient release];
    53     [fBack unlockFocus];
    54    
    5545    //store box colors
    56     fGreenAvailabilityColor = [[NSColor colorWithCalibratedRed: 0.0f green: 1.0f blue: 0.4f alpha: 1.0f] retain];
    57     fBluePieceColor = [[NSColor colorWithCalibratedRed: 0.0f green: 0.4f blue: 0.8f alpha: 1.0f] retain];
    58            
     46    fGreenAvailabilityColor = [[NSColor colorWithCalibratedRed: 0.0 green: 1.0 blue: 0.4 alpha: 1.0] retain];
     47    fBluePieceColor = [[NSColor colorWithCalibratedRed: 0.0 green: 0.4 blue: 0.8 alpha: 1.0] retain];
     48   
    5949    //actually draw the box
    6050    [self setTorrent: nil];
     
    6454{
    6555    tr_free(fPieces);
    66    
    67     [fBack release];
    6856   
    6957    [fGreenAvailabilityColor release];
     
    8977    }
    9078   
    91     //reset the view to blank
    92     NSImage * newBack = [fBack copy];
    93     [self setImage: newBack];
    94     [newBack release];
     79    NSImage * back = [[NSImage alloc] initWithSize: [self bounds].size];
     80    [back lockFocus];
     81   
     82    NSGradient * gradient = [[NSGradient alloc] initWithStartingColor: [NSColor colorWithCalibratedWhite: 0.0 alpha: 0.4]
     83                                endingColor: [NSColor colorWithCalibratedWhite: 0.2 alpha: 0.4]];
     84    [gradient drawInRect: [self bounds] angle: 90.0];
     85    [gradient release];
     86    [back unlockFocus];
     87   
     88    [self setImage: back];
     89    [back release];
    9590   
    9691    [self setNeedsDisplay];
Note: See TracChangeset for help on using the changeset viewer.