aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCrystalwarrior <varsash@gmail.com>2020-03-31 14:24:48 +0300
committerCrystalwarrior <varsash@gmail.com>2020-03-31 14:24:48 +0300
commit7fb19ae7bdfc57fb7123edbe25d109b66173ab06 (patch)
tree42284ca990b7e8f28980b4913cda7df06a259d57 /src
parent4aa1ae62e1561363db07a81dc92861fb00988a4b (diff)
Fix aomovie resizing algorithm for BG's crashing the client because I fucked up, lol
Diffstat (limited to 'src')
-rw-r--r--src/aoscene.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/aoscene.cpp b/src/aoscene.cpp
index 45eadd54..575a27df 100644
--- a/src/aoscene.cpp
+++ b/src/aoscene.cpp
@@ -34,14 +34,16 @@ void AOScene::set_image(QString p_image)
if (m_movie->isValid() && m_movie->frameCount() > 1)
{
- float scale_factor = f_h / m_movie->frameRect().height();
+ m_movie->jumpToNextFrame();
+ float scale_factor = static_cast<float>(f_h) / static_cast<float>(m_movie->frameRect().height());
//preserve aspect ratio
- int n_w = static_cast<int>(static_cast<float>(m_movie->frameRect().width()) * scale_factor);
- int n_h = static_cast<int>(static_cast<float>(m_movie->frameRect().height()) * scale_factor);
+ int n_w = static_cast<int>(m_movie->frameRect().width() * scale_factor);
+ int n_h = static_cast<int>(m_movie->frameRect().height() * scale_factor);
+
m_movie->setScaledSize(QSize(n_w, n_h));
this->resize(m_movie->scaledSize());
this->setMovie(m_movie);
- QLabel::move(x + (f_w - n_w)/2, y + (f_h - n_h)); //Always center horizontally, always put at the bottom vertically
+ QLabel::move(x + (f_w - n_w)/2, y + (f_h - n_h)/2); //Center
m_movie->start();
}
else