From 7acb6568269b10061c726b64d80a917d05dc0751 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Mon, 17 Jul 2023 13:15:13 -0400 Subject: [PATCH] LibGfx: Comment ImageDecoderPlugin's interface This is done as an effort to unify the behavior of every plugin. See #19893 for more details. --- Userland/Libraries/LibGfx/ImageFormats/ImageDecoder.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGfx/ImageFormats/ImageDecoder.h b/Userland/Libraries/LibGfx/ImageFormats/ImageDecoder.h index d16af1529d..a7a69bb841 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/ImageDecoder.h +++ b/Userland/Libraries/LibGfx/ImageFormats/ImageDecoder.h @@ -35,10 +35,19 @@ class ImageDecoderPlugin { public: virtual ~ImageDecoderPlugin() = default; + // Each plugin should implement these static functions and register them in ImageDecoder.cpp + // Implement sniff() if the file includes a magic number + // static bool sniff(ReadonlyBytes); + // Implement validate_before_create() otherwise + // static ErrorOr validate_before_create(ReadonlyBytes); + + // This function should be used to both create the context and parse the image header. + // static ErrorOr> create(ReadonlyBytes); + + // 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;