diff options
author | Davy Durham <ddurham@users.sourceforge.net> | 2013-01-01 23:21:37 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-22 08:59:28 (GMT) |
commit | 263d733ac70403c488d67b1aab120167f156c3f4 (patch) | |
tree | b23793fd766ef41225006bd6c48481960b4cdbae | |
parent | 6d2d4b779a83be4379fc58b2eea45c15f72bf552 (diff) | |
download | Qt-263d733ac70403c488d67b1aab120167f156c3f4.zip Qt-263d733ac70403c488d67b1aab120167f156c3f4.tar.gz Qt-263d733ac70403c488d67b1aab120167f156c3f4.tar.bz2 |
Fix glitch on MNG animation Loops when QMovie caching is enabled
libmng delivers the last animation frame with a 1ms delay, and delivers
an extra blank frame after that with the proper delay time, but this
confuses QMovie when QMovie::cacheMode() == QMovie::CacheAll.
This was commited as 313d60c107d9659efd5e93ba5a036054f6b1ebba in qt5
Task-Number: QTBUG-28894
Change-Id: I1dd585cd6f0ced8c777bd1f15ac2c9f36ca63f41
Reviewed-by: aavit <eirik.aavitsland@digia.com>
-rw-r--r-- | src/gui/image/qmnghandler.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/image/qmnghandler.cpp b/src/gui/image/qmnghandler.cpp index bc20c43..89bd2e5 100644 --- a/src/gui/image/qmnghandler.cpp +++ b/src/gui/image/qmnghandler.cpp @@ -263,6 +263,7 @@ mng_bool QMngHandlerPrivate::processHeader(mng_uint32 iWidth, mng_uint32 iHeight bool QMngHandlerPrivate::getNextImage(QImage *result) { mng_retcode ret; + const bool savedHaveReadAll = haveReadAll; if (haveReadNone) { haveReadNone = false; ret = mng_readdisplay(hMNG); @@ -271,6 +272,13 @@ bool QMngHandlerPrivate::getNextImage(QImage *result) } if ((MNG_NOERROR == ret) || (MNG_NEEDTIMERWAIT == ret)) { *result = image; + + // QTBUG-28894 -- libmng produces an extra frame at the end + // of the animation on the first loop only. + if (nextDelay == 1 && (!savedHaveReadAll && haveReadAll)) { + ret = mng_display_resume(hMNG); + } + frameIndex = nextIndex++; if (haveReadAll && (frameCount == 0)) frameCount = nextIndex; |