Ignore:
Timestamp:
Nov 5, 2007, 7:15:45 PM (15 years ago)
Author:
livings124
Message:

make advanced bar code a little more efficient

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/TorrentCell.m

    r3703 r3719  
    462462    Torrent * torrent = [self representedObject];
    463463   
    464     #warning redo like pieces view
    465     int pieceCount = [torrent pieceCount];
     464    int pieceCount = MIN([torrent pieceCount], MAX_PIECES);
    466465    float * piecePercent = malloc(pieceCount * sizeof(float));
    467466    [torrent getAmountFinished: piecePercent size: pieceCount];
    468467   
    469468    //lines 2 to 14: blue, green, or gray depending on piece availability
    470     int i, h, index = 0;
    471     float increment = (float)pieceCount / MAX_PIECES, indexValue = 0;
     469    int i, h, index;
     470    float increment = (float)pieceCount / MAX_PIECES;
    472471    uint32_t color;
    473472    BOOL change;
    474473    for (i = 0; i < MAX_PIECES; i++)
    475474    {
     475        index = i * increment;
    476476        change = NO;
     477       
    477478        if (piecePercent[index] >= 1.0)
    478479        {
     
    540541            }
    541542        }
    542        
    543         indexValue += increment;
    544         index = (int)indexValue;
    545543    }
    546544   
Note: See TracChangeset for help on using the changeset viewer.