summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/imageformats/mng/qmnghandler.cpp8
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;