1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:28:11 +00:00

LibGfx+ImageViewer: Replace ImageDecoder::is_vector() with an enum

That makes it easier to extend to other special frame formats.
This commit is contained in:
Nico Weber 2024-01-07 20:41:32 -05:00 committed by Andreas Kling
parent a47edb4ed1
commit c997ee7b9d
3 changed files with 11 additions and 4 deletions

View file

@ -224,7 +224,7 @@ ErrorOr<void> ViewWidget::try_open_file(String const& path, Core::File& file)
Vector<Animation::Frame> frames;
// Note: Doing this check only requires reading the header of images
// (so if the image is not vector graphics it can be still be decoded OOP).
if (auto decoder = Gfx::ImageDecoder::try_create_for_raw_bytes(file_data); decoder && decoder->is_vector()) {
if (auto decoder = Gfx::ImageDecoder::try_create_for_raw_bytes(file_data); decoder && decoder->natural_frame_format() == Gfx::NaturalFrameFormat::Vector) {
// Use in-process decoding for vector graphics.
is_animated = decoder->is_animated();
loop_count = decoder->loop_count();