1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:47:44 +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 {};
}
ErrorOr<void> TGAImageDecoderPlugin::initialize()
{
return decode_tga_header();
}
ErrorOr<bool> TGAImageDecoderPlugin::validate_before_create(ReadonlyBytes data)
{
if (data.size() < sizeof(TGAHeader))
@ -225,7 +220,9 @@ ErrorOr<bool> TGAImageDecoderPlugin::validate_before_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()