MxcImageProvider: Only use scaledToHeight if width <= 0.
This commit is contained in:
parent
7086e23bdd
commit
5ac1195402
@ -124,8 +124,11 @@ MxcImageProvider::download(const QString &id,
|
|||||||
if (fileInfo.exists()) {
|
if (fileInfo.exists()) {
|
||||||
QImage image = utils::readImageFromFile(fileInfo.absoluteFilePath());
|
QImage image = utils::readImageFromFile(fileInfo.absoluteFilePath());
|
||||||
if (!image.isNull()) {
|
if (!image.isNull()) {
|
||||||
if (requestedSize != image.size()) {
|
if (requestedSize.width() <= 0) {
|
||||||
image = image.scaledToHeight(requestedSize.height(), Qt::SmoothTransformation);
|
image = image.scaledToHeight(requestedSize.height(), Qt::SmoothTransformation);
|
||||||
|
} else {
|
||||||
|
image =
|
||||||
|
image.scaled(requestedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (radius != 0) {
|
if (radius != 0) {
|
||||||
@ -157,9 +160,12 @@ MxcImageProvider::download(const QString &id,
|
|||||||
auto data = QByteArray(res.data(), (int)res.size());
|
auto data = QByteArray(res.data(), (int)res.size());
|
||||||
QImage image = utils::readImage(data);
|
QImage image = utils::readImage(data);
|
||||||
if (!image.isNull()) {
|
if (!image.isNull()) {
|
||||||
if (requestedSize != image.size()) {
|
if (requestedSize.width() <= 0) {
|
||||||
image =
|
image =
|
||||||
image.scaledToHeight(requestedSize.height(), Qt::SmoothTransformation);
|
image.scaledToHeight(requestedSize.height(), Qt::SmoothTransformation);
|
||||||
|
} else {
|
||||||
|
image =
|
||||||
|
image.scaled(requestedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (radius != 0) {
|
if (radius != 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user