mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:08:12 +00:00
LibDraw: Rename ImageLoader => ImageDecoder
ImageLoader was not the right name for this, as there is no loading happening, only decoding. :^)
This commit is contained in:
parent
02e787f8a4
commit
f970578cd4
8 changed files with 32 additions and 32 deletions
35
Libraries/LibDraw/ImageDecoder.h
Normal file
35
Libraries/LibDraw/ImageDecoder.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <LibDraw/Size.h>
|
||||
|
||||
class GraphicsBitmap;
|
||||
|
||||
class ImageDecoderPlugin {
|
||||
public:
|
||||
virtual ~ImageDecoderPlugin() {}
|
||||
|
||||
virtual Size size() = 0;
|
||||
virtual RefPtr<GraphicsBitmap> bitmap() = 0;
|
||||
|
||||
protected:
|
||||
ImageDecoderPlugin() {}
|
||||
};
|
||||
|
||||
class ImageDecoder : public RefCounted<ImageDecoder> {
|
||||
public:
|
||||
static NonnullRefPtr<ImageDecoder> create(const u8* data, size_t size) { return adopt(*new ImageDecoder(data, size)); }
|
||||
~ImageDecoder();
|
||||
|
||||
Size size() const { return m_plugin->size(); }
|
||||
int width() const { return size().width(); }
|
||||
int height() const { return size().height(); }
|
||||
RefPtr<GraphicsBitmap> bitmap() const { return m_plugin->bitmap(); }
|
||||
|
||||
private:
|
||||
ImageDecoder(const u8*, size_t);
|
||||
|
||||
mutable OwnPtr<ImageDecoderPlugin> m_plugin;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue