1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:47:44 +00:00

LibGfx/JPEGXL: Remove the BitmapDecoded state

There was a confusion between both `BitmapDecoded` and `FrameDecoded`
states. Removing one of them, solves the issue.
This patch removes the crash caused by requesting the same frame twice.
This commit is contained in:
Lucas CHOLLET 2023-07-22 16:13:22 -04:00 committed by Andreas Kling
parent 33ca35f1c7
commit 697803efcc

View file

@ -1715,7 +1715,6 @@ public:
Error,
HeaderDecoded,
FrameDecoded,
BitmapDecoded
};
State state() const
@ -1803,7 +1802,7 @@ ErrorOr<ImageFrameDescriptor> JPEGXLImageDecoderPlugin::frame(size_t index, Opti
if (m_context->state() == JPEGXLLoadingContext::State::Error)
return Error::from_string_literal("JPEGXLImageDecoderPlugin: Decoding failed");
if (m_context->state() < JPEGXLLoadingContext::State::BitmapDecoded)
if (m_context->state() < JPEGXLLoadingContext::State::FrameDecoded)
TRY(m_context->decode());
return ImageFrameDescriptor { m_context->bitmap(), 0 };