diff options
| author | Crystalwarrior <varsash@gmail.com> | 2020-03-31 14:24:48 +0300 |
|---|---|---|
| committer | Crystalwarrior <varsash@gmail.com> | 2020-03-31 14:24:48 +0300 |
| commit | 7fb19ae7bdfc57fb7123edbe25d109b66173ab06 (patch) | |
| tree | 42284ca990b7e8f28980b4913cda7df06a259d57 /src/aoscene.cpp | |
| parent | 4aa1ae62e1561363db07a81dc92861fb00988a4b (diff) | |
Fix aomovie resizing algorithm for BG's crashing the client because I fucked up, lol
Diffstat (limited to 'src/aoscene.cpp')
| -rw-r--r-- | src/aoscene.cpp | 10 |
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 |
