diff --git a/gwenview/lib/document/animateddocumentloadedimpl.cpp b/gwenview/lib/document/animateddocumentloadedimpl.cpp index e0c30c41..db950b4b 100644 --- a/gwenview/lib/document/animateddocumentloadedimpl.cpp +++ b/gwenview/lib/document/animateddocumentloadedimpl.cpp @@ -96,12 +96,6 @@ bool AnimatedDocumentLoadedImpl::isAnimated() const void AnimatedDocumentLoadedImpl::startAnimation() { d->mMovie.start(); - if (d->mMovie.state() == QMovie::NotRunning) { - // This is true with qt-copy as of 2008.08.23 - kDebug() << "QMovie didn't start. This can happen in some cases when starting for the second time."; - kDebug() << "Trying to start again, it usually fixes the bug."; - d->mMovie.start(); - } } void AnimatedDocumentLoadedImpl::stopAnimation() diff --git a/gwenview/lib/document/loadingdocumentimpl.cpp b/gwenview/lib/document/loadingdocumentimpl.cpp index ebb9d170..7b0f32ef 100644 --- a/gwenview/lib/document/loadingdocumentimpl.cpp +++ b/gwenview/lib/document/loadingdocumentimpl.cpp @@ -208,40 +208,19 @@ struct LoadingDocumentImplPrivate } } - bool ok = reader.read(&mImage); - if (!ok) { - kDebug() << "QImageReader::read() failed"; - return; - } - - if (reader.supportsAnimation() - && reader.nextImageDelay() > 0 // Assume delay == 0 <=> only one frame - ) { + if (reader.supportsAnimation() && reader.jumpToImage(0)) { if (reader.imageCount() > 0) { kDebug() << "Really an animated image"; mAnimated = true; - return; - } - /* - * QImageReader is not really helpful to detect animated images: - * - QImageReader::imageCount() returns 0 - * - QImageReader::nextImageDelay() may return something > 0 if the - * image consists of only one frame but includes a "Graphic - * Control Extension" (usually only present if we have an - * animation) (Bug #185523) - * - * Decoding the next frame is the only reliable way I found to - * detect an animated images - */ - kDebug() << "May be an animated image. delay:" << reader.nextImageDelay(); - QImage nextImage; - if (reader.read(&nextImage)) { - kDebug() << "Really an animated image (more than one frame)"; - mAnimated = true; } else { kWarning() << q->document()->url() << "is not really an animated image (only one frame)"; } } + + bool ok = reader.read(&mImage); + if (!ok) { + kWarning() << "QImageReader::read() failed"; + } } };