From cc854adb51ab14ad65b645bb91c71780fe940c91 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sat, 15 Sep 2018 18:38:30 +0200 Subject: [PATCH] Too big sprites now get scaled down smoothly, while too small ones keep their sharpness as they're expanded. --- aocharmovie.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aocharmovie.cpp b/aocharmovie.cpp index b591c22..56912a4 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)