Don't scale album art when saving it to /tmp. Fixes issue #1096

This commit is contained in:
David Sansome 2010-12-18 19:42:06 +00:00
parent 85d1f16c5e
commit c133a8db7c
3 changed files with 12 additions and 3 deletions

View File

@ -37,6 +37,7 @@ AlbumCoverLoader::AlbumCoverLoader(QObject* parent)
: QObject(parent),
stop_requested_(false),
height_(120),
scale_(true),
padding_(true),
next_id_(0),
network_(new NetworkAccessManager(this))
@ -213,8 +214,13 @@ QImage AlbumCoverLoader::ScaleAndPad(const QImage &image) const {
return image;
// Scale the image down
QImage copy = image.scaled(QSize(height_, height_),
Qt::KeepAspectRatio, Qt::SmoothTransformation);
QImage copy;
if (scale_) {
copy = image.scaled(QSize(height_, height_),
Qt::KeepAspectRatio, Qt::SmoothTransformation);
} else {
copy = image;
}
if (!padding_)
return copy;

View File

@ -40,6 +40,7 @@ class AlbumCoverLoader : public QObject {
static QString ImageCacheDir();
void SetDesiredHeight(int height) { height_ = height; }
void SetScaleOutputImage(bool scale) { scale_ = scale; }
void SetPadOutputImage(bool padding) { padding_ = padding; }
void SetDefaultOutputImage(const QImage& image);
@ -100,6 +101,7 @@ class AlbumCoverLoader : public QObject {
bool stop_requested_;
int height_;
bool scale_;
bool padding_;
QImage default_;

View File

@ -36,7 +36,8 @@ ArtLoader::~ArtLoader() {
}
void ArtLoader::Initialised() {
cover_loader_->Worker()->SetPadOutputImage(true);
cover_loader_->Worker()->SetScaleOutputImage(false);
cover_loader_->Worker()->SetPadOutputImage(false);
cover_loader_->Worker()->SetDefaultOutputImage(QImage(":nocover.png"));
connect(cover_loader_->Worker().get(), SIGNAL(ImageLoaded(quint64,QImage)),
SLOT(TempArtLoaded(quint64,QImage)));