Commit 85c3e04a authored by Matthieu Gallien's avatar Matthieu Gallien 🎵
Browse files

fix image provider to scale images to requested size with good quality

BUG: 424276
parent f07a85bf
......@@ -18,6 +18,14 @@ public:
: QQuickImageResponse(), mId(std::move(id)), mRequestedSize(requestedSize)
{
setAutoDelete(false);
if (!mRequestedSize.width()) {
mRequestedSize.setWidth(mRequestedSize.height());
}
if (!mRequestedSize.height()) {
mRequestedSize.setHeight(mRequestedSize.width());
}
}
QQuickTextureFactory *textureFactory() const override
......@@ -33,6 +41,10 @@ public:
if (imageData.contains(KFileMetaData::EmbeddedImageData::FrontCover)) {
mCoverImage = QImage::fromData(imageData[KFileMetaData::EmbeddedImageData::FrontCover]);
auto newCoverImage = mCoverImage.scaled(mRequestedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
if (!newCoverImage.isNull()) {
mCoverImage = std::move(newCoverImage);
}
}
emit finished();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment