[amarok] 2.8.0-14

Rex Dieter rdieter at fedoraproject.org
Fri Feb 20 20:39:42 UTC 2015


commit 0aab0eab4baa8c3bd8fa37188ddd46681e67d852
Author: Rex Dieter <rdieter at math.unl.edu>
Date:   Fri Feb 20 14:39:41 2015 -0600

    2.8.0-14
    
    - backport gl crasher workaround (kde#323635)
    - deprecate -nepomukcollection (f22+)

 0004-Code-cleanup-and-added-comments.patch         |  96 +++++
 0014-Fix-compilation-and-linking-issues.patch      |  27 ++
 ...timization-Don-t-draw-more-than-necessary.patch |  48 +++
 ...ck-Analyzer-to-use-pure-OpenGL-instead-of.patch | 453 +++++++++++++++++++++
 ...ing-glitch-introduced-with-commit-f4a3f4f.patch | 197 +++++++++
 amarok.spec                                        |  39 +-
 6 files changed, 855 insertions(+), 5 deletions(-)
---
diff --git a/0004-Code-cleanup-and-added-comments.patch b/0004-Code-cleanup-and-added-comments.patch
new file mode 100644
index 0000000..1815dfb
--- /dev/null
+++ b/0004-Code-cleanup-and-added-comments.patch
@@ -0,0 +1,96 @@
+From e058db2e4ab21a52d21f493770e33a407ca57fc8 Mon Sep 17 00:00:00 2001
+From: Mark Kretschmann <kretschmann at kde.org>
+Date: Mon, 12 Aug 2013 09:46:34 +0200
+Subject: [PATCH 004/448] Code cleanup and added comments.
+
+---
+ src/context/applets/analyzer/BlockAnalyzer.cpp | 23 +++++++++++------------
+ src/context/applets/analyzer/BlockAnalyzer.h   |  2 +-
+ 2 files changed, 12 insertions(+), 13 deletions(-)
+
+diff --git a/src/context/applets/analyzer/BlockAnalyzer.cpp b/src/context/applets/analyzer/BlockAnalyzer.cpp
+index 62131ba..e04aa73 100644
+--- a/src/context/applets/analyzer/BlockAnalyzer.cpp
++++ b/src/context/applets/analyzer/BlockAnalyzer.cpp
+@@ -32,8 +32,8 @@ static inline uint myMax( uint v1, uint v2 )
+ 
+ BlockAnalyzer::BlockAnalyzer( QWidget *parent )
+     : Analyzer::Base2D( parent )
+-    , m_columns( 0 )         //uint
+-    , m_rows( 0 )            //uint
++    , m_columns( 0 )         //int
++    , m_rows( 0 )            //int
+     , m_y( 0 )               //uint
+     , m_barPixmap( 1, 1 )    //null qpixmaps cause crashes
+     , m_topBarPixmap( BLOCK_WIDTH, BLOCK_HEIGHT )
+@@ -57,12 +57,11 @@ BlockAnalyzer::resizeEvent( QResizeEvent *e )
+ 
+     m_background = QPixmap( size() );
+ 
+-    const uint oldRows = m_rows;
++    const int oldRows = m_rows;
+ 
+-    //all is explained in analyze()..
+-    //+1 to counter -1 in maxSizes, trust me we need this!
+-    m_columns = qMin<uint>( (uint)ceil( double( width() ) / ( BLOCK_WIDTH + 1 ) ), MAX_COLUMNS );
+-    m_rows    = uint( double( height() + 1 ) / ( BLOCK_HEIGHT + 1 ) );
++    // Rounded up so that the last column/line is covered if partially visible
++    m_columns = qMin<int>( ceil( (double)width() / ( BLOCK_WIDTH + 1 ) ), MAX_COLUMNS );
++    m_rows    = ceil( (double)height() / ( BLOCK_HEIGHT + 1 ) );
+ 
+     //this is the y-offset for drawing from the top of the widget
+     m_y = ( height() - ( m_rows * ( BLOCK_HEIGHT + 1 ) ) + 2 ) / 2;
+@@ -80,7 +79,7 @@ BlockAnalyzer::resizeEvent( QResizeEvent *e )
+ 
+         const float PRE = 1, PRO = 1; //PRE and PRO allow us to restrict the range somewhat
+ 
+-        for( uint z = 0; z < m_rows; ++z )
++        for( int z = 0; z < m_rows; ++z )
+             m_yscale[z] = 1 - ( log10( PRE + z ) / log10( PRE + m_rows + PRO ) );
+ 
+         m_yscale[m_rows] = 0;
+@@ -203,7 +202,7 @@ BlockAnalyzer::paletteChange( const QPalette& ) //virtual
+ 
+     bar()->fill( bg );
+ 
+-    for( int y = 0; ( uint )y < m_rows; ++y )
++    for( int y = 0; y < m_rows; ++y )
+         //graduate the fg color
+         p.fillRect( 0, y * ( BLOCK_HEIGHT + 1 ), BLOCK_WIDTH, BLOCK_HEIGHT, QColor( r + int( dr * y ), g + int( dg * y ), b + int( db * y ) ) );
+ 
+@@ -226,7 +225,7 @@ BlockAnalyzer::paletteChange( const QPalette& ) //virtual
+             m_fade_bars[y].fill( palette().color( QPalette::Active, QPalette::Window ) );
+             const double Y = 1.0 - ( log10( ( FADE_SIZE ) - y ) / log10( ( FADE_SIZE ) ) );
+             QPainter f( &m_fade_bars[y] );
+-            for( int z = 0; ( uint )z < m_rows; ++z )
++            for( int z = 0; z < m_rows; ++z )
+                 f.fillRect( 0, z * ( BLOCK_HEIGHT + 1 ), BLOCK_WIDTH, BLOCK_HEIGHT, QColor( r + int( dr * Y ), g + int( dg * Y ), b + int( db * Y ) ) );
+         }
+     }
+@@ -243,8 +242,8 @@ BlockAnalyzer::drawBackground()
+     m_background.fill( bg );
+ 
+     QPainter p( &m_background );
+-    for( int x = 0; ( uint )x < m_columns; ++x )
+-        for( int y = 0; ( uint )y < m_rows; ++y )
++    for( int x = 0; x < m_columns; ++x )
++        for( int y = 0; y < m_rows; ++y )
+             p.fillRect( x * ( BLOCK_WIDTH + 1 ), y * ( BLOCK_HEIGHT + 1 ) + m_y, BLOCK_WIDTH, BLOCK_HEIGHT, bgdark );
+ 
+ }
+diff --git a/src/context/applets/analyzer/BlockAnalyzer.h b/src/context/applets/analyzer/BlockAnalyzer.h
+index 5a80609..6b14e4e 100644
+--- a/src/context/applets/analyzer/BlockAnalyzer.h
++++ b/src/context/applets/analyzer/BlockAnalyzer.h
+@@ -54,7 +54,7 @@ private:
+         return &m_barPixmap;
+     }
+ 
+-    uint m_columns, m_rows;      //number of rows and columns of blocks
++    int m_columns, m_rows;      //number of rows and columns of blocks
+     uint m_y;                    //y-offset from top of widget
+     QPixmap m_barPixmap;
+     QPixmap m_topBarPixmap;
+-- 
+1.9.3
+
diff --git a/0014-Fix-compilation-and-linking-issues.patch b/0014-Fix-compilation-and-linking-issues.patch
new file mode 100644
index 0000000..f5334ce
--- /dev/null
+++ b/0014-Fix-compilation-and-linking-issues.patch
@@ -0,0 +1,27 @@
+From 9941fffa203e5d068620c3230795e3bc6412eba4 Mon Sep 17 00:00:00 2001
+From: Mark Kretschmann <kretschmann at kde.org>
+Date: Sat, 17 Aug 2013 09:35:25 +0200
+Subject: [PATCH 014/448] Fix compilation and linking issues.
+
+---
+ src/context/applets/analyzer/BlockAnalyzer.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/context/applets/analyzer/BlockAnalyzer.cpp b/src/context/applets/analyzer/BlockAnalyzer.cpp
+index e04aa73..562877e 100644
+--- a/src/context/applets/analyzer/BlockAnalyzer.cpp
++++ b/src/context/applets/analyzer/BlockAnalyzer.cpp
+@@ -60,8 +60,8 @@ BlockAnalyzer::resizeEvent( QResizeEvent *e )
+     const int oldRows = m_rows;
+ 
+     // Rounded up so that the last column/line is covered if partially visible
+-    m_columns = qMin<int>( ceil( (double)width() / ( BLOCK_WIDTH + 1 ) ), MAX_COLUMNS );
+-    m_rows    = ceil( (double)height() / ( BLOCK_HEIGHT + 1 ) );
++    m_columns = std::min( std::ceil( (double)width() / ( BLOCK_WIDTH + 1 ) ), (double)MAX_COLUMNS );
++    m_rows    = std::ceil( (double)height() / ( BLOCK_HEIGHT + 1 ) );
+ 
+     //this is the y-offset for drawing from the top of the widget
+     m_y = ( height() - ( m_rows * ( BLOCK_HEIGHT + 1 ) ) + 2 ) / 2;
+-- 
+1.9.3
+
diff --git a/0039-Optimization-Don-t-draw-more-than-necessary.patch b/0039-Optimization-Don-t-draw-more-than-necessary.patch
new file mode 100644
index 0000000..23e26ed
--- /dev/null
+++ b/0039-Optimization-Don-t-draw-more-than-necessary.patch
@@ -0,0 +1,48 @@
+From 8d6e72597fdfd3023ac5287ea19d8b8b3747e5ed Mon Sep 17 00:00:00 2001
+From: Mark Kretschmann <kretschmann at kde.org>
+Date: Mon, 26 Aug 2013 13:27:01 +0200
+Subject: [PATCH 039/448] Optimization: Don't draw more than necessary.
+
+---
+ 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 562877e..404e26a 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 )         //int
+     , m_rows( 0 )            //int
+     , 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>
+@@ -67,6 +64,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 )
+     {
+@@ -179,10 +177,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.9.3
+
diff --git a/0070-Rewrite-Block-Analyzer-to-use-pure-OpenGL-instead-of.patch b/0070-Rewrite-Block-Analyzer-to-use-pure-OpenGL-instead-of.patch
new file mode 100644
index 0000000..ea9fd5d
--- /dev/null
+++ b/0070-Rewrite-Block-Analyzer-to-use-pure-OpenGL-instead-of.patch
@@ -0,0 +1,453 @@
+From f4a3f4fcf59cc0c592bd6d703542cb162a19721c Mon Sep 17 00:00:00 2001
+From: Mark Kretschmann <kretschmann at kde.org>
+Date: Fri, 19 Jul 2013 10:37:42 +0200
+Subject: [PATCH 070/448] Rewrite Block Analyzer to use pure OpenGL instead of
+ QGLPaintEngine2.
+
+This rewrite should fix a number of issues that users had, especially
+with Intel drivers. The issues, including crashes, are all due to driver
+bugs, but essentially they were triggered by Qt using some uncommon
+features for texture drawing (stencil operations, etc).
+
+This commit should be backported to 2.8.1.
+
+CCMAIL: amarok-devel at kde.org
+CCBUG: 323635
+BACKPORT
+---
+ ChangeLog                                      |   1 +
+ src/context/applets/analyzer/AnalyzerBase.cpp  |  34 +++-----
+ src/context/applets/analyzer/AnalyzerBase.h    |  22 +-----
+ src/context/applets/analyzer/BallsAnalyzer.cpp |   2 +-
+ src/context/applets/analyzer/BallsAnalyzer.h   |   2 +-
+ src/context/applets/analyzer/BlockAnalyzer.cpp | 105 +++++++++++++++++++------
+ src/context/applets/analyzer/BlockAnalyzer.h   |  19 +++--
+ src/context/applets/analyzer/DiscoAnalyzer.cpp |   2 +-
+ src/context/applets/analyzer/DiscoAnalyzer.h   |   2 +-
+ 9 files changed, 111 insertions(+), 78 deletions(-)
+
+diff --git a/src/context/applets/analyzer/AnalyzerBase.cpp b/src/context/applets/analyzer/AnalyzerBase.cpp
+index c413d37..0e649f8 100644
+--- a/src/context/applets/analyzer/AnalyzerBase.cpp
++++ b/src/context/applets/analyzer/AnalyzerBase.cpp
+@@ -42,7 +42,8 @@ Analyzer::Base::Base( QWidget *parent )
+ {
+     connect( EngineController::instance(), SIGNAL( playbackStateChanged() ), this, SLOT( playbackStateChanged() ) );
+ 
+-    m_demoTimer->setInterval( 33 );
++    setFps( 60 ); // Default unless changed by subclass
++    m_demoTimer->setInterval( 33 );  // ~30 fps
+ 
+     enableDemo( !EngineController::instance()->isPlaying() );
+ 
+@@ -50,6 +51,13 @@ Analyzer::Base::Base( QWidget *parent )
+     connect( KWindowSystem::self(), SIGNAL( currentDesktopChanged( int ) ), this, SLOT( currentDesktopChanged() ) );
+ #endif
+ 
++    connect( m_renderTimer, SIGNAL( timeout() ), this, SLOT( updateGL() ) );
++
++    //initialize openGL context before managing GL calls
++    makeCurrent();
++
++    initializeGLFunctions();
++
+     connectSignals();
+ }
+ 
+@@ -213,28 +221,10 @@ Analyzer::Base::interpolate( const QVector<float> &inVec, QVector<float> &outVec
+     }
+ }
+ 
+-
+-
+-
+-Analyzer::Base2D::Base2D( QWidget *parent )
+-    : Base( parent )
+-{
+-    m_renderTimer->setInterval( 20 ); //~50 FPS
+-    connect( m_renderTimer, SIGNAL( timeout() ), this, SLOT( update() ) );
+-}
+-
+-
+-
+-Analyzer::Base3D::Base3D( QWidget *parent )
+-    : Base( parent )
++void
++Analyzer::Base::setFps( int fps )
+ {
+-    m_renderTimer->setInterval( 17 ); //~60 FPS
+-    connect( m_renderTimer, SIGNAL( timeout() ), this, SLOT( updateGL() ) );
+-
+-    //initialize openGL context before managing GL calls
+-    makeCurrent();
+-
+-    initializeGLFunctions();
++    m_renderTimer->setInterval( 1000 / fps );
+ }
+ 
+ 
+diff --git a/src/context/applets/analyzer/AnalyzerBase.h b/src/context/applets/analyzer/AnalyzerBase.h
+index df81152..0497428 100644
+--- a/src/context/applets/analyzer/AnalyzerBase.h
++++ b/src/context/applets/analyzer/AnalyzerBase.h
+@@ -36,7 +36,7 @@
+ namespace Analyzer
+ {
+ 
+-class Base : public QGLWidget
++class Base : public QGLWidget, protected QGLFunctions
+ {
+     Q_OBJECT
+ 
+@@ -49,6 +49,8 @@ protected:
+     virtual void transform( QVector<float>& );
+     virtual void analyze( const QVector<float>& ) = 0;
+ 
++    void setFps( int fps );
++
+     FHT    *m_fht;
+     QTimer *m_renderTimer;
+ 
+@@ -71,24 +73,6 @@ private:
+ };
+ 
+ 
+-class Base2D : public Base
+-{
+-    Q_OBJECT
+-
+-protected:
+-    Base2D( QWidget* );
+-};
+-
+-
+-class Base3D : public Base, protected QGLFunctions
+-{
+-    Q_OBJECT
+-
+-protected:
+-    Base3D( QWidget* );
+-};
+-
+-
+ } //END namespace Analyzer
+ 
+ 
+diff --git a/src/context/applets/analyzer/BallsAnalyzer.cpp b/src/context/applets/analyzer/BallsAnalyzer.cpp
+index 2d633f8..6b4512f 100644
+--- a/src/context/applets/analyzer/BallsAnalyzer.cpp
++++ b/src/context/applets/analyzer/BallsAnalyzer.cpp
+@@ -118,7 +118,7 @@ private:
+ 
+ 
+ BallsAnalyzer::BallsAnalyzer( QWidget *parent ):
+-    Analyzer::Base3D( parent )
++    Analyzer::Base( parent )
+ {
+     setObjectName( "Balls" );
+ 
+diff --git a/src/context/applets/analyzer/BallsAnalyzer.h b/src/context/applets/analyzer/BallsAnalyzer.h
+index b606814..f7d7365 100644
+--- a/src/context/applets/analyzer/BallsAnalyzer.h
++++ b/src/context/applets/analyzer/BallsAnalyzer.h
+@@ -24,7 +24,7 @@ class QWidget;
+ class Ball;
+ class Paddle;
+ 
+-class BallsAnalyzer : public Analyzer::Base3D
++class BallsAnalyzer : public Analyzer::Base
+ {
+ public:
+     BallsAnalyzer( QWidget * );
+diff --git a/src/context/applets/analyzer/BlockAnalyzer.cpp b/src/context/applets/analyzer/BlockAnalyzer.cpp
+index 404e26a..03fefae 100644
+--- a/src/context/applets/analyzer/BlockAnalyzer.cpp
++++ b/src/context/applets/analyzer/BlockAnalyzer.cpp
+@@ -31,28 +31,47 @@ static inline uint myMax( uint v1, uint v2 )
+ }
+ 
+ BlockAnalyzer::BlockAnalyzer( QWidget *parent )
+-    : Analyzer::Base2D( parent )
++    : Analyzer::Base( parent )
+     , m_columns( 0 )         //int
+     , m_rows( 0 )            //int
+     , m_y( 0 )               //uint
+-    , m_topBarPixmap( BLOCK_WIDTH, BLOCK_HEIGHT )
++    , m_barTexture( 0 )
++    , m_topBarTexture( 0 )
+     , m_fade_bars( FADE_SIZE ) //vector<QPixmap>
+     , m_fade_pos( MAX_COLUMNS, 50 ) //vector<uint>
+     , m_fade_intensity( MAX_COLUMNS, 32 ) //vector<uint>
++    , m_background( 0 )
+ {
+     setObjectName( "Blocky" );
+     setMaximumWidth( MAX_COLUMNS * ( BLOCK_WIDTH + 1 ) - 1 );
++    setFps( 50 );
+ }
+ 
+ BlockAnalyzer::~BlockAnalyzer()
+-{}
++{
++    deleteTexture( m_barTexture );
++    deleteTexture( m_topBarTexture );
++
++    foreach( GLuint id, m_fade_bars )
++        deleteTexture( id );
++}
++
++void
++BlockAnalyzer::initializeGL()
++{
++    // Disable depth test (all is drawn on a 2d plane)
++    glDisable( GL_DEPTH_TEST );
++}
+ 
+ void
+-BlockAnalyzer::resizeEvent( QResizeEvent *e )
++BlockAnalyzer::resizeGL( int w, int h )
+ {
+-    Analyzer::Base2D::resizeEvent( e );
++    glViewport( 0, 0, (GLint)w, (GLint)h );
+ 
+-    m_background = QPixmap( size() );
++    // Set up a 2D projection matrix
++    glMatrixMode( GL_PROJECTION );
++    glLoadIdentity();
++    glOrtho( 0.0, (GLdouble)w, (GLdouble)h, 0.0, 0.0, 1.0 );
+ 
+     const int oldRows = m_rows;
+ 
+@@ -70,9 +89,6 @@ BlockAnalyzer::resizeEvent( QResizeEvent *e )
+     {
+         m_barPixmap = QPixmap( BLOCK_WIDTH, m_rows * ( BLOCK_HEIGHT + 1 ) );
+ 
+-        for( int i = 0; i < FADE_SIZE; ++i )
+-            m_fade_bars[i] = QPixmap( BLOCK_WIDTH, m_rows * ( BLOCK_HEIGHT + 1 ) );
+-
+         m_yscale.resize( m_rows + 1 );
+ 
+         const float PRE = 1, PRO = 1; //PRE and PRO allow us to restrict the range somewhat
+@@ -123,7 +139,7 @@ BlockAnalyzer::analyze( const QVector<float> &s )
+ }
+ 
+ void
+-BlockAnalyzer::paintEvent( QPaintEvent* )
++BlockAnalyzer::paintGL()
+ {
+     // y = 2 3 2 1 0 2
+     //     . . . . # .
+@@ -138,10 +154,11 @@ BlockAnalyzer::paintEvent( QPaintEvent* )
+     // m_yscale looks similar to: { 0.7, 0.5, 0.25, 0.15, 0.1, 0 }
+     // if it contains 6 elements there are 5 rows in the analyzer
+ 
+-    QPainter p( this );
++    glMatrixMode( GL_MODELVIEW );
++    glLoadIdentity();
+ 
+     // Paint the background
+-    p.drawPixmap( 0, 0, m_background );
++    drawTexture( m_background, 0, 0, 0, 0, width(), height() );
+ 
+     for( uint y, x = 0; x < (uint)m_scope.size(); ++x )
+     {
+@@ -169,36 +186,66 @@ BlockAnalyzer::paintEvent( QPaintEvent* )
+             const uint offset = --m_fade_intensity[x];
+             const uint y = m_y + ( m_fade_pos[x] * ( BLOCK_HEIGHT + 1 ) );
+             if( y < (uint)height() )
+-                p.drawPixmap( x * ( BLOCK_WIDTH + 1 ), y, m_fade_bars[offset], 0, 0, BLOCK_WIDTH, height() - y );
++                drawTexture( m_fade_bars[offset], x * ( BLOCK_WIDTH + 1 ), y, 0, 0, BLOCK_WIDTH, height() );
+         }
+ 
+         if( m_fade_intensity[x] == 0 )
+             m_fade_pos[x] = m_rows;
+ 
+         // 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 );
++        drawTexture( m_barTexture, x * ( BLOCK_WIDTH + 1 ), y * ( BLOCK_HEIGHT + 1 ) + m_y, 0, y * ( BLOCK_HEIGHT + 1 ), m_barPixmap.width(), m_barPixmap.height() );
+ 
+-        // Draw top pixmaps
+-        p.drawPixmap( x * ( BLOCK_WIDTH + 1 ), int( m_store[x] ) * ( BLOCK_HEIGHT + 1 ) + m_y, m_topBarPixmap );
++        // Draw top bar
++        drawTexture( m_topBarTexture, x * ( BLOCK_WIDTH + 1 ), int( m_store[x] ) * ( BLOCK_HEIGHT + 1 ) + m_y, 0, 0, BLOCK_WIDTH, BLOCK_HEIGHT );
+     }
+ }
+ 
+ void
++BlockAnalyzer::drawTexture( GLuint textureId, int x, int y, int sx, int sy, int w, int h )
++{
++    const GLfloat xf = x;
++    const GLfloat yf = y;
++    const GLfloat sxf = (GLfloat)sx / m_barPixmap.width();
++    const GLfloat syf = (GLfloat)sy / m_barPixmap.height();
++    const GLfloat wf = w - sx;
++    const GLfloat hf = h - sy;
++
++    glEnable( GL_TEXTURE_2D );
++    glBindTexture( GL_TEXTURE_2D, textureId );
++
++    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
++    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
++
++    // Draw a textured quad
++    glBegin(GL_QUADS);
++    glTexCoord2f( sxf, syf ); glVertex2f( xf, yf );
++    glTexCoord2f( sxf, 1.0 ); glVertex2f( xf, yf + hf );
++    glTexCoord2f( 1.0, 1.0 ); glVertex2f( xf + wf, yf + hf );
++    glTexCoord2f( 1.0, syf ); glVertex2f( xf + wf, yf );
++    glEnd();
++
++    glDisable( GL_TEXTURE_2D );
++}
++
++void
+ BlockAnalyzer::paletteChange( const QPalette& ) //virtual
+ {
+-    QPainter p( bar() );
++    QPainter p( &m_barPixmap );
+ 
+     const QColor bg = The::paletteHandler()->backgroundColor();
+     const QColor fg = palette().color( QPalette::Active, QPalette::Highlight );
+ 
+-    m_topBarPixmap.fill( fg );
++    QPixmap topBar( BLOCK_WIDTH, BLOCK_HEIGHT );
++    topBar.fill( fg );
++    deleteTexture( m_topBarTexture );
++    m_topBarTexture = bindTexture( topBar );
+ 
+     const double dr = 15 * double( bg.red()   - fg.red() )   / ( m_rows * 16 );
+     const double dg = 15 * double( bg.green() - fg.green() ) / ( m_rows * 16 );
+     const double db = 15 * double( bg.blue()  - fg.blue() )  / ( m_rows * 16 );
+     const int r = fg.red(), g = fg.green(), b = fg.blue();
+ 
+-    bar()->fill( bg );
++    m_barPixmap.fill( bg );
+ 
+     for( int y = 0; y < m_rows; ++y )
+         //graduate the fg color
+@@ -220,14 +267,23 @@ BlockAnalyzer::paletteChange( const QPalette& ) //virtual
+         // Precalculate all fade-bar pixmaps
+         for( int y = 0; y < FADE_SIZE; ++y )
+         {
+-            m_fade_bars[y].fill( palette().color( QPalette::Active, QPalette::Window ) );
++            QPixmap fadeBar( BLOCK_WIDTH, m_rows * ( BLOCK_HEIGHT + 1 ) );
++
++            fadeBar.fill( palette().color( QPalette::Active, QPalette::Window ) );
+             const double Y = 1.0 - ( log10( ( FADE_SIZE ) - y ) / log10( ( FADE_SIZE ) ) );
+-            QPainter f( &m_fade_bars[y] );
++            QPainter f( &fadeBar );
+             for( int z = 0; z < m_rows; ++z )
+                 f.fillRect( 0, z * ( BLOCK_HEIGHT + 1 ), BLOCK_WIDTH, BLOCK_HEIGHT, QColor( r + int( dr * Y ), g + int( dg * Y ), b + int( db * Y ) ) );
++
++            deleteTexture( m_fade_bars[y] );
++            m_fade_bars[y] = bindTexture( fadeBar );
+         }
+     }
+ 
++    const QImage image = m_barPixmap.toImage();
++    deleteTexture( m_barTexture );
++    m_barTexture = bindTexture( image.mirrored() ); // Flip vertically because OpenGL has inverted y coordinates
++
+     drawBackground();
+ }
+ 
+@@ -237,11 +293,14 @@ BlockAnalyzer::drawBackground()
+     const QColor bg = palette().color( QPalette::Active, QPalette::Window );
+     const QColor bgdark = bg.dark( 112 );
+ 
+-    m_background.fill( bg );
++    QPixmap background( size() );
++    background.fill( bg );
+ 
+-    QPainter p( &m_background );
++    QPainter p( &background );
+     for( int x = 0; x < m_columns; ++x )
+         for( int y = 0; y < m_rows; ++y )
+             p.fillRect( x * ( BLOCK_WIDTH + 1 ), y * ( BLOCK_HEIGHT + 1 ) + m_y, BLOCK_WIDTH, BLOCK_HEIGHT, bgdark );
+ 
++    deleteTexture( m_background );
++    m_background = bindTexture( background );
+ }
+diff --git a/src/context/applets/analyzer/BlockAnalyzer.h b/src/context/applets/analyzer/BlockAnalyzer.h
+index 6b14e4e..318289a 100644
+--- a/src/context/applets/analyzer/BlockAnalyzer.h
++++ b/src/context/applets/analyzer/BlockAnalyzer.h
+@@ -24,7 +24,7 @@ class QMouseEvent;
+ class QPalette;
+ class QResizeEvent;
+ 
+-class BlockAnalyzer : public Analyzer::Base2D
++class BlockAnalyzer : public Analyzer::Base
+ {
+ public:
+     BlockAnalyzer( QWidget* );
+@@ -39,33 +39,32 @@ public:
+     static const int FADE_SIZE    = 90;
+ 
+ protected:
++    virtual void initializeGL();
++    virtual void paintGL();
++    virtual void resizeGL( int w, int h );
+     virtual void transform( QVector<float>& );
+     virtual void analyze( const QVector<float>& );
+-    virtual void paintEvent( QPaintEvent* );
+-    virtual void resizeEvent( QResizeEvent* );
+     virtual void paletteChange( const QPalette& );
+ 
+     void drawBackground();
+     void determineStep();
+ 
+ private:
+-    QPixmap* bar()
+-    {
+-        return &m_barPixmap;
+-    }
++    void drawTexture( GLuint textureId, int x, int y, int sx, int sy, int w, int h );
+ 
+     int m_columns, m_rows;      //number of rows and columns of blocks
+     uint m_y;                    //y-offset from top of widget
++    GLuint m_barTexture;
++    GLuint m_topBarTexture;
+     QPixmap m_barPixmap;
+-    QPixmap m_topBarPixmap;
+     QVector<float> m_scope;      //so we don't create a vector every frame
+     QVector<float> m_store;  //current bar heights
+     QVector<float> m_yscale;
+ 
+-    QVector<QPixmap> m_fade_bars;
++    QVector<GLuint>  m_fade_bars;
+     QVector<uint>    m_fade_pos;
+     QVector<int>     m_fade_intensity;
+-    QPixmap          m_background;
++    GLuint           m_background;
+ 
+     float m_step; //rows to fall per frame
+ };
+diff --git a/src/context/applets/analyzer/DiscoAnalyzer.cpp b/src/context/applets/analyzer/DiscoAnalyzer.cpp
+index ce3f56d..a81cde4 100644
+--- a/src/context/applets/analyzer/DiscoAnalyzer.cpp
++++ b/src/context/applets/analyzer/DiscoAnalyzer.cpp
+@@ -25,7 +25,7 @@
+ 
+ 
+ DiscoAnalyzer::DiscoAnalyzer( QWidget *parent ):
+-    Analyzer::Base3D( parent )
++    Analyzer::Base( parent )
+ {
+     setObjectName( "Disco" );
+ 
+diff --git a/src/context/applets/analyzer/DiscoAnalyzer.h b/src/context/applets/analyzer/DiscoAnalyzer.h
+index 3d54f77..d41b46c 100644
+--- a/src/context/applets/analyzer/DiscoAnalyzer.h
++++ b/src/context/applets/analyzer/DiscoAnalyzer.h
+@@ -23,7 +23,7 @@
+ 
+ class QPaintEvent;
+ 
+-class DiscoAnalyzer : public Analyzer::Base3D
++class DiscoAnalyzer : public Analyzer::Base
+ {
+ public:
+     DiscoAnalyzer( QWidget * );
+-- 
+1.9.3
+
diff --git a/0071-Fix-rendering-glitch-introduced-with-commit-f4a3f4f.patch b/0071-Fix-rendering-glitch-introduced-with-commit-f4a3f4f.patch
new file mode 100644
index 0000000..e44f67a
--- /dev/null
+++ b/0071-Fix-rendering-glitch-introduced-with-commit-f4a3f4f.patch
@@ -0,0 +1,197 @@
+From d2fef6cb1a0293a000edbf87fd566574b6e8ae51 Mon Sep 17 00:00:00 2001
+From: Mark Kretschmann <kretschmann at kde.org>
+Date: Sat, 19 Oct 2013 16:48:12 +0200
+Subject: [PATCH 071/448] Fix rendering glitch introduced with commit f4a3f4f.
+
+CCBUG: 323635
+BACKPORT
+---
+ src/context/applets/analyzer/BlockAnalyzer.cpp | 47 ++++++++++++--------------
+ src/context/applets/analyzer/BlockAnalyzer.h   | 31 ++++++++++++++---
+ 2 files changed, 48 insertions(+), 30 deletions(-)
+
+diff --git a/src/context/applets/analyzer/BlockAnalyzer.cpp b/src/context/applets/analyzer/BlockAnalyzer.cpp
+index 03fefae..1cf85d1 100644
+--- a/src/context/applets/analyzer/BlockAnalyzer.cpp
++++ b/src/context/applets/analyzer/BlockAnalyzer.cpp
+@@ -35,12 +35,9 @@ BlockAnalyzer::BlockAnalyzer( QWidget *parent )
+     , m_columns( 0 )         //int
+     , m_rows( 0 )            //int
+     , m_y( 0 )               //uint
+-    , m_barTexture( 0 )
+-    , m_topBarTexture( 0 )
+     , m_fade_bars( FADE_SIZE ) //vector<QPixmap>
+     , m_fade_pos( MAX_COLUMNS, 50 ) //vector<uint>
+     , m_fade_intensity( MAX_COLUMNS, 32 ) //vector<uint>
+-    , m_background( 0 )
+ {
+     setObjectName( "Blocky" );
+     setMaximumWidth( MAX_COLUMNS * ( BLOCK_WIDTH + 1 ) - 1 );
+@@ -49,11 +46,11 @@ BlockAnalyzer::BlockAnalyzer( QWidget *parent )
+ 
+ BlockAnalyzer::~BlockAnalyzer()
+ {
+-    deleteTexture( m_barTexture );
+-    deleteTexture( m_topBarTexture );
++    deleteTexture( m_barTexture.id );
++    deleteTexture( m_topBarTexture.id );
+ 
+-    foreach( GLuint id, m_fade_bars )
+-        deleteTexture( id );
++    foreach( Texture texture, m_fade_bars )
++        deleteTexture( texture.id );
+ }
+ 
+ void
+@@ -158,7 +155,7 @@ BlockAnalyzer::paintGL()
+     glLoadIdentity();
+ 
+     // Paint the background
+-    drawTexture( m_background, 0, 0, 0, 0, width(), height() );
++    drawTexture( m_background, 0, 0, 0, 0 );
+ 
+     for( uint y, x = 0; x < (uint)m_scope.size(); ++x )
+     {
+@@ -186,32 +183,32 @@ BlockAnalyzer::paintGL()
+             const uint offset = --m_fade_intensity[x];
+             const uint y = m_y + ( m_fade_pos[x] * ( BLOCK_HEIGHT + 1 ) );
+             if( y < (uint)height() )
+-                drawTexture( m_fade_bars[offset], x * ( BLOCK_WIDTH + 1 ), y, 0, 0, BLOCK_WIDTH, height() );
++                drawTexture( m_fade_bars[offset], x * ( BLOCK_WIDTH + 1 ), y, 0, 0 );
+         }
+ 
+         if( m_fade_intensity[x] == 0 )
+             m_fade_pos[x] = m_rows;
+ 
+         // REMEMBER: y is a number from 0 to m_rows, 0 means all blocks are glowing, m_rows means none are
+-        drawTexture( m_barTexture, x * ( BLOCK_WIDTH + 1 ), y * ( BLOCK_HEIGHT + 1 ) + m_y, 0, y * ( BLOCK_HEIGHT + 1 ), m_barPixmap.width(), m_barPixmap.height() );
++        drawTexture( m_barTexture, x * ( BLOCK_WIDTH + 1 ), y * ( BLOCK_HEIGHT + 1 ) + m_y, 0, y * ( BLOCK_HEIGHT + 1 ) );
+ 
+         // Draw top bar
+-        drawTexture( m_topBarTexture, x * ( BLOCK_WIDTH + 1 ), int( m_store[x] ) * ( BLOCK_HEIGHT + 1 ) + m_y, 0, 0, BLOCK_WIDTH, BLOCK_HEIGHT );
++        drawTexture( m_topBarTexture, x * ( BLOCK_WIDTH + 1 ), int( m_store[x] ) * ( BLOCK_HEIGHT + 1 ) + m_y, 0, 0 );
+     }
+ }
+ 
+ void
+-BlockAnalyzer::drawTexture( GLuint textureId, int x, int y, int sx, int sy, int w, int h )
++BlockAnalyzer::drawTexture( Texture texture, int x, int y, int sx, int sy )
+ {
+     const GLfloat xf = x;
+     const GLfloat yf = y;
+-    const GLfloat sxf = (GLfloat)sx / m_barPixmap.width();
+-    const GLfloat syf = (GLfloat)sy / m_barPixmap.height();
+-    const GLfloat wf = w - sx;
+-    const GLfloat hf = h - sy;
++    const GLfloat wf = texture.size.width() - sx;
++    const GLfloat hf = texture.size.height() - sy;
++    const GLfloat sxf = (GLfloat)sx / texture.size.width();
++    const GLfloat syf = (GLfloat)sy / texture.size.height();
+ 
+     glEnable( GL_TEXTURE_2D );
+-    glBindTexture( GL_TEXTURE_2D, textureId );
++    glBindTexture( GL_TEXTURE_2D, texture.id );
+ 
+     glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
+     glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
+@@ -237,8 +234,8 @@ BlockAnalyzer::paletteChange( const QPalette& ) //virtual
+ 
+     QPixmap topBar( BLOCK_WIDTH, BLOCK_HEIGHT );
+     topBar.fill( fg );
+-    deleteTexture( m_topBarTexture );
+-    m_topBarTexture = bindTexture( topBar );
++    deleteTexture( m_topBarTexture.id );
++    m_topBarTexture = Texture( bindTexture( topBar ), topBar.size() );
+ 
+     const double dr = 15 * double( bg.red()   - fg.red() )   / ( m_rows * 16 );
+     const double dg = 15 * double( bg.green() - fg.green() ) / ( m_rows * 16 );
+@@ -275,14 +272,14 @@ BlockAnalyzer::paletteChange( const QPalette& ) //virtual
+             for( int z = 0; z < m_rows; ++z )
+                 f.fillRect( 0, z * ( BLOCK_HEIGHT + 1 ), BLOCK_WIDTH, BLOCK_HEIGHT, QColor( r + int( dr * Y ), g + int( dg * Y ), b + int( db * Y ) ) );
+ 
+-            deleteTexture( m_fade_bars[y] );
+-            m_fade_bars[y] = bindTexture( fadeBar );
++            deleteTexture( m_fade_bars[y].id );
++            m_fade_bars[y] = Texture( bindTexture( fadeBar ), fadeBar.size() );
+         }
+     }
+ 
+     const QImage image = m_barPixmap.toImage();
+-    deleteTexture( m_barTexture );
+-    m_barTexture = bindTexture( image.mirrored() ); // Flip vertically because OpenGL has inverted y coordinates
++    deleteTexture( m_barTexture.id );
++    m_barTexture = Texture( bindTexture( image.mirrored() ), image.size() ); // Flip vertically because OpenGL has inverted y coordinates
+ 
+     drawBackground();
+ }
+@@ -301,6 +298,6 @@ BlockAnalyzer::drawBackground()
+         for( int y = 0; y < m_rows; ++y )
+             p.fillRect( x * ( BLOCK_WIDTH + 1 ), y * ( BLOCK_HEIGHT + 1 ) + m_y, BLOCK_WIDTH, BLOCK_HEIGHT, bgdark );
+ 
+-    deleteTexture( m_background );
+-    m_background = bindTexture( background );
++    deleteTexture( m_background.id );
++    m_background = Texture( bindTexture( background ), background.size() );
+ }
+diff --git a/src/context/applets/analyzer/BlockAnalyzer.h b/src/context/applets/analyzer/BlockAnalyzer.h
+index 318289a..50097b7 100644
+--- a/src/context/applets/analyzer/BlockAnalyzer.h
++++ b/src/context/applets/analyzer/BlockAnalyzer.h
+@@ -20,6 +20,8 @@
+ 
+ #include "AnalyzerBase.h"
+ 
++#include <QSize>
++
+ class QMouseEvent;
+ class QPalette;
+ class QResizeEvent;
+@@ -50,21 +52,40 @@ protected:
+     void determineStep();
+ 
+ private:
+-    void drawTexture( GLuint textureId, int x, int y, int sx, int sy, int w, int h );
++    struct Texture
++    {
++        Texture() :
++            id( 0 ),
++            size( QSize() )
++        {}
++        Texture( const GLuint id_, const QSize size_ ) :
++            id( id_ ),
++            size( size_ )
++        {}
++        Texture( const Texture& texture )
++        {
++            id = texture.id;
++            size = texture.size;
++        }
++        GLuint id;
++        QSize size;
++    };
++
++    void drawTexture( Texture texture, int x, int y, int sx, int sy );
+ 
+     int m_columns, m_rows;      //number of rows and columns of blocks
+     uint m_y;                    //y-offset from top of widget
+-    GLuint m_barTexture;
+-    GLuint m_topBarTexture;
++    Texture m_barTexture;
++    Texture m_topBarTexture;
+     QPixmap m_barPixmap;
+     QVector<float> m_scope;      //so we don't create a vector every frame
+     QVector<float> m_store;  //current bar heights
+     QVector<float> m_yscale;
+ 
+-    QVector<GLuint>  m_fade_bars;
++    QVector<Texture> m_fade_bars;
+     QVector<uint>    m_fade_pos;
+     QVector<int>     m_fade_intensity;
+-    GLuint           m_background;
++    Texture           m_background;
+ 
+     float m_step; //rows to fall per frame
+ };
+-- 
+1.9.3
+
diff --git a/amarok.spec b/amarok.spec
index 47a1ede..9b0f646 100644
--- a/amarok.spec
+++ b/amarok.spec
@@ -1,10 +1,14 @@
 
 %define kdewebkit 1
+# define to enable optional -nepomukcollection support
+%if 0%{?fedora} < 22
+%define nepomukcollection 1
+%endif
 
 Name:    amarok
 Summary: Media player
 Version: 2.8.0
-Release: 13%{?dist}
+Release: 14%{?dist}
 
 # KDE e.V. may determine that future GPL versions are accepted
 License: GPLv2 or GPLv3
@@ -24,11 +28,16 @@ Source1: amarok.appdata.xml
 Patch0:  amarok-2.8.0-onlinedoc.patch
 
 # try to allow build without kdewebkit (like rhel), use QWeb* instead of KWeb*
-Patch1: amarok-2.8.0-no_kdewebkit.patch
+#Patch1: amarok-2.8.0-no_kdewebkit.patch
 
 ## upstreamable patches
 
 ## upstream patches
+Patch0004: 0004-Code-cleanup-and-added-comments.patch
+Patch0014: 0014-Fix-compilation-and-linking-issues.patch
+Patch0039: 0039-Optimization-Don-t-draw-more-than-necessary.patch
+Patch0070: 0070-Rewrite-Block-Analyzer-to-use-pure-OpenGL-instead-of.patch
+Patch0071: 0071-Fix-rendering-glitch-introduced-with-commit-f4a3f4f.patch
 
 BuildRequires: curl-devel
 BuildRequires: desktop-file-utils
@@ -81,6 +90,11 @@ Requires: media-player-info
 
 Requires: %{name}-libs%{?_isa} = %{version}-%{release}
 
+%if ! 0%{?nepomukcollection}
+BuildConflicts: nepomuk-core-devel
+Obsoletes: amarok-nepomukcollection < %{version}-%{release}
+%endif
+
 %description
 Amarok is a multimedia player with:
  - fresh playlist concept, very fast to use, with drag and drop
@@ -110,6 +124,7 @@ BuildArch: noarch
 %description doc
 %{summary}.
 
+%if 0%{?nepomukcollection}
 %package nepomukcollection
 Summary: Nepomuk collection plugin for %{name}
 BuildRequires: nepomuk-core-devel
@@ -119,6 +134,7 @@ Obsoletes: amarok < 2.8.0-4
 Requires: %{name} = %{version}-%{release}
 %description nepomukcollection
 %{summary}.
+%endif
 
 
 %prep
@@ -129,9 +145,15 @@ Requires: %{name} = %{version}-%{release}
 %patch1 -p1 -b .no_kdewebkit
 %endif
 
+%patch0004 -p1 -b .0004
+%patch0014 -p1 -b .0014
+%patch0039 -p1 -b .0039
+%patch0070 -p1 -b .0070
+%patch0071 -p1 -b .0071
+
 
 %build
-mkdir -p %{_target_platform}
+mkdir %{_target_platform}
 pushd %{_target_platform}
 %{cmake_kde4} ..
 popd
@@ -140,10 +162,11 @@ make %{?_smp_mflags} -C %{_target_platform}
 
 
 %install
-install -m644 -p -D %{SOURCE1} %{buildroot}%{_kde4_datadir}/appdata/%{name}.appdata.xml
-
 make install/fast DESTDIR=%{buildroot} -C %{_target_platform}
 
+test -f "%{buildroot}%{_kde4_datadir}/appdata/%{name}.appdata.xml" || \
+install -m644 -p -D %{SOURCE1} %{buildroot}%{_kde4_datadir}/appdata/%{name}.appdata.xml
+
 %find_lang amarok --with-kde --without-mo && mv amarok.lang amarok-doc.lang
 %find_lang amarok
 %find_lang amarokcollectionscanner_qt 
@@ -257,12 +280,18 @@ fi
 
 %files doc -f amarok-doc.lang
 
+%if 0%{?nepomukcollection}
 %files nepomukcollection
 %{_kde4_libdir}/kde4/amarok_collection-nepomukcollection.so
 %{_kde4_datadir}/kde4/services/amarok_collection-nepomukcollection.desktop
+%endif
 
 
 %changelog
+* Fri Feb 20 2015 Rex Dieter <rdieter at fedoraproject.org> - 2.8.0-14
+- backport gl crasher workaround (kde#323635)
+- deprecate -nepomukcollection (f22+)
+
 * Sat Nov 08 2014 Rex Dieter <rdieter at fedoraproject.org> 2.8.0-13
 - use fresher upstream appdata (translations mostly)
 


More information about the scm-commits mailing list