mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-06-03 17:08:08 -04:00
avif: indicate when all frames have been read
This commit is contained in:
parent
1190e53e9b
commit
bfb12093ad
@ -43,7 +43,7 @@ bool QAVIFHandler::canRead() const
|
|||||||
if (m_parseState != ParseAvifError) {
|
if (m_parseState != ParseAvifError) {
|
||||||
setFormat("avif");
|
setFormat("avif");
|
||||||
|
|
||||||
if (m_parseState == ParseAvifSuccess && m_decoder->imageIndex >= m_decoder->imageCount - 1) {
|
if (m_parseState == ParseAvifFinished) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ bool QAVIFHandler::canRead(QIODevice *device)
|
|||||||
|
|
||||||
bool QAVIFHandler::ensureParsed() const
|
bool QAVIFHandler::ensureParsed() const
|
||||||
{
|
{
|
||||||
if (m_parseState == ParseAvifSuccess || m_parseState == ParseAvifMetadata) {
|
if (m_parseState == ParseAvifSuccess || m_parseState == ParseAvifMetadata || m_parseState == ParseAvifFinished) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (m_parseState == ParseAvifError) {
|
if (m_parseState == ParseAvifError) {
|
||||||
@ -88,7 +88,7 @@ bool QAVIFHandler::ensureParsed() const
|
|||||||
|
|
||||||
bool QAVIFHandler::ensureOpened() const
|
bool QAVIFHandler::ensureOpened() const
|
||||||
{
|
{
|
||||||
if (m_parseState == ParseAvifSuccess) {
|
if (m_parseState == ParseAvifSuccess || m_parseState == ParseAvifFinished) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (m_parseState == ParseAvifError) {
|
if (m_parseState == ParseAvifError) {
|
||||||
@ -459,6 +459,13 @@ bool QAVIFHandler::read(QImage *image)
|
|||||||
*image = m_current_image;
|
*image = m_current_image;
|
||||||
if (imageCount() >= 2) {
|
if (imageCount() >= 2) {
|
||||||
m_must_jump_to_next_image = true;
|
m_must_jump_to_next_image = true;
|
||||||
|
if (m_decoder->imageIndex >= m_decoder->imageCount - 1) {
|
||||||
|
// all frames in animation have been read
|
||||||
|
m_parseState = ParseAvifFinished;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// the static image has been read
|
||||||
|
m_parseState = ParseAvifFinished;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,7 @@ private:
|
|||||||
ParseAvifNotParsed = 0,
|
ParseAvifNotParsed = 0,
|
||||||
ParseAvifSuccess = 1,
|
ParseAvifSuccess = 1,
|
||||||
ParseAvifMetadata = 2,
|
ParseAvifMetadata = 2,
|
||||||
|
ParseAvifFinished = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
ParseAvifState m_parseState;
|
ParseAvifState m_parseState;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user