summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-06-26 15:27:12 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-07-03 12:20:34 +0000
commit144a3535db9f95e60972d3c3b6eaceb65a604577 (patch)
treea80ed2c136fddfc8eb6d7f42a5d2fb85c27b2973
parent85ed63f825da57103c68f73af5adeebf67db0da9 (diff)
WebP: respect the frame dispose method for animations
Task-number: QTBUG-61640 Change-Id: I9d0bfbafe15df338355cf2f5c77c2d4f8f00d27f Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
-rw-r--r--src/plugins/imageformats/webp/qwebphandler.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/imageformats/webp/qwebphandler.cpp b/src/plugins/imageformats/webp/qwebphandler.cpp
index 5a0ae4a..ce90158 100644
--- a/src/plugins/imageformats/webp/qwebphandler.cpp
+++ b/src/plugins/imageformats/webp/qwebphandler.cpp
@@ -122,6 +122,8 @@ bool QWebpHandler::ensureScanned() const
that->m_bgColor = QColor::fromRgba(QRgb(WebPDemuxGetI(m_demuxer, WEBP_FF_BACKGROUND_COLOR)));
that->m_composited = new QImage(that->m_features.width, that->m_features.height, QImage::Format_ARGB32);
+ if (that->m_features.has_alpha)
+ that->m_composited->fill(Qt::transparent);
// We do not reset device position since we have read in all data
m_scanState = ScanSuccess;
@@ -193,6 +195,8 @@ bool QWebpHandler::read(QImage *image)
} else {
// Animation
QPainter painter(m_composited);
+ if (m_features.has_alpha && m_iter.dispose_method == WEBP_MUX_DISPOSE_BACKGROUND)
+ m_composited->fill(Qt::transparent);
painter.drawImage(currentImageRect(), frame);
*image = *m_composited;