Changeset 9050


Ignore:
Timestamp:
Sep 7, 2009, 6:05:48 AM (13 years ago)
Author:
livings124
Message:

only use integral numbers for the height of the pieces bar

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/TorrentCell.m

    r9048 r9050  
    560560- (void) drawBar: (NSRect) barRect
    561561{
    562     CGFloat piecesBarPercent = [(TorrentTableView *)[self controlView] piecesBarPercent];
    563     if (piecesBarPercent > 0.0f)
    564     {
    565         NSRect regularBarRect = barRect, piecesBarRect = barRect;
    566         piecesBarRect.size.height *= PIECES_TOTAL_PERCENT * piecesBarPercent;
    567         regularBarRect.size.height -= piecesBarRect.size.height;
    568         piecesBarRect.origin.y += regularBarRect.size.height;
     562    const CGFloat piecesBarPercent = [(TorrentTableView *)[self controlView] piecesBarPercent];
     563    if (piecesBarPercent > 0.0)
     564    {
     565        NSRect piecesBarRect, regularBarRect;
     566        NSDivideRect(barRect, &piecesBarRect, &regularBarRect, floorf(NSHeight(barRect) * PIECES_TOTAL_PERCENT * piecesBarPercent),
     567                    NSMaxYEdge);
    569568       
    570569        [self drawRegularBar: regularBarRect];
     
    579578   
    580579    [fBarBorderColor set];
    581     [NSBezierPath strokeRect: NSInsetRect(barRect, 0.5f, 0.5f)];
     580    [NSBezierPath strokeRect: NSInsetRect(barRect, 0.5, 0.5)];
    582581}
    583582
     
    632631           
    633632            //not-available section
    634             if ([torrent isActive] && ![torrent isChecking] && [fDefaults boolForKey: @"DisplayProgressBarAvailable"])
     633            if ([torrent isActive] && ![torrent isChecking] && [fDefaults boolForKey: @"DisplayProgressBarAvailable"]
     634                && [torrent availableDesired] > 0.0)
    635635            {
    636636                NSRect unavailableRect;
Note: See TracChangeset for help on using the changeset viewer.