From 14e7c8bf3982d05f6fc5c744ebbad791db6ab191 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 24 Jan 2011 13:06:29 +0100 Subject: Fix loop count in animanted gifs sometimes being incorrect Applied patch supplied in QT-4426, which also completes https://bugs.webkit.org/show_bug.cgi?id=36818 Task-number: QT-4426 Reviewed-by: Kim Motoyoshi Kalland --- src/gui/image/qgifhandler.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qgifhandler.cpp b/src/gui/image/qgifhandler.cpp index 4dd4743..7cb7373 100644 --- a/src/gui/image/qgifhandler.cpp +++ b/src/gui/image/qgifhandler.cpp @@ -1046,7 +1046,7 @@ QGifHandler::QGifHandler() { gifFormat = new QGIFFormat; nextDelay = 100; - loopCnt = 1; + loopCnt = -1; frameNumber = -1; scanIsCached = false; } @@ -1192,7 +1192,13 @@ int QGifHandler::loopCount() const QGIFFormat::scan(device(), &imageSizes, &loopCnt); scanIsCached = true; } - return loopCnt-1; // In GIF, loop count is iteration count, so subtract one + + if (loopCnt == 0) + return -1; + else if (loopCnt == -1) + return 0; + else + return loopCnt; } int QGifHandler::currentImageNumber() const -- cgit v0.12