From 88d6b568a488afa7b9cb43b5b1a1d507432bb632 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Mon, 7 Sep 2009 06:05:48 +0000 Subject: [PATCH] only use integral numbers for the height of the pieces bar --- macosx/TorrentCell.m | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/macosx/TorrentCell.m b/macosx/TorrentCell.m index b1dc5f1a3..549d74aa4 100644 --- a/macosx/TorrentCell.m +++ b/macosx/TorrentCell.m @@ -559,13 +559,12 @@ - (void) drawBar: (NSRect) barRect { - CGFloat piecesBarPercent = [(TorrentTableView *)[self controlView] piecesBarPercent]; - if (piecesBarPercent > 0.0f) + const CGFloat piecesBarPercent = [(TorrentTableView *)[self controlView] piecesBarPercent]; + if (piecesBarPercent > 0.0) { - NSRect regularBarRect = barRect, piecesBarRect = barRect; - piecesBarRect.size.height *= PIECES_TOTAL_PERCENT * piecesBarPercent; - regularBarRect.size.height -= piecesBarRect.size.height; - piecesBarRect.origin.y += regularBarRect.size.height; + NSRect piecesBarRect, regularBarRect; + NSDivideRect(barRect, &piecesBarRect, ®ularBarRect, floorf(NSHeight(barRect) * PIECES_TOTAL_PERCENT * piecesBarPercent), + NSMaxYEdge); [self drawRegularBar: regularBarRect]; [self drawPiecesBar: piecesBarRect]; @@ -578,7 +577,7 @@ } [fBarBorderColor set]; - [NSBezierPath strokeRect: NSInsetRect(barRect, 0.5f, 0.5f)]; + [NSBezierPath strokeRect: NSInsetRect(barRect, 0.5, 0.5)]; } - (void) drawRegularBar: (NSRect) barRect @@ -631,7 +630,8 @@ NSDivideRect(missingRect, &wantedRect, &missingRect, widthRemaining, NSMinXEdge); //not-available section - if ([torrent isActive] && ![torrent isChecking] && [fDefaults boolForKey: @"DisplayProgressBarAvailable"]) + if ([torrent isActive] && ![torrent isChecking] && [fDefaults boolForKey: @"DisplayProgressBarAvailable"] + && [torrent availableDesired] > 0.0) { NSRect unavailableRect; NSDivideRect(wantedRect, &wantedRect, &unavailableRect, floorf([torrent availableDesired] * NSWidth(wantedRect)),