diff --git a/Changelog b/Changelog index cff4830b3..042bdb727 100644 --- a/Changelog +++ b/Changelog @@ -3,6 +3,7 @@ - BUGFIX: Fix feature to keep incomplete torrents in a separate folder - BUGFIX: Fix display of URL seeds in the UI - BUGFIX: Improved peer hostname resolution with caching + - BUGFIX: Piece availability/downloaded widgets performance improvement * Fri Oct 1 2010 - Christophe Dumez - v2.4.4 - BUGFIX: Clean program exit on system shutdown/logout diff --git a/src/downloadedpiecesbar.h b/src/downloadedpiecesbar.h index 5f9c5c96a..3a04d9073 100644 --- a/src/downloadedpiecesbar.h +++ b/src/downloadedpiecesbar.h @@ -63,28 +63,31 @@ public: const qulonglong nb_pieces = pieces.size(); // Reduce the number of pieces before creating the pixmap // otherwise it can crash when there are too many pieces - if(nb_pieces > (uint)width()) { - const int ratio = floor(nb_pieces/(double)width()); - std::vector scaled_pieces; - std::vector scaled_downloading; + const uint w = width(); + if(nb_pieces > w) { + const uint ratio = floor(nb_pieces/(double)w); + bitfield scaled_pieces(ceil(nb_pieces/(double)ratio), false); + bitfield scaled_downloading(ceil(nb_pieces/(double)ratio), false); + uint scaled_index = 0; for(qulonglong i=0; i width()) { - const int ratio = floor(nb_pieces/(double)width()); + const uint w = width(); + if(nb_pieces > w) { + const qulonglong ratio = floor(nb_pieces/(double)w); std::vector scaled_avail; - for(int i=0; i