summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <[email protected]>2015-07-27 12:49:21 +0200
committerAlbert Astals Cid <[email protected]>2015-07-27 12:49:21 +0200
commit3c2a53872b3d773de10da6be43dcc3c9fed0a368 (patch)
tree82932a00ad7dd9ebf41cd97275d6b452696e7438
parent53eef68b3e35986dbfc974037d4a8a2fbb10db23 (diff)
Save some pixmap->image conversions
-rw-r--r--src/config/playerselectoritem.cpp12
-rw-r--r--src/config/playerselectoritem.h2
2 files changed, 7 insertions, 7 deletions
diff --git a/src/config/playerselectoritem.cpp b/src/config/playerselectoritem.cpp
index 8871701..02d47d4 100644
--- a/src/config/playerselectoritem.cpp
+++ b/src/config/playerselectoritem.cpp
@@ -37,7 +37,7 @@ PlayerSelectorItem::PlayerSelectorItem(const QString& playerId, PlayerSettings*
m_playerName = new QLineEdit(m_playerSettings->playerName(playerId));
m_playerName->setFixedWidth(200);
m_playerPreviewPixmap = new QPixmap(QSize(64, 64));
- m_playerPreviewPixmapAlphaChannel = new QPixmap(QSize(64, 64));
+ m_playerPreviewImageAlphaChannel = new QImage(QSize(64, 64), QImage::Format_ARGB32_Premultiplied);
m_playerPreviewPixmapLabel = new QLabel;
m_playerAuthor = new QLabel;
@@ -129,7 +129,7 @@ PlayerSelectorItem::~PlayerSelectorItem()
delete m_playerName;
delete m_playerPreviewPixmap;
- delete m_playerPreviewPixmapAlphaChannel;;
+ delete m_playerPreviewImageAlphaChannel;
delete m_playerPreviewPixmapLabel;
delete m_playerAuthor;
@@ -152,7 +152,7 @@ void PlayerSelectorItem::setPlayerPreviewPixmap(const QPixmap& pixmap)
m_playerPreviewPixmap = new QPixmap(pixmap);
QImage tempImage = m_playerPreviewPixmap->toImage();
- tempImage.setAlphaChannel(m_playerPreviewPixmapAlphaChannel->toImage());
+ tempImage.setAlphaChannel(*m_playerPreviewImageAlphaChannel);
m_playerPreviewPixmapLabel->setPixmap(QPixmap::fromImage(tempImage));
}
@@ -173,15 +173,15 @@ void PlayerSelectorItem::selectionChanged(bool selectionState)
if(selectionState == true)
{
- m_playerPreviewPixmapAlphaChannel->fill(QColor(255, 255, 255, 255));
+ m_playerPreviewImageAlphaChannel->fill(QColor(255, 255, 255, 255));
}
else
{
- m_playerPreviewPixmapAlphaChannel->fill(QColor(64, 64, 64, 255));
+ m_playerPreviewImageAlphaChannel->fill(QColor(64, 64, 64, 255));
}
QImage tempImage = m_playerPreviewPixmap->toImage();
- tempImage.setAlphaChannel(m_playerPreviewPixmapAlphaChannel->toImage());
+ tempImage.setAlphaChannel(*m_playerPreviewImageAlphaChannel);
m_playerPreviewPixmapLabel->setPixmap(QPixmap::fromImage(tempImage));
m_moveLeft->setEnabled(selectionState);
diff --git a/src/config/playerselectoritem.h b/src/config/playerselectoritem.h
index 117d3f8..806d04c 100644
--- a/src/config/playerselectoritem.h
+++ b/src/config/playerselectoritem.h
@@ -35,7 +35,7 @@ private:
QLineEdit* m_playerName;
QPixmap* m_playerPreviewPixmap;
- QPixmap* m_playerPreviewPixmapAlphaChannel;
+ QImage* m_playerPreviewImageAlphaChannel;
QLabel* m_playerPreviewPixmapLabel;
QLabel* m_playerAuthor;