Fix scaling of context view background when size of view changes.

This commit is contained in:
craig.p.drummond
2014-02-26 20:08:19 +00:00
committed by craig.p.drummond
parent 22d5977188
commit cd4f653e32
3 changed files with 11 additions and 3 deletions

View File

@@ -27,6 +27,7 @@
6. If a sidebar view has focus, but sidebar is collapsed, then find action
should activate playqueue search widget.
7. FreeBSD 1.0 compile fixes.
8. Fix scaling of context view background when size of view changes.
1.3.0.1
-------

View File

@@ -730,7 +730,11 @@ void ContextWidget::updateImage(QImage img, bool created)
painter.end();
img = blurred;
}
#ifdef SCALE_CONTEXT_BGND
currentImage=img;
#else
currentBackdrop=QPixmap::fromImage(img);
#endif
}
albumCoverBackdrop=created;
resizeBackdrop();
@@ -1209,9 +1213,9 @@ void ContextWidget::createBackdrop()
void ContextWidget::resizeBackdrop()
{
#ifdef SCALE_CONTEXT_BGND
if (!currentBackdrop.isNull() && !albumCoverBackdrop && currentBackdrop.width()!=width()) {
QSize sz(width(), width()*currentBackdrop.height()/currentBackdrop.width());
currentBackdrop=currentBackdrop.scaled(sz, Qt::KeepAspectRatio, Qt::SmoothTransformation);
if (!albumCoverBackdrop && !currentImage.isNull() &&( currentBackdrop.isNull() || (!currentBackdrop.isNull() && currentBackdrop.width()!=width()))) {
QSize sz(width(), width()*currentImage.height()/currentImage.width());
currentBackdrop = QPixmap::fromImage(currentImage.scaled(sz, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation));
}
#else
if (!currentBackdrop.isNull() && !albumCoverBackdrop) {

View File

@@ -148,6 +148,9 @@ private:
bool useFanArt;
bool albumCoverBackdrop;
Song currentSong;
#ifdef SCALE_CONTEXT_BGND
QImage currentImage;
#endif
QPixmap oldBackdrop;
QPixmap currentBackdrop;
QString currentArtist;