summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/skin.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/skin.cpp b/noncore/multimedia/opieplayer2/skin.cpp
index b95c544..bd176e3 100644
--- a/noncore/multimedia/opieplayer2/skin.cpp
+++ b/noncore/multimedia/opieplayer2/skin.cpp
@@ -121,97 +121,97 @@ QImage Skin::buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint
if ( !d->buttonMask.isNull() )
return d->buttonMask;
QSize buttonAreaSize = buttonUpImage().size();
d->buttonMask = QImage( buttonAreaSize, 8, 255 );
d->buttonMask.fill( 0 );
for ( uint i = 0; i < buttonCount; ++i )
addButtonToMask( skinButtonInfo[ i ].command + 1, buttonMaskImage( skinButtonInfo[ i ].fileName ) );
return d->buttonMask;
}
void Skin::addButtonToMask( int tag, const QImage &maskImage ) const
{
if ( maskImage.isNull() )
return;
uchar **dest = d->buttonMask.jumpTable();
for ( int y = 0; y < d->buttonMask.height(); y++ ) {
uchar *line = dest[y];
for ( int x = 0; x < d->buttonMask.width(); x++ )
if ( !qRed( maskImage.pixel( x, y ) ) )
line[x] = tag;
}
}
QImage Skin::buttonMaskImage( const QString &fileName ) const
{
SkinData::ButtonMaskImageMap::Iterator it = d->buttonMasks.find( fileName );
if ( it == d->buttonMasks.end() ) {
QString prefix = m_skinPath + QString::fromLatin1( "/skin%1_mask_" ).arg( m_fileNameInfix );
QString path = prefix + fileName;
it = d->buttonMasks.insert( fileName, loadImage( path ) );
}
return *it;
}
QString Skin::defaultSkinName()
{
Config cfg( "OpiePlayer" );
cfg.setGroup( "Options" );
return cfg.readEntry( "Skin", "default" );
}
QImage Skin::loadImage( const QString &fileName )
{
- return QImage( OResource::findPixmap( fileName ) );
+ return QImage( Opie::Core::OResource::findPixmap( fileName ) );
}
SkinCache::SkinCache()
{
// let's say we cache two skins (audio+video) at maximum
m_cache.setMaxCost( 2 );
// ... and one background pixmap
m_backgroundPixmapCache.setMaxCost( 1 );
}
SkinData *SkinCache::lookupAndTake( const QString &skinPath, const QString &fileNameInfix )
{
QString key = skinPath + fileNameInfix;
SkinData *data = m_cache.take( key );
if ( !data )
data = new SkinData;
else
odebug << "SkinCache: hit" << oendl;
QPixmap *bgPixmap = m_backgroundPixmapCache.find( skinPath );
if ( bgPixmap ) {
odebug << "SkinCache: hit on bgpixmap" << oendl;
data->backgroundPixmap = *bgPixmap;
}
else
data->backgroundPixmap = QPixmap();
return data;
}
void SkinCache::store( const QString &skinPath, const QString &fileNameInfix, SkinData *data )
{
QPixmap *backgroundPixmap = new QPixmap( data->backgroundPixmap );
data->backgroundPixmap = QPixmap();
QString key = skinPath + fileNameInfix;
if ( m_cache.find( key, false /*ref*/ ) != 0 ||
!m_cache.insert( key, data ) )
delete data;
if ( m_backgroundPixmapCache.find( skinPath, false /*ref*/ ) != 0 ||
!m_backgroundPixmapCache.insert( skinPath, backgroundPixmap ) )
delete backgroundPixmap;
}