1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 14:27:35 +00:00

LibGfx: Provide a default implementation for animation-related methods

Most image decoders that we have only support non-animated images,
providing a default implementation for them allows to remove quite some
code.
This commit is contained in:
Lucas CHOLLET 2023-07-17 13:29:12 -04:00 committed by Sam Atkins
parent 7acb656826
commit 806808f406
14 changed files with 6 additions and 160 deletions

View file

@ -47,10 +47,12 @@ public:
// This should always be available as gathered in create()
virtual IntSize size() = 0;
virtual bool is_animated() = 0;
virtual size_t loop_count() = 0;
virtual size_t frame_count() = 0;
virtual size_t first_animated_frame_index() = 0;
// Override this if the format supports animated images
virtual bool is_animated() { return false; }
virtual size_t loop_count() { return 0; }
virtual size_t frame_count() { return 1; }
virtual size_t first_animated_frame_index() { return 0; }
virtual ErrorOr<ImageFrameDescriptor> frame(size_t index, Optional<IntSize> ideal_size = {}) = 0;
virtual ErrorOr<Optional<ReadonlyBytes>> icc_data() = 0;