From c6d80c059c66bc2949fba164b080bb2a6b81bdbd Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 15 Aug 2011 08:44:25 +0000 Subject: Fix a couple of graphical glitches in Amarok under ARGB 32 bit visual mode git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/amarok@1247330 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- amarok/src/playerwindow.cpp | 14 ++++++++++++-- amarok/src/sliderwidget.cpp | 4 ++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/amarok/src/playerwindow.cpp b/amarok/src/playerwindow.cpp index 91e03f9f..0e42eff0 100644 --- a/amarok/src/playerwindow.cpp +++ b/amarok/src/playerwindow.cpp @@ -45,6 +45,8 @@ email : markey@web.de #include #include //eventFilter() +#include + //simple function for fetching amarok images namespace Amarok { @@ -54,14 +56,22 @@ namespace Amarok { TQString file = !filename.tqendsWith( ".png", false ) ? "amarok/images/%1.png" : "amarok/images/%1"; - return TQPixmap( locate( "data", file.tqarg( filename ) ), "PNG" ); + TQPixmap pix; + TQImage img( locate( "data", file.tqarg( filename ) ), "PNG" ); + if (TQPaintDevice::x11AppDepth() == 32) pix.convertFromImage(KImageEffect::convertToPremultipliedAlpha( img )); + else pix.convertFromImage( img ); + return pix; } TQPixmap getJPG( const TQString &filename ) { TQString file = !filename.tqendsWith( ".jpg", false ) ? "amarok/images/%1.jpg" : "amarok/images/%1"; - return TQPixmap( locate( "data", TQString( "amarok/images/%1.jpg" ).tqarg( filename ) ), "JPEG" ); + TQPixmap pix; + TQImage img( locate( "data", TQString( "amarok/images/%1.jpg" ).tqarg( filename ) ), "JPEG" ); + if (TQPaintDevice::x11AppDepth() == 32) pix.convertFromImage(KImageEffect::convertToPremultipliedAlpha( img )); + else pix.convertFromImage( img ); + return pix; } } diff --git a/amarok/src/sliderwidget.cpp b/amarok/src/sliderwidget.cpp index 15998af7..f0b347ad 100644 --- a/amarok/src/sliderwidget.cpp +++ b/amarok/src/sliderwidget.cpp @@ -359,8 +359,11 @@ Amarok::VolumeSlider::VolumeSlider( TQWidget *parent, uint max ) setWFlags( getWFlags() | WNoAutoErase ); setFocusPolicy( TQ_NoFocus ); + if (TQPaintDevice::x11AppDepth() == 32) m_pixmapInset.convertFromImage(KImageEffect::convertToPremultipliedAlpha( m_pixmapInset.convertToImage() )); + // BEGIN Calculate handle animation pixmaps for mouse-over effect TQImage pixmapHandle ( locate( "data","amarok/images/volumeslider-handle.png" ) ); + if (TQPaintDevice::x11AppDepth() == 32) pixmapHandle = KImageEffect::convertToPremultipliedAlpha( pixmapHandle ); TQImage pixmapHandleGlow( locate( "data","amarok/images/volumeslider-handle_glow.png" ) ); float opacity = 0.0; @@ -369,6 +372,7 @@ Amarok::VolumeSlider::VolumeSlider( TQWidget *parent, uint max ) for ( int i = 0; i < ANIM_MAX; ++i ) { dst = pixmapHandle; KImageEffect::blend( pixmapHandleGlow, dst, opacity ); + if (TQPaintDevice::x11AppDepth() == 32) dst = KImageEffect::convertToPremultipliedAlpha( dst ); m_handlePixmaps.append( TQPixmap( dst ) ); opacity += step; } -- cgit v1.2.1