diff options
author | Davy Durham <ddurham@users.sourceforge.net> | 2013-01-03 21:48:07 -0600 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-04 08:14:30 +0100 |
commit | 313d60c107d9659efd5e93ba5a036054f6b1ebba (patch) | |
tree | 9f42dbfbf864bf49c60d65c7c2bb16ebb6e5dc62 | |
parent | e86c435f3f9a3ac88b3f3259ded57ef9758697af (diff) |
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.
Task-Number: QTBUG-28894
Change-Id: Ic508c886286d9ec6786482927f321c6d77b68619
Reviewed-by: aavit <eirik.aavitsland@digia.com>
-rw-r--r-- | src/plugins/imageformats/mng/qmnghandler.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/imageformats/mng/qmnghandler.cpp b/src/plugins/imageformats/mng/qmnghandler.cpp index 4a361ab..d99ce43 100644 --- a/src/plugins/imageformats/mng/qmnghandler.cpp +++ b/src/plugins/imageformats/mng/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; |