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
v3.5.13-sru
tpearson 13 years ago
parent 6963d8ef73
commit c6d80c059c

@ -45,6 +45,8 @@ email : markey@web.de
#include <kurldrag.h> #include <kurldrag.h>
#include <kwin.h> //eventFilter() #include <kwin.h> //eventFilter()
#include <kimageeffect.h>
//simple function for fetching amarok images //simple function for fetching amarok images
namespace Amarok namespace Amarok
{ {
@ -54,14 +56,22 @@ namespace Amarok
{ {
TQString file = !filename.tqendsWith( ".png", false ) ? "amarok/images/%1.png" : "amarok/images/%1"; 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 ) TQPixmap getJPG( const TQString &filename )
{ {
TQString file = !filename.tqendsWith( ".jpg", false ) ? "amarok/images/%1.jpg" : "amarok/images/%1"; 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;
} }
} }

@ -359,8 +359,11 @@ Amarok::VolumeSlider::VolumeSlider( TQWidget *parent, uint max )
setWFlags( getWFlags() | WNoAutoErase ); setWFlags( getWFlags() | WNoAutoErase );
setFocusPolicy( TQ_NoFocus ); setFocusPolicy( TQ_NoFocus );
if (TQPaintDevice::x11AppDepth() == 32) m_pixmapInset.convertFromImage(KImageEffect::convertToPremultipliedAlpha( m_pixmapInset.convertToImage() ));
// BEGIN Calculate handle animation pixmaps for mouse-over effect // BEGIN Calculate handle animation pixmaps for mouse-over effect
TQImage pixmapHandle ( locate( "data","amarok/images/volumeslider-handle.png" ) ); 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" ) ); TQImage pixmapHandleGlow( locate( "data","amarok/images/volumeslider-handle_glow.png" ) );
float opacity = 0.0; float opacity = 0.0;
@ -369,6 +372,7 @@ Amarok::VolumeSlider::VolumeSlider( TQWidget *parent, uint max )
for ( int i = 0; i < ANIM_MAX; ++i ) { for ( int i = 0; i < ANIM_MAX; ++i ) {
dst = pixmapHandle; dst = pixmapHandle;
KImageEffect::blend( pixmapHandleGlow, dst, opacity ); KImageEffect::blend( pixmapHandleGlow, dst, opacity );
if (TQPaintDevice::x11AppDepth() == 32) dst = KImageEffect::convertToPremultipliedAlpha( dst );
m_handlePixmaps.append( TQPixmap( dst ) ); m_handlePixmaps.append( TQPixmap( dst ) );
opacity += step; opacity += step;
} }

Loading…
Cancel
Save