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

LibGfx/TGA: Decode the header in create() and remove initialize()

This is done as a part of #19893.
This commit is contained in:
Lucas CHOLLET 2023-07-09 01:05:29 -04:00 committed by Jelle Raaijmakers
parent a05516bb3e
commit 92fa1efc76
2 changed files with 3 additions and 7 deletions

View file

@ -205,11 +205,6 @@ ErrorOr<void> TGAImageDecoderPlugin::decode_tga_header()
return {}; return {};
} }
ErrorOr<void> TGAImageDecoderPlugin::initialize()
{
return decode_tga_header();
}
ErrorOr<bool> TGAImageDecoderPlugin::validate_before_create(ReadonlyBytes data) ErrorOr<bool> TGAImageDecoderPlugin::validate_before_create(ReadonlyBytes data)
{ {
if (data.size() < sizeof(TGAHeader)) if (data.size() < sizeof(TGAHeader))
@ -225,7 +220,9 @@ ErrorOr<bool> TGAImageDecoderPlugin::validate_before_create(ReadonlyBytes data)
ErrorOr<NonnullOwnPtr<ImageDecoderPlugin>> TGAImageDecoderPlugin::create(ReadonlyBytes data) ErrorOr<NonnullOwnPtr<ImageDecoderPlugin>> TGAImageDecoderPlugin::create(ReadonlyBytes data)
{ {
return adopt_nonnull_own_or_enomem(new (nothrow) TGAImageDecoderPlugin(data.data(), data.size())); auto plugin = TRY(adopt_nonnull_own_or_enomem(new (nothrow) TGAImageDecoderPlugin(data.data(), data.size())));
TRY(plugin->decode_tga_header());
return plugin;
} }
bool TGAImageDecoderPlugin::is_animated() bool TGAImageDecoderPlugin::is_animated()

View file

@ -22,7 +22,6 @@ public:
virtual IntSize size() override; virtual IntSize size() override;
virtual ErrorOr<void> initialize() override;
virtual bool is_animated() override; virtual bool is_animated() override;
virtual size_t loop_count() override; virtual size_t loop_count() override;
virtual size_t frame_count() override; virtual size_t frame_count() override;