Skip to content
Snippets Groups Projects
Unverified Commit 5ac11954 authored by tastytea's avatar tastytea
Browse files

MxcImageProvider: Only use scaledToHeight if width <= 0.

parent 7086e23b
No related branches found
No related tags found
No related merge requests found
......@@ -124,8 +124,11 @@ MxcImageProvider::download(const QString &id,
if (fileInfo.exists()) {
QImage image = utils::readImageFromFile(fileInfo.absoluteFilePath());
if (!image.isNull()) {
if (requestedSize != image.size()) {
if (requestedSize.width() <= 0) {
image = image.scaledToHeight(requestedSize.height(), Qt::SmoothTransformation);
} else {
image =
image.scaled(requestedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
}
if (radius != 0) {
......@@ -157,9 +160,12 @@ MxcImageProvider::download(const QString &id,
auto data = QByteArray(res.data(), (int)res.size());
QImage image = utils::readImage(data);
if (!image.isNull()) {
if (requestedSize != image.size()) {
if (requestedSize.width() <= 0) {
image =
image.scaledToHeight(requestedSize.height(), Qt::SmoothTransformation);
} else {
image =
image.scaled(requestedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
}
if (radius != 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment