mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
LibGfx: Return true from PortableImageDecoderPlugin::initialize()
Reading the two magic bytes are always done in `decode()` by calling `read_magic_number()`. So no need to read it twice.
This commit is contained in:
parent
4554d10fe5
commit
24087ef6eb
1 changed files with 1 additions and 17 deletions
|
@ -59,7 +59,7 @@ public:
|
|||
virtual void set_volatile() override;
|
||||
[[nodiscard]] virtual bool set_nonvolatile(bool& was_purged) override;
|
||||
|
||||
virtual bool initialize() override;
|
||||
virtual bool initialize() override { return true; }
|
||||
virtual bool is_animated() override;
|
||||
virtual size_t loop_count() override;
|
||||
virtual size_t frame_count() override;
|
||||
|
@ -111,22 +111,6 @@ bool PortableImageDecoderPlugin<TContext>::set_nonvolatile(bool& was_purged)
|
|||
return m_context->bitmap->set_nonvolatile(was_purged);
|
||||
}
|
||||
|
||||
template<typename TContext>
|
||||
bool PortableImageDecoderPlugin<TContext>::initialize()
|
||||
{
|
||||
using Context = TContext;
|
||||
if (m_context->data_size < 2)
|
||||
return false;
|
||||
|
||||
if (m_context->data[0] == 'P' && m_context->data[1] == Context::FormatDetails::ascii_magic_number)
|
||||
return true;
|
||||
|
||||
if (m_context->data[0] == 'P' && m_context->data[1] == Context::FormatDetails::binary_magic_number)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename TContext>
|
||||
ErrorOr<NonnullOwnPtr<ImageDecoderPlugin>> PortableImageDecoderPlugin<TContext>::create(ReadonlyBytes data)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue