Changeset 12049


Ignore:
Timestamp:
Feb 26, 2011, 3:14:03 PM (11 years ago)
Author:
livings124
Message:

(2.2x) #4066 Fix the pieces view for magnet links

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2x/macosx/PiecesView.m

    r11617 r12049  
    7171   
    7272    fTorrent = torrent;
    73     if (fTorrent)
    74     {
    75         //determine relevant values
    76         fNumPieces = MIN([fTorrent pieceCount], MAX_ACROSS * MAX_ACROSS);
    77         fAcross = ceil(sqrt(fNumPieces));
    78        
    79         const CGFloat width = [self bounds].size.width;
    80         fWidth = (width - (fAcross + 1) * BETWEEN) / fAcross;
    81         fExtraBorder = (width - ((fWidth + BETWEEN) * fAcross + BETWEEN)) / 2;
    82     }
    8373   
    8474    NSImage * back = [[NSImage alloc] initWithSize: [self bounds].size];
     
    10595- (void) updateView
    10696{
    107     if (!fTorrent)
     97    if (!fTorrent || [fTorrent isMagnet])
    10898        return;
    10999   
     
    111101    const BOOL first = fPieces == NULL;
    112102    if (first)
     103    {
     104        //determine relevant values
     105        fNumPieces = MIN([fTorrent pieceCount], MAX_ACROSS * MAX_ACROSS);
     106        fAcross = ceil(sqrt(fNumPieces));
     107       
     108        const CGFloat width = [self bounds].size.width;
     109        fWidth = (width - (fAcross + 1) * BETWEEN) / fAcross;
     110        fExtraBorder = (width - ((fWidth + BETWEEN) * fAcross + BETWEEN)) / 2;
     111       
    113112        fPieces = (int8_t *)tr_malloc(fNumPieces * sizeof(int8_t));
     113    }
    114114
    115115    int8_t * pieces = NULL;
Note: See TracChangeset for help on using the changeset viewer.