summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-09 15:01:12 (UTC)
committer simon <simon>2002-12-09 15:01:12 (UTC)
commitd3451a94e3a4425f9f1b1dcc3999259270780631 (patch) (side-by-side diff)
tree6d0613d5ce951e08a8af539b28a689c96b0955c8
parent9ab8a657b23fd1871c4a376fdd097732c14392e0 (diff)
downloadopie-d3451a94e3a4425f9f1b1dcc3999259270780631.zip
opie-d3451a94e3a4425f9f1b1dcc3999259270780631.tar.gz
opie-d3451a94e3a4425f9f1b1dcc3999259270780631.tar.bz2
- get rid of the masks array and re-use the Button structure
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp22
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h2
2 files changed, 10 insertions, 14 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 7d85d63..089ef6a 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -97,17 +97,19 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
buttonMask.fill( 0 );
for ( int i = 0; i < 7; i++ ) {
+ Button &button = buttons[ i ];
+
QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" );
- masks[i] = new QBitmap( filename );
+ button.mask = QBitmap( filename );
- if ( !masks[i]->isNull() ) {
- QImage imgMask = masks[i]->convertToImage();
+ if ( !button.mask.isNull() ) {
+ QImage imgMask = button.mask.convertToImage();
uchar **dest = buttonMask.jumpTable();
for ( int y = 0; y < imgUp.height(); y++ ) {
uchar *line = dest[y];
for ( int x = 0; x < imgUp.width(); x++ ) {
if ( !qRed( imgMask.pixel( x, y ) ) )
line[x] = i + 1;
@@ -136,22 +138,16 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
setFullscreen( mediaPlayerState.isFullscreen() );
setPlaying( mediaPlayerState.isPlaying() );
}
VideoWidget::~VideoWidget() {
-
for ( int i = 0; i < 7; i++ ) {
delete buttonPixUp[i];
delete buttonPixDown[i];
}
-
- for ( int i = 0; i < 7; i++ ) {
- delete masks[i];
- }
-
}
QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
QPixmap pix( img.width(), img.height() );
QPainter p( &pix );
p.drawTiledPixmap( pix.rect(), bg, offset );
@@ -185,17 +181,19 @@ void VideoWidget::resizeEvent( QResizeEvent * ) {
QPoint p = upperLeftOfButtonMask;
QPixmap *pixUp = combineVImageWithBackground( imgUp, pixBg, p );
QPixmap *pixDn = combineVImageWithBackground( imgDn, pixBg, p );
for ( int i = 0; i < 7; i++ ) {
- if ( !masks[i]->isNull() ) {
+ Button &button = buttons[ i ];
+
+ if ( !button.mask.isNull() ) {
delete buttonPixUp[i];
delete buttonPixDown[i];
- buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] );
- buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] );
+ buttonPixUp[i] = maskVPixToMask( *pixUp, button.mask );
+ buttonPixDown[i] = maskVPixToMask( *pixDn, button.mask );
}
}
delete pixUp;
delete pixDn;
}
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index cb6171c..fd301f9 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -97,17 +97,15 @@ protected:
private:
// Ticker songInfo;
QPixmap pixBg;
QImage imgUp;
QImage imgDn;
- QBitmap *masks[7];
QPixmap *buttonPixUp[7];
QPixmap *buttonPixDown[7];
QString skin;
-// QPixmap *pixmaps[4];
virtual void paintButton( QPainter &p, int i );
void setToggleButton( int, bool );
QString backgroundPix;