aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCerapter <cerap@protonmail.com>2018-09-15 18:38:30 +0200
committerCerapter <cerap@protonmail.com>2018-09-15 18:38:30 +0200
commitcc854adb51ab14ad65b645bb91c71780fe940c91 (patch)
tree39509c1f066c39a22eb1816fb6e5855a8d58307b
parentf3e9d691afbf70ec992fe4726865c9b9e83fac1b (diff)
Too big sprites now get scaled down smoothly, while too small ones keep their sharpness as they're expanded.
-rw-r--r--aocharmovie.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/aocharmovie.cpp b/aocharmovie.cpp
index b591c224..56912a47 100644
--- a/aocharmovie.cpp
+++ b/aocharmovie.cpp
@@ -152,7 +152,10 @@ void AOCharMovie::frame_change(int n_frame)
{
QPixmap f_pixmap = QPixmap::fromImage(movie_frames.at(n_frame));
- this->setPixmap(f_pixmap.scaled(this->width(), this->height()));
+ if (f_pixmap.size().width() > this->size().width() || f_pixmap.size().height() > this->size().height())
+ this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation));
+ else
+ this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::KeepAspectRatioByExpanding, Qt::FastTransformation));
}
if (m_movie->frameCount() - 1 == n_frame && play_once)