Skip to content
Snippets Groups Projects
Unverified Commit a0526044 authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Fix scaling of animated images in fullscreen image viewer

parent cbe2d784
No related branches found
No related tags found
No related merge requests found
Pipeline #3104 passed
......@@ -153,8 +153,11 @@ MxcAnimatedImage::geometryChanged(const QRectF &newGeometry, const QRectF &oldGe
QQuickItem::geometryChanged(newGeometry, oldGeometry);
if (newGeometry.size() != oldGeometry.size()) {
if (height() != 0 && width() != 0)
movie.setScaledSize(newGeometry.size().toSize());
if (height() != 0 && width() != 0) {
QSizeF r = movie.scaledSize();
r.scale(newGeometry.size(), Qt::KeepAspectRatio);
movie.setScaledSize(r.toSize());
}
}
}
......@@ -184,7 +187,10 @@ MxcAnimatedImage::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeD
return nullptr;
}
n->setRect(0, 0, width(), height());
QSizeF r = img.size();
r.scale(size(), Qt::KeepAspectRatio);
n->setRect((width() - r.width()) / 2, (height() - r.height()) / 2, r.width(), r.height());
n->setFiltering(QSGTexture::Linear);
n->setMipmapFiltering(QSGTexture::None);
......
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