qt6-bb10/tests/auto/gui/image
Shawn Rutledge 7c313f1865 QMovie non-anim: use QImageReader::imageCount but not nextImageDelay
Since 3f4d6279c4b0d04422efff478a5e2fb36259dbaa (khansen 2005) QMovie
calls QImageReader::read() until QImageReader::canRead() returns false.
That's apparently to support animated image formats in which the
frame count is not known at the beginnning (i.e. not specified in
the image format's metadata). But non-animated multi-frame formats
are expected to return valid values from QImageReader::imageCount();
and those also tend to keep returning true from canRead() regardless
of how many frames have been read (the interpretation of canRead()
is "does the file have the expected format?" rather than "are we
about to read too many frames?"). So, when a multi-frame image is abused
as an animation, QMovie was able to keep reading the same frame
repeatedly and pretend that the frame sequence goes on forever.
It also tended to read frames as fast as they could be decoded,
because nextImageDelay() is not usually provided, because multi-frame
image formats don't specify a frame rate in their metadata.

So now we change QMovie's behavior for image formats where
QImageIOHandler::supportsOption(Animation) returns false:
trust imageCount(), but not do not trust nextImageDelay().

But to actually jump to the next frame in this case, we also need to
call QImageReader::jumpToNextImage().

Altogether, this makes QMovie support "flipbook" animation for
multi-frame image formats, such as tiff and pdf.

Added "read frame x of c" logging in qt.gui.imageio category.

For testing, we use a pre-existing multi-frame Obj_N2_Internal_Mem.ico
file, to avoid depending on the tiff plugin.

[ChangeLog][QtGui][QMovie] QMovie now handles non-animated multi-frame
image formats (such as tiff): QImageIOHandler::imageCount() is observed,
and the default frame rate is 1 FPS.

Pick-to: 6.5 6.6 6.7
Fixes: QTBUG-117429
Change-Id: I6dad2a684e12c78a68288402e223a59427bf649e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-02-02 09:57:00 -07:00
..
qicoimageformat Fix transparency in 16 bit and 24 bit ico files 2023-07-11 18:35:41 +00:00
qicon QIcon: add theme icon constants 2023-12-07 12:39:06 +01:00
qiconhighdpi QIcon: prefer downscaling over upscaling pixmap icons 2023-12-13 15:10:51 +01:00
qimage Copy color table in QImage::transform paint path 2023-12-14 23:35:14 +01:00
qimageiohandler CMake: Make gui tests standalone projects 2023-07-05 15:09:32 +02:00
qimagereader QPpmHandler: fix reading ppm files 2023-11-27 19:53:41 +01:00
qimagewriter CMake: Make gui tests standalone projects 2023-07-05 15:09:32 +02:00
qmovie QMovie non-anim: use QImageReader::imageCount but not nextImageDelay 2024-02-02 09:57:00 -07:00
qpicture CMake: Make gui tests standalone projects 2023-07-05 15:09:32 +02:00
qpixmap CMake: Make gui tests standalone projects 2023-07-05 15:09:32 +02:00
qpixmapcache CMake: Make gui tests standalone projects 2023-07-05 15:09:32 +02:00
CMakeLists.txt tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00