-rw-r--r-- | noncore/multimedia/opieplayer2/skin.cpp | 46 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/skin.h | 4 |
2 files changed, 25 insertions, 25 deletions
diff --git a/noncore/multimedia/opieplayer2/skin.cpp b/noncore/multimedia/opieplayer2/skin.cpp index e9fb5a6..d6f4080 100644 --- a/noncore/multimedia/opieplayer2/skin.cpp +++ b/noncore/multimedia/opieplayer2/skin.cpp | |||
@@ -37,5 +37,5 @@ struct SkinData | |||
37 | typedef QMap<QString, QImage> ButtonMaskImageMap; | 37 | typedef QMap<QString, QImage> ButtonMaskImageMap; |
38 | 38 | ||
39 | QImage backgroundImage; | 39 | QPixmap backgroundPixmap; |
40 | QImage buttonUpImage; | 40 | QImage buttonUpImage; |
41 | QImage buttonDownImage; | 41 | QImage buttonDownImage; |
@@ -55,5 +55,5 @@ public: | |||
55 | private: | 55 | private: |
56 | typedef QCache<SkinData> DataCache; | 56 | typedef QCache<SkinData> DataCache; |
57 | typedef QCache<QImage> BackgroundImageCache; | 57 | typedef QCache<QPixmap> BackgroundPixmapCache; |
58 | 58 | ||
59 | template <class CacheType> | 59 | template <class CacheType> |
@@ -61,5 +61,5 @@ private: | |||
61 | 61 | ||
62 | DataCache m_cache; | 62 | DataCache m_cache; |
63 | BackgroundImageCache m_backgroundImageCache; | 63 | BackgroundPixmapCache m_backgroundPixmapCache; |
64 | }; | 64 | }; |
65 | 65 | ||
@@ -89,5 +89,5 @@ void Skin::init( const QString &name ) | |||
89 | void Skin::preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) | 89 | void Skin::preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) |
90 | { | 90 | { |
91 | backgroundImage(); | 91 | backgroundPixmap(); |
92 | buttonUpImage(); | 92 | buttonUpImage(); |
93 | buttonDownImage(); | 93 | buttonDownImage(); |
@@ -95,9 +95,9 @@ void Skin::preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint butt | |||
95 | } | 95 | } |
96 | 96 | ||
97 | QImage Skin::backgroundImage() const | 97 | QPixmap Skin::backgroundPixmap() const |
98 | { | 98 | { |
99 | if ( d->backgroundImage.isNull() ) | 99 | if ( d->backgroundPixmap.isNull() ) |
100 | d->backgroundImage = loadImage( QString( "%1/background" ).arg( m_skinPath ) ); | 100 | d->backgroundPixmap = loadImage( QString( "%1/background" ).arg( m_skinPath ) ); |
101 | return d->backgroundImage; | 101 | return d->backgroundPixmap; |
102 | } | 102 | } |
103 | 103 | ||
@@ -174,5 +174,5 @@ SkinCache::SkinCache() | |||
174 | m_cache.setMaxCost( 2 ); | 174 | m_cache.setMaxCost( 2 ); |
175 | // ... and one background pixmap | 175 | // ... and one background pixmap |
176 | m_backgroundImageCache.setMaxCost( 1 ); | 176 | m_backgroundPixmapCache.setMaxCost( 1 ); |
177 | } | 177 | } |
178 | 178 | ||
@@ -187,11 +187,11 @@ SkinData *SkinCache::lookupAndTake( const QString &skinPath, const QString &file | |||
187 | qDebug( "SkinCache: hit" ); | 187 | qDebug( "SkinCache: hit" ); |
188 | 188 | ||
189 | QImage *bgImage = m_backgroundImageCache.find( skinPath ); | 189 | QPixmap *bgPixmap = m_backgroundPixmapCache.find( skinPath ); |
190 | if ( bgImage ) { | 190 | if ( bgPixmap ) { |
191 | qDebug( "SkinCache: hit on bgimage" ); | 191 | qDebug( "SkinCache: hit on bgpixmap" ); |
192 | data->backgroundImage = *bgImage; | 192 | data->backgroundPixmap = *bgPixmap; |
193 | } | 193 | } |
194 | else | 194 | else |
195 | data->backgroundImage = QImage(); | 195 | data->backgroundPixmap = QPixmap(); |
196 | 196 | ||
197 | return data; | 197 | return data; |
@@ -200,7 +200,7 @@ SkinData *SkinCache::lookupAndTake( const QString &skinPath, const QString &file | |||
200 | void SkinCache::store( const QString &skinPath, const QString &fileNameInfix, SkinData *data ) | 200 | void SkinCache::store( const QString &skinPath, const QString &fileNameInfix, SkinData *data ) |
201 | { | 201 | { |
202 | QImage *backgroundImage = new QImage( data->backgroundImage ); | 202 | QPixmap *backgroundPixmap = new QPixmap( data->backgroundPixmap ); |
203 | 203 | ||
204 | data->backgroundImage = QImage(); | 204 | data->backgroundPixmap = QPixmap(); |
205 | 205 | ||
206 | QString key = skinPath + fileNameInfix; | 206 | QString key = skinPath + fileNameInfix; |
@@ -210,7 +210,7 @@ void SkinCache::store( const QString &skinPath, const QString &fileNameInfix, Sk | |||
210 | delete data; | 210 | delete data; |
211 | 211 | ||
212 | if ( m_backgroundImageCache.find( skinPath, false /*ref*/ ) != 0 || | 212 | if ( m_backgroundPixmapCache.find( skinPath, false /*ref*/ ) != 0 || |
213 | !m_backgroundImageCache.insert( skinPath, backgroundImage ) ) | 213 | !m_backgroundPixmapCache.insert( skinPath, backgroundPixmap ) ) |
214 | delete backgroundImage; | 214 | delete backgroundPixmap; |
215 | } | 215 | } |
216 | 216 | ||
@@ -218,5 +218,5 @@ SkinLoader::IncrementalLoader::IncrementalLoader( const Info &info ) | |||
218 | : m_skin( info.skinName, info.fileNameInfix ), m_info( info ) | 218 | : m_skin( info.skinName, info.fileNameInfix ), m_info( info ) |
219 | { | 219 | { |
220 | m_currentState = LoadBackgroundImage; | 220 | m_currentState = LoadBackgroundPixmap; |
221 | } | 221 | } |
222 | 222 | ||
@@ -224,7 +224,7 @@ SkinLoader::IncrementalLoader::LoaderResult SkinLoader::IncrementalLoader::loadS | |||
224 | { | 224 | { |
225 | switch ( m_currentState ) { | 225 | switch ( m_currentState ) { |
226 | case LoadBackgroundImage: | 226 | case LoadBackgroundPixmap: |
227 | qDebug( "load bgimage" ); | 227 | qDebug( "load bgpixmap" ); |
228 | m_skin.backgroundImage(); | 228 | m_skin.backgroundPixmap(); |
229 | m_currentState = LoadButtonUpImage; | 229 | m_currentState = LoadButtonUpImage; |
230 | break; | 230 | break; |
diff --git a/noncore/multimedia/opieplayer2/skin.h b/noncore/multimedia/opieplayer2/skin.h index a43a1d0..90062c2 100644 --- a/noncore/multimedia/opieplayer2/skin.h +++ b/noncore/multimedia/opieplayer2/skin.h | |||
@@ -41,5 +41,5 @@ public: | |||
41 | void preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ); | 41 | void preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ); |
42 | 42 | ||
43 | QImage backgroundImage() const; | 43 | QPixmap backgroundPixmap() const; |
44 | QImage buttonUpImage() const; | 44 | QImage buttonUpImage() const; |
45 | QImage buttonDownImage() const; | 45 | QImage buttonDownImage() const; |
@@ -107,5 +107,5 @@ private: | |||
107 | 107 | ||
108 | private: | 108 | private: |
109 | enum State { LoadBackgroundImage, LoadButtonUpImage, LoadButtonDownImage, LoadButtonMasks, LoadButtonMask }; | 109 | enum State { LoadBackgroundPixmap, LoadButtonUpImage, LoadButtonDownImage, LoadButtonMasks, LoadButtonMask }; |
110 | 110 | ||
111 | Skin m_skin; | 111 | Skin m_skin; |