mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +00:00
LibGfx: Add a sniff method to ImageDecoder and implement for GIF and PNG
The sniff method is intended to be used for content sniffing. It should be a cheap test to rapidly rule out whether a candidate image can be successfully decoded. For the GIF and PNG implementations it simply attempts to decode the image header, returning true if successful and false if not.
This commit is contained in:
parent
df0d6e241c
commit
2cd9716b38
5 changed files with 16 additions and 0 deletions
|
@ -725,4 +725,9 @@ bool PNGImageDecoderPlugin::set_nonvolatile()
|
|||
return m_context->bitmap->set_nonvolatile();
|
||||
}
|
||||
|
||||
bool PNGImageDecoderPlugin::sniff()
|
||||
{
|
||||
return decode_png_header(*m_context);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue