mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 21:07:35 +00:00
LibGfx: Remove Gfx::ImageDecoder::bitmap() in favor of frame(index)
To transparently support multi-frame images, all decoder plugins have already been updated to return their only bitmap for frame(0). This patch completes the remaining cleanup work by removing the ImageDecoder::bitmap() API and having all clients call frame() instead.
This commit is contained in:
parent
d01b4327fa
commit
751cb094ff
13 changed files with 35 additions and 49 deletions
|
@ -1397,7 +1397,8 @@ size_t BMPImageDecoderPlugin::frame_count()
|
|||
ImageFrameDescriptor BMPImageDecoderPlugin::frame(size_t i)
|
||||
{
|
||||
if (i > 0)
|
||||
return { bitmap(), 0 };
|
||||
return {};
|
||||
return {};
|
||||
return { bitmap(), 0 };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1046,9 +1046,11 @@ size_t DDSImageDecoderPlugin::frame_count()
|
|||
return 1;
|
||||
}
|
||||
|
||||
ImageFrameDescriptor DDSImageDecoderPlugin::frame([[maybe_unused]] size_t i)
|
||||
ImageFrameDescriptor DDSImageDecoderPlugin::frame(size_t i)
|
||||
{
|
||||
// We have "frames", but they are all the same image, so lets just use the largest version.
|
||||
if (i > 0)
|
||||
return {};
|
||||
return { bitmap(), 0 };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -382,10 +382,9 @@ size_t ICOImageDecoderPlugin::frame_count()
|
|||
|
||||
ImageFrameDescriptor ICOImageDecoderPlugin::frame(size_t i)
|
||||
{
|
||||
if (i > 0) {
|
||||
return { bitmap(), 0 };
|
||||
}
|
||||
return {};
|
||||
if (i > 0)
|
||||
return {};
|
||||
return { bitmap(), 0 };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -78,9 +78,4 @@ ImageDecoder::~ImageDecoder()
|
|||
{
|
||||
}
|
||||
|
||||
RefPtr<Gfx::Bitmap> ImageDecoder::bitmap() const
|
||||
{
|
||||
return m_plugin->bitmap();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ public:
|
|||
virtual ~ImageDecoderPlugin() { }
|
||||
|
||||
virtual IntSize size() = 0;
|
||||
virtual RefPtr<Gfx::Bitmap> bitmap() = 0;
|
||||
|
||||
virtual void set_volatile() = 0;
|
||||
[[nodiscard]] virtual bool set_nonvolatile(bool& was_purged) = 0;
|
||||
|
@ -43,6 +42,8 @@ public:
|
|||
virtual ImageFrameDescriptor frame(size_t i) = 0;
|
||||
|
||||
protected:
|
||||
virtual RefPtr<Gfx::Bitmap> bitmap() = 0;
|
||||
|
||||
ImageDecoderPlugin() { }
|
||||
};
|
||||
|
||||
|
@ -54,7 +55,6 @@ public:
|
|||
IntSize size() const { return m_plugin->size(); }
|
||||
int width() const { return size().width(); }
|
||||
int height() const { return size().height(); }
|
||||
RefPtr<Gfx::Bitmap> bitmap() const;
|
||||
void set_volatile() { m_plugin->set_volatile(); }
|
||||
[[nodiscard]] bool set_nonvolatile(bool& was_purged) { return m_plugin->set_nonvolatile(was_purged); }
|
||||
bool sniff() const { return m_plugin->sniff(); }
|
||||
|
|
|
@ -1327,9 +1327,9 @@ size_t JPGImageDecoderPlugin::frame_count()
|
|||
|
||||
ImageFrameDescriptor JPGImageDecoderPlugin::frame(size_t i)
|
||||
{
|
||||
if (i > 0) {
|
||||
return { bitmap(), 0 };
|
||||
}
|
||||
return {};
|
||||
if (i > 0)
|
||||
return {};
|
||||
return { bitmap(), 0 };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -195,11 +195,9 @@ size_t PBMImageDecoderPlugin::frame_count()
|
|||
|
||||
ImageFrameDescriptor PBMImageDecoderPlugin::frame(size_t i)
|
||||
{
|
||||
if (i > 0) {
|
||||
return { bitmap(), 0 };
|
||||
}
|
||||
|
||||
return {};
|
||||
if (i > 0)
|
||||
return {};
|
||||
return { bitmap(), 0 };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -198,11 +198,9 @@ size_t PGMImageDecoderPlugin::frame_count()
|
|||
|
||||
ImageFrameDescriptor PGMImageDecoderPlugin::frame(size_t i)
|
||||
{
|
||||
if (i > 0) {
|
||||
return { bitmap(), 0 };
|
||||
}
|
||||
|
||||
return {};
|
||||
if (i > 0)
|
||||
return {};
|
||||
return { bitmap(), 0 };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1013,10 +1013,9 @@ size_t PNGImageDecoderPlugin::frame_count()
|
|||
|
||||
ImageFrameDescriptor PNGImageDecoderPlugin::frame(size_t i)
|
||||
{
|
||||
if (i > 0) {
|
||||
return { bitmap(), 0 };
|
||||
}
|
||||
return {};
|
||||
if (i > 0)
|
||||
return {};
|
||||
return { bitmap(), 0 };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -200,11 +200,9 @@ size_t PPMImageDecoderPlugin::frame_count()
|
|||
|
||||
ImageFrameDescriptor PPMImageDecoderPlugin::frame(size_t i)
|
||||
{
|
||||
if (i > 0) {
|
||||
return { bitmap(), 0 };
|
||||
}
|
||||
|
||||
return {};
|
||||
if (i > 0)
|
||||
return {};
|
||||
return { bitmap(), 0 };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue