* fGreenGradient, * fLightGreenGradient, * fDarkGreenGradient, * fYellowGradient, * fRedGradient;
NSColor * fGrayColor, * fBlueColor, * fBlue1Color, * fBlue2Color, * fBlue3Color, * fBlue4Color, * fOrangeColor;
-
- NSBitmapImageRep * fBitmap;
}
- (NSRect) iconRectForBounds: (NSRect) bounds;
{
TorrentCell * copy = [super copyWithZone: zone];
- copy->fBitmap = nil;
-
copy->fGrayGradient = [fGrayGradient retain];
copy->fLightGrayGradient = [fLightGrayGradient retain];
copy->fBlueGradient = [fBlueGradient retain];
- (void) dealloc
{
- [fBitmap release];
-
[fGrayGradient release];
[fLightGrayGradient release];
[fBlueGradient release];
}
else
{
- [fBitmap release];
- fBitmap = nil;
[[self representedObject] setPreviousAmountFinished: NULL];
[self drawRegularBar: barRect];
- (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];
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