mirror of
https://github.com/transmission/transmission.git
synced 2025-12-20 10:28:32 +00:00
only lock focus and redraw the pieces view if it has been updated
This commit is contained in:
@@ -128,11 +128,11 @@
|
|||||||
[fTorrent getAmountFinished: piecesPercent size: fNumPieces];
|
[fTorrent getAmountFinished: piecesPercent size: fNumPieces];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSImage * image = [self image];
|
||||||
|
|
||||||
int i, j, index = -1;
|
int i, j, index = -1;
|
||||||
NSRect rect = NSMakeRect(0, 0, fWidth, fWidth);
|
NSRect rect = NSMakeRect(0, 0, fWidth, fWidth);
|
||||||
|
BOOL change = NO;
|
||||||
NSImage * image = [self image];
|
|
||||||
[image lockFocus];
|
|
||||||
|
|
||||||
for (i = 0; i < fAcross; i++)
|
for (i = 0; i < fAcross; i++)
|
||||||
for (j = 0; j < fAcross; j++)
|
for (j = 0; j < fAcross; j++)
|
||||||
@@ -189,6 +189,13 @@
|
|||||||
|
|
||||||
if (pieceColor)
|
if (pieceColor)
|
||||||
{
|
{
|
||||||
|
//avoid unneeded memory usage by only locking focus if drawing will occur
|
||||||
|
if (!change)
|
||||||
|
{
|
||||||
|
change = YES;
|
||||||
|
[image lockFocus];
|
||||||
|
}
|
||||||
|
|
||||||
rect.origin = NSMakePoint(j * (fWidth + BETWEEN) + BETWEEN + fExtraBorder,
|
rect.origin = NSMakePoint(j * (fWidth + BETWEEN) + BETWEEN + fExtraBorder,
|
||||||
[image size].width - (i + 1) * (fWidth + BETWEEN) - fExtraBorder);
|
[image size].width - (i + 1) * (fWidth + BETWEEN) - fExtraBorder);
|
||||||
|
|
||||||
@@ -197,8 +204,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (change)
|
||||||
|
{
|
||||||
[image unlockFocus];
|
[image unlockFocus];
|
||||||
[self setNeedsDisplay];
|
[self setNeedsDisplay];
|
||||||
|
}
|
||||||
|
|
||||||
tr_free(pieces);
|
tr_free(pieces);
|
||||||
tr_free(piecesPercent);
|
tr_free(piecesPercent);
|
||||||
|
|||||||
Reference in New Issue
Block a user