summaryrefslogtreecommitdiff
path: root/Libraries/LibGfx
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-01 21:32:54 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-01 21:32:54 +0200
commit7be9cf8d36c42a8ef9e96f0750554e8aa811d9c0 (patch)
tree25a07bd62df1c6333c2d0049a96c6e19ece9beb0 /Libraries/LibGfx
parent6ed11f1d1c268dec07c5bc595b4493a7f8efa6f1 (diff)
downloadserenity-7be9cf8d36c42a8ef9e96f0750554e8aa811d9c0.zip
LibGfx: Add ImageDecoder factory overload for ByteBuffers
Diffstat (limited to 'Libraries/LibGfx')
-rw-r--r--Libraries/LibGfx/ImageDecoder.h6
1 files changed, 4 insertions, 2 deletions
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 <AK/ByteBuffer.h>
#include <AK/OwnPtr.h>
#include <AK/RefCounted.h>
#include <AK/RefPtr.h>
@@ -42,7 +43,7 @@ struct ImageFrameDescriptor {
class ImageDecoderPlugin {
public:
- virtual ~ImageDecoderPlugin() {}
+ virtual ~ImageDecoderPlugin() { }
virtual Size size() = 0;
virtual RefPtr<Gfx::Bitmap> bitmap() = 0;
@@ -58,12 +59,13 @@ public:
virtual ImageFrameDescriptor frame(size_t i) = 0;
protected:
- ImageDecoderPlugin() {}
+ ImageDecoderPlugin() { }
};
class ImageDecoder : public RefCounted<ImageDecoder> {
public:
static NonnullRefPtr<ImageDecoder> create(const u8* data, size_t size) { return adopt(*new ImageDecoder(data, size)); }
+ static NonnullRefPtr<ImageDecoder> create(const ByteBuffer& data) { return adopt(*new ImageDecoder(data.data(), data.size())); }
~ImageDecoder();
Size size() const { return m_plugin->size(); }