From 7be9cf8d36c42a8ef9e96f0750554e8aa811d9c0 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 1 Jun 2020 21:32:54 +0200 Subject: LibGfx: Add ImageDecoder factory overload for ByteBuffers --- Libraries/LibGfx/ImageDecoder.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Libraries/LibGfx') diff --git a/Libraries/LibGfx/ImageDecoder.h b/Libraries/LibGfx/ImageDecoder.h index bcc08c675c..7b8b5edf9d 100644 --- a/Libraries/LibGfx/ImageDecoder.h +++ b/Libraries/LibGfx/ImageDecoder.h @@ -26,6 +26,7 @@ #pragma once +#include #include #include #include @@ -42,7 +43,7 @@ struct ImageFrameDescriptor { class ImageDecoderPlugin { public: - virtual ~ImageDecoderPlugin() {} + virtual ~ImageDecoderPlugin() { } virtual Size size() = 0; virtual RefPtr bitmap() = 0; @@ -58,12 +59,13 @@ public: virtual ImageFrameDescriptor frame(size_t i) = 0; protected: - ImageDecoderPlugin() {} + ImageDecoderPlugin() { } }; class ImageDecoder : public RefCounted { public: static NonnullRefPtr create(const u8* data, size_t size) { return adopt(*new ImageDecoder(data, size)); } + static NonnullRefPtr create(const ByteBuffer& data) { return adopt(*new ImageDecoder(data.data(), data.size())); } ~ImageDecoder(); Size size() const { return m_plugin->size(); } -- cgit v1.2.3