1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-04 05:22:40 +00:00

no need to have the bitmap as an instance variable since it is no longer saving colors between reload

This commit is contained in:
Mitchell Livingston 2008-05-27 05:08:09 +00:00
parent cd886da2ac
commit 510570091c
2 changed files with 8 additions and 14 deletions

View file

@ -39,8 +39,6 @@
* fGreenGradient, * fLightGreenGradient, * fDarkGreenGradient, * fYellowGradient, * fRedGradient;
NSColor * fGrayColor, * fBlueColor, * fBlue1Color, * fBlue2Color, * fBlue3Color, * fBlue4Color, * fOrangeColor;
NSBitmapImageRep * fBitmap;
}
- (NSRect) iconRectForBounds: (NSRect) bounds;

View file

@ -115,8 +115,6 @@
{
TorrentCell * copy = [super copyWithZone: zone];
copy->fBitmap = nil;
copy->fGrayGradient = [fGrayGradient retain];
copy->fLightGrayGradient = [fLightGrayGradient retain];
copy->fBlueGradient = [fBlueGradient retain];
@ -132,8 +130,6 @@
- (void) dealloc
{
[fBitmap release];
[fGrayGradient release];
[fLightGrayGradient release];
[fBlueGradient release];
@ -591,8 +587,6 @@
}
else
{
[fBitmap release];
fBitmap = nil;
[[self representedObject] setPreviousAmountFinished: NULL];
[self drawRegularBar: barRect];
@ -736,10 +730,9 @@
- (void) drawPiecesBar: (NSRect) barRect
{
if (!fBitmap)
fBitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes: nil
pixelsWide: MAX_PIECES pixelsHigh: 1 bitsPerSample: 8 samplesPerPixel: 4 hasAlpha: YES
isPlanar: NO colorSpaceName: NSCalibratedRGBColorSpace bytesPerRow: 0 bitsPerPixel: 0];
NSBitmapImageRep * bitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes: nil
pixelsWide: MAX_PIECES pixelsHigh: 1 bitsPerSample: 8 samplesPerPixel: 4 hasAlpha: YES
isPlanar: NO colorSpaceName: NSCalibratedRGBColorSpace bytesPerRow: 0 bitsPerPixel: 0];
Torrent * torrent = [self representedObject];
@ -773,13 +766,16 @@
pieceColor = fBlue4Color;
//it's faster to just set color instead of checking previous color
[fBitmap setColor: pieceColor atX: i y: 0];
[bitmap setColor: pieceColor atX: i y: 0];
}
[torrent setPreviousAmountFinished: piecePercent];
//actually draw image
[fBitmap drawInRect: barRect];
[bitmap drawInRect: barRect];
[bitmap release];
bitmap = nil;
}
- (NSRect) rectForMinimalStatusWithString: (NSAttributedString *) string inBounds: (NSRect) bounds