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

LibGfx: Remove ImageDecoderPlugin::initialize()

No plugin is currently overriding the default implementation, which is a
no-op. So we can safely delete it.
This commit is contained in:
Lucas CHOLLET 2023-07-17 13:00:37 -04:00 committed by Sam Atkins
parent 3752facfbc
commit 4291288a31
18 changed files with 17 additions and 91 deletions

View file

@ -212,9 +212,9 @@ Icon FileIconProvider::icon_for_executable(DeprecatedString const& path)
} else {
// FIXME: Use the ImageDecoder service.
if (Gfx::PNGImageDecoderPlugin::sniff({ section->raw_data(), section->size() })) {
auto png_decoder = Gfx::PNGImageDecoderPlugin::create({ section->raw_data(), section->size() }).release_value_but_fixme_should_propagate_errors();
if (!png_decoder->initialize().is_error()) {
auto frame_or_error = png_decoder->frame(0);
auto png_decoder = Gfx::PNGImageDecoderPlugin::create({ section->raw_data(), section->size() });
if (!png_decoder.is_error()) {
auto frame_or_error = png_decoder.value()->frame(0);
if (!frame_or_error.is_error()) {
bitmap = frame_or_error.value().image;
}

View file

@ -149,7 +149,6 @@ ErrorOr<void> ICOImageDecoderPlugin::load_ico_bitmap(ICOLoadingContext& context,
ICOImageDescriptor& desc = context.images[real_index];
if (PNGImageDecoderPlugin::sniff({ context.data + desc.offset, desc.size })) {
auto png_decoder = TRY(PNGImageDecoderPlugin::create({ context.data + desc.offset, desc.size }));
TRY(png_decoder->initialize());
auto decoded_png_frame = TRY(png_decoder->frame(0));
if (!decoded_png_frame.image) {
dbgln_if(ICO_DEBUG, "load_ico_bitmap: failed to load PNG encoded image index: {}", real_index);

View file

@ -49,10 +49,8 @@ static OwnPtr<ImageDecoderPlugin> probe_and_sniff_for_appropriate_plugin(Readonl
if (!sniff_result)
continue;
auto plugin_decoder = plugin.create(bytes);
if (!plugin_decoder.is_error()) {
if (!plugin_decoder.value()->initialize().is_error())
return plugin_decoder.release_value();
}
if (!plugin_decoder.is_error())
return plugin_decoder.release_value();
}
return {};
}
@ -76,10 +74,8 @@ static OwnPtr<ImageDecoderPlugin> probe_and_sniff_for_appropriate_plugin_with_kn
if (!validation_result)
continue;
auto plugin_decoder = plugin.create(bytes);
if (!plugin_decoder.is_error()) {
if (!plugin_decoder.value()->initialize().is_error())
return plugin_decoder.release_value();
}
if (!plugin_decoder.is_error())
return plugin_decoder.release_value();
}
return {};
}

View file

@ -37,8 +37,6 @@ public:
virtual IntSize size() = 0;
virtual ErrorOr<void> initialize() { return {}; }
virtual bool is_animated() = 0;
virtual size_t loop_count() = 0;

View file

@ -272,7 +272,6 @@ PDFErrorOr<ByteBuffer> Filter::decode_dct(ReadonlyBytes bytes)
{
if (Gfx::JPEGImageDecoderPlugin::sniff({ bytes.data(), bytes.size() })) {
auto decoder = Gfx::JPEGImageDecoderPlugin::create({ bytes.data(), bytes.size() }).release_value_but_fixme_should_propagate_errors();
TRY(decoder->initialize());
auto frame = TRY(decoder->frame(0));
return TRY(frame.image->serialize_to_byte_buffer());
}