1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 00:17:46 +00:00

LibGfx/QOI: Remove useless parameters from member functions

Both `decode_[header,image]_and_update_context()` used to take a
`Stream&` as parameter, but they are always called with the field
`m_context.stream` so no need to take it as a parameter.
This commit is contained in:
Lucas CHOLLET 2023-07-13 23:16:05 -04:00 committed by Andreas Kling
parent 1ae772c7d3
commit 5fd1ee0365
2 changed files with 11 additions and 11 deletions

View file

@ -173,7 +173,7 @@ IntSize QOIImageDecoderPlugin::size()
if (m_context->state < QOILoadingContext::State::HeaderDecoded) {
// FIXME: This is a weird API (inherited from ImageDecoderPlugin), should probably propagate errors by returning ErrorOr<IntSize>.
// For the time being, ignore the result and rely on the context's state.
(void)decode_header_and_update_context(*m_context->stream);
(void)decode_header_and_update_context();
}
if (m_context->state == QOILoadingContext::State::Error)
@ -184,7 +184,7 @@ IntSize QOIImageDecoderPlugin::size()
ErrorOr<void> QOIImageDecoderPlugin::initialize()
{
return decode_header_and_update_context(*m_context->stream);
return decode_header_and_update_context();
}
bool QOIImageDecoderPlugin::sniff(ReadonlyBytes data)
@ -208,10 +208,10 @@ ErrorOr<ImageFrameDescriptor> QOIImageDecoderPlugin::frame(size_t index, Optiona
VERIFY(m_context->state != QOILoadingContext::State::Error);
if (m_context->state == QOILoadingContext::State::NotDecoded) {
TRY(decode_header_and_update_context(*m_context->stream));
TRY(decode_image_and_update_context(*m_context->stream));
TRY(decode_header_and_update_context());
TRY(decode_image_and_update_context());
} else if (m_context->state == QOILoadingContext::State::HeaderDecoded) {
TRY(decode_image_and_update_context(*m_context->stream));
TRY(decode_image_and_update_context());
}
VERIFY(m_context->state == QOILoadingContext::State::ImageDecoded);
@ -219,10 +219,10 @@ ErrorOr<ImageFrameDescriptor> QOIImageDecoderPlugin::frame(size_t index, Optiona
return ImageFrameDescriptor { m_context->bitmap, 0 };
}
ErrorOr<void> QOIImageDecoderPlugin::decode_header_and_update_context(Stream& stream)
ErrorOr<void> QOIImageDecoderPlugin::decode_header_and_update_context()
{
VERIFY(m_context->state < QOILoadingContext::State::HeaderDecoded);
auto error_or_header = decode_qoi_header(stream);
auto error_or_header = decode_qoi_header(*m_context->stream);
if (error_or_header.is_error()) {
m_context->state = QOILoadingContext::State::Error;
return error_or_header.release_error();
@ -232,10 +232,10 @@ ErrorOr<void> QOIImageDecoderPlugin::decode_header_and_update_context(Stream& st
return {};
}
ErrorOr<void> QOIImageDecoderPlugin::decode_image_and_update_context(Stream& stream)
ErrorOr<void> QOIImageDecoderPlugin::decode_image_and_update_context()
{
VERIFY(m_context->state < QOILoadingContext::State::ImageDecoded);
auto error_or_bitmap = decode_qoi_image(stream, m_context->header.width, m_context->header.height);
auto error_or_bitmap = decode_qoi_image(*m_context->stream, m_context->header.width, m_context->header.height);
if (error_or_bitmap.is_error()) {
m_context->state = QOILoadingContext::State::Error;
return error_or_bitmap.release_error();