A new user interface for you! Read more...

File 0003-Optimization-Don-t-draw-more-than-necessary.patch of Package amarok

From 7096e0bae44605b50f3c435308aeb380845c54e8 Mon Sep 17 00:00:00 2001
From: Mark Kretschmann <kretschmann@kde.org>
Date: Mon, 26 Aug 2013 13:27:01 +0200
Subject: [PATCH 1/1] Optimization: Don't draw more than necessary.

(cherry picked from commit 8d6e72597fdfd3023ac5287ea19d8b8b3747e5ed)
---
 src/context/applets/analyzer/BlockAnalyzer.cpp | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/context/applets/analyzer/BlockAnalyzer.cpp b/src/context/applets/analyzer/BlockAnalyzer.cpp
index 62131ba..e1a0b9b 100644
--- a/src/context/applets/analyzer/BlockAnalyzer.cpp
+++ b/src/context/applets/analyzer/BlockAnalyzer.cpp
@@ -35,10 +35,7 @@ BlockAnalyzer::BlockAnalyzer( QWidget *parent )
     , m_columns( 0 )         //uint
     , m_rows( 0 )            //uint
     , m_y( 0 )               //uint
-    , m_barPixmap( 1, 1 )    //null qpixmaps cause crashes
     , m_topBarPixmap( BLOCK_WIDTH, BLOCK_HEIGHT )
-    , m_scope( MIN_COLUMNS ) //Scope
-    , m_store( MAX_COLUMNS, 0 )   //vector<uint>
     , m_fade_bars( FADE_SIZE ) //vector<QPixmap>
     , m_fade_pos( MAX_COLUMNS, 50 ) //vector<uint>
     , m_fade_intensity( MAX_COLUMNS, 32 ) //vector<uint>
@@ -68,6 +65,7 @@ BlockAnalyzer::resizeEvent( QResizeEvent *e )
     m_y = ( height() - ( m_rows * ( BLOCK_HEIGHT + 1 ) ) + 2 ) / 2;

     m_scope.resize( m_columns );
+    m_store.resize( m_columns );

     if( m_rows != oldRows )
     {
@@ -180,10 +178,10 @@ BlockAnalyzer::paintEvent( QPaintEvent* )

         // REMEMBER: y is a number from 0 to m_rows, 0 means all blocks are glowing, m_rows means none are
         p.drawPixmap( x * ( BLOCK_WIDTH + 1 ), y * ( BLOCK_HEIGHT + 1 ) + m_y, *bar(), 0, y * ( BLOCK_HEIGHT + 1 ), -1, -1 );
-    }

-    for( int x = 0; x < m_store.size(); ++x )
+        // Draw top pixmaps
         p.drawPixmap( x * ( BLOCK_WIDTH + 1 ), int( m_store[x] ) * ( BLOCK_HEIGHT + 1 ) + m_y, m_topBarPixmap );
+    }
 }

 void
--
1.8.4