Set emote format to apng if png supports animation (#379)

This commit is contained in:
Skye Deving 2021-01-07 16:21:56 -06:00 committed by GitHub
parent d308fc83de
commit e2c447f1d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,6 +61,15 @@ void AOCharMovie::load_image(QString p_char, QString p_emote,
return; return;
m_reader->setFileName(emote_path); m_reader->setFileName(emote_path);
// set format to apng if png supports animation
if (emote_path.endsWith("png")) {
m_reader->setFormat("apng");
if (!m_reader->supportsAnimation()) {
m_reader->setFormat("png");
}
}
QPixmap f_pixmap = this->get_pixmap(m_reader->read()); QPixmap f_pixmap = this->get_pixmap(m_reader->read());
int f_delay = m_reader->nextImageDelay(); int f_delay = m_reader->nextImageDelay();